cmd tools

This commit is contained in:
2024-06-18 11:58:49 +02:00
parent c95e73be48
commit 0f4ba96963
3 changed files with 42 additions and 1 deletions

View File

@@ -56,6 +56,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pilz.Configuration" Version="3.1.2" /> <PackageReference Include="Pilz.Configuration" Version="3.1.2" />
<PackageReference Include="Pilz.Cryptography" Version="2.0.1" /> <PackageReference Include="Pilz.Cryptography" Version="2.0.1" />

25
ModpackUpdater/Options.cs Normal file
View File

@@ -0,0 +1,25 @@
using Mono.Options;
namespace ModpackUpdater;
internal class Options
{
private readonly List<string> additionals = [];
public IReadOnlyList<string> Additionals => additionals;
public bool InstallWithoutUi { get; private set; }
public string ProfileFolder { get; private set; }
public string ModpackConfig { get; private set; }
public Options(string[] args)
{
var options = new OptionSet
{
{ "i", "Install without user interface.", n => InstallWithoutUi = n != null },
{ "p|profile=", "Sets the minecraft profile folder.", p => ProfileFolder = p },
{ "c|config=", "Sets the minecraft profile folder.", c => ModpackConfig = c },
};
var additional = options.Parse(args);
}
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json; using Mono.Options;
using Newtonsoft.Json;
using Pilz.Configuration; using Pilz.Configuration;
using Telerik.WinControls; using Telerik.WinControls;
@@ -17,6 +18,15 @@ public static class Program
} }
internal static void Main(string[] args) internal static void Main(string[] args)
{
var options = new Options(args);
if (options.InstallWithoutUi)
InstallWithoutGui(options.ProfileFolder, options.ModpackConfig);
else
RunApp();
}
private static void RunApp()
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
@@ -58,4 +68,9 @@ public static class Program
// Delete legacy config file // Delete legacy config file
File.Delete(settingsPath); File.Delete(settingsPath);
} }
private static void InstallWithoutGui(string profileFolder, string modpackConfig)
{
}
} }