From e986cde90b7b5ce6cf5e4e41bf33691661fe1657 Mon Sep 17 00:00:00 2001 From: he3als Date: Sat, 18 Nov 2023 21:07:24 +0000 Subject: [PATCH] fix(.net 3.5): final touches (ejecting ISO, etc) --- src/Actions/.NET.cs | 17 ++++++++++------- src/Program.cs | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Actions/.NET.cs b/src/Actions/.NET.cs index 72d8933..e3c76a5 100644 --- a/src/Actions/.NET.cs +++ b/src/Actions/.NET.cs @@ -52,18 +52,21 @@ namespace amecs.Actions { string letter; - var choice = new ChoicePrompt() { Text = "A Windows Setup ISO must be provided to install .NET 3.5.\r\nDo you have a Win USB/folder instead of an ISO? (Y/N): " }.Start(); + var choice = new ChoicePrompt() { Text = "To install .NET 3.5, Windows installation media is needed.\r\nDo you have a Windows USB instead of an ISO? (Y/N): " }.Start(); if (choice == null) return false; var usingFolder = choice == 0; if (usingFolder) { var dlg = new FolderPicker(); dlg.InputPath = Globals.UserFolder; - if (dlg.ShowDialog(default, false) == false) return false; + if (!dlg.ShowDialog(IntPtr.Zero, false).GetValueOrDefault()) + { + Console.WriteLine(); + ConsoleTUI.OpenFrame.Close("\r\nYou must select a folder or drive.", new ChoicePrompt() {AnyKey = true, Text = "Press any key to return to the Menu: "}); + return true; + } if (CheckFileViolation(dlg.ResultPath)) return false; letter = dlg.ResultPath; - Console.WriteLine(letter); - Console.ReadLine(); } else { @@ -74,7 +77,6 @@ namespace amecs.Actions NativeWindow window = new NativeWindow(); window.AssignHandle(Process.GetCurrentProcess().MainWindowHandle); - Console.WriteLine("a"); if (dialog.ShowDialog(window) == DialogResult.OK) { if (CheckFileViolation(dialog.FileName)) return false; @@ -156,7 +158,7 @@ namespace amecs.Actions } DismApi.Shutdown(); - if (usingFolder) DismountImage(); + if (!usingFolder) DismountImage(); } } catch (Exception e) { @@ -165,7 +167,7 @@ namespace amecs.Actions Thread.Sleep(50); } - if (usingFolder) + if (!usingFolder) { try { @@ -188,6 +190,7 @@ namespace amecs.Actions Console.WriteLine(); Console.WriteLine(); + if (!usingFolder) ConsoleTUI.OpenFrame.Close(".NET 3.5 installed successfully", ConsoleColor.Green, Console.BackgroundColor, new ChoicePrompt() { AnyKey = true, diff --git a/src/Program.cs b/src/Program.cs index 1e37651..d722486 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -40,9 +40,9 @@ namespace amecs private const string Ver = "2.1"; public static ConsoleTUI.Frame Frame; - - - public static async Task Main(string[] args) + [STAThread] + + public static void Main(string[] args) { ConsoleTUI.Initialize("Central AME Script");