diff --git a/InstallerCLI/Program.cs b/InstallerCLI/Program.cs index 41e3530..c9e890e 100644 --- a/InstallerCLI/Program.cs +++ b/InstallerCLI/Program.cs @@ -13,12 +13,14 @@ namespace Installer { public static class Program { + public static bool Basic; public static int Main(string[] args) { Thread.Sleep(2000); MutexLock.Lock(); try { + Basic = args.Length > 0 && args[0].ToLower() == "--basic"; ExternalFunctionalityManager.Init(new UtLibFunctions()); RootCommand rootCommand = new RootCommand(); Command install = new Command("install", "Install UpTool") diff --git a/InstallerCLI/UTLibFunctions.cs b/InstallerCLI/UTLibFunctions.cs index 4d225f3..9691937 100644 --- a/InstallerCLI/UTLibFunctions.cs +++ b/InstallerCLI/UTLibFunctions.cs @@ -5,6 +5,7 @@ using System.Threading; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing; using UpToolLib.DataStructures; +using static Installer.Program; namespace Installer { @@ -25,9 +26,12 @@ namespace Installer }; client.DownloadProgressChanged += (sender, e) => { - Console.Write( - $"{new string('=', e.ProgressPercentage / 10)}[{e.ProgressPercentage}]{new string('-', 10 - e.ProgressPercentage / 10)}"); - Console.CursorLeft = 0; + if (!Basic) + { + Console.Write( + $"{new string('=', e.ProgressPercentage / 10)}[{e.ProgressPercentage}]{new string('-', 10 - e.ProgressPercentage / 10)}"); + Console.CursorLeft = 0; + } }; client.DownloadDataAsync(link); while (!finished) @@ -47,54 +51,67 @@ namespace Installer public bool YesNoDialog(string text, bool defaultVal) { - bool choosing = true; - bool current = defaultVal; - Console.WriteLine(text); - while (choosing) + if (Basic) { - Console.CursorLeft = 0; - Console.BackgroundColor = current ? ConsoleColor.White : ConsoleColor.Black; - Console.ForegroundColor = current ? ConsoleColor.Black : ConsoleColor.White; - Console.Write("Yes"); - Console.ResetColor(); - Console.Write(" "); - Console.BackgroundColor = current ? ConsoleColor.Black : ConsoleColor.White; - Console.ForegroundColor = current ? ConsoleColor.White : ConsoleColor.Black; - Console.Write("No"); - Console.ResetColor(); - switch (Console.ReadKey().Key) - { - case ConsoleKey.LeftArrow: - case ConsoleKey.RightArrow: - current = !current; - break; - case ConsoleKey.Enter: - choosing = false; - break; - case ConsoleKey.Escape: - current = defaultVal; - choosing = false; - break; - } + Console.WriteLine(text); + Console.WriteLine($"Selecting: {defaultVal}"); + return defaultVal; + } + else + { + bool choosing = true; + bool current = defaultVal; + Console.WriteLine(text); + while (choosing) + { + Console.CursorLeft = 0; + Console.BackgroundColor = current ? ConsoleColor.White : ConsoleColor.Black; + Console.ForegroundColor = current ? ConsoleColor.Black : ConsoleColor.White; + Console.Write("Yes"); + Console.ResetColor(); + Console.Write(" "); + Console.BackgroundColor = current ? ConsoleColor.Black : ConsoleColor.White; + Console.ForegroundColor = current ? ConsoleColor.White : ConsoleColor.Black; + Console.Write("No"); + Console.ResetColor(); + switch (Console.ReadKey().Key) + { + case ConsoleKey.LeftArrow: + case ConsoleKey.RightArrow: + current = !current; + break; + case ConsoleKey.Enter: + choosing = false; + break; + case ConsoleKey.Escape: + current = defaultVal; + choosing = false; + break; + } + } + Console.ResetColor(); + Console.WriteLine($" Selecting: {current}"); + return current; } - Console.ResetColor(); - Console.WriteLine($" Selecting: {current}"); - return current; } public void OkDialog(string text) { - Console.WriteLine(text); - Console.BackgroundColor = ConsoleColor.White; - Console.Write("OK"); - Console.ResetColor(); - Console.ReadKey(); + if (Basic) + Console.WriteLine(text); + else + { + Console.WriteLine(text); + Console.BackgroundColor = ConsoleColor.White; + Console.Write("OK"); + Console.ResetColor(); + Console.ReadKey(); + } } public object GetDefaultIcon() => 0; public object ImageFromB64(string b64) => 0; - public void Log(string text) => Console.WriteLine(text); } } \ No newline at end of file diff --git a/UpToolCLI/Other.cs b/UpToolCLI/Other.cs index f45193c..3dbcc3d 100644 --- a/UpToolCLI/Other.cs +++ b/UpToolCLI/Other.cs @@ -28,7 +28,7 @@ namespace UpToolCLI Command start = new Command("start", "Starts an app") { new Argument("identifier", "Something to identify the app"), - new Option(new[] {"--waitForExit", "-wait"}, "Waits until the program quits") + new Option(new[] {"--waitForExit", "-wait"}, "Waits until the program quits") }; start.Handler = CommandHandler.Create(Start); rootCommand.AddCommand(start);