diff --git a/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs b/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs index 431f871..3b11a9f 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs @@ -1015,7 +1015,10 @@ public class ClientManagement Util.ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2); #if LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } #endif return; } @@ -1027,7 +1030,10 @@ public class ClientManagement "Roblox does NOT use TCP, only UDP. However, if your server doesn't work with just UDP, feel free to set up TCP too as that might help the issue in some cases."; #pragma warning restore CS0219 // Variable is assigned but its value is never used #if LAUNCHER - MessageBox.Show(hostingTips, "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show(hostingTips, "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Information); + } #elif CMD Util.ConsolePrint(hostingTips + "\nPress any key to continue...", 4); Console.ReadKey(); @@ -1048,7 +1054,10 @@ public class ClientManagement Util.ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2); #if LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: A game is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show("Failed to launch Novetus. (Error: A game is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } #endif return; } @@ -1095,7 +1104,10 @@ public class ClientManagement #endif #if LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } #endif #if URI @@ -1185,7 +1197,10 @@ public class ClientManagement #endif #if LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } #endif #if URI @@ -1243,7 +1258,10 @@ public class ClientManagement #endif #if URI || LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + if (!GlobalVars.isConsoleOnly) + { + MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } #endif #if URI || LAUNCHER || CMD || BASICLAUNCHER Util.LogExceptions(ex); diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs index bb080d2..776ee9b 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs @@ -109,6 +109,7 @@ public static class GlobalVars public static string Important2 = ""; public static string NextCommand = ""; public static bool AppClosed = false; + public static bool isConsoleOnly = false; #endregion } #endregion diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index 9d009ad..425eb50 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -351,7 +351,7 @@ namespace NovetusLauncher break; } - if (GlobalVars.UserConfiguration.CloseOnLaunch) + if (GlobalVars.UserConfiguration.CloseOnLaunch && !GlobalVars.isConsoleOnly) { Parent.Visible = false; } @@ -431,6 +431,11 @@ namespace NovetusLauncher { Parent.Visible = true; } + + if (GlobalVars.isConsoleOnly && !GlobalVars.isConsoleOnly) + { + CloseEventInternal(); + } } // FINALLY. https://stackoverflow.com/questions/11530643/treeview-search diff --git a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs index f99eac8..41dbc2b 100644 --- a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs +++ b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs @@ -41,7 +41,6 @@ namespace NovetusLauncher GlobalVars.ColorsLoaded = FileManagement.InitColors(); bool isSDK = false; - bool isCMD = false; if (args.Length > 0) { @@ -54,7 +53,7 @@ namespace NovetusLauncher if (CommandLine["cmd"] != null) { - isCMD = true; + GlobalVars.isConsoleOnly = true; } if (CommandLine["nofilelist"] != null) @@ -63,7 +62,7 @@ namespace NovetusLauncher } } - Run(args, isSDK, isCMD); + Run(args, isSDK, GlobalVars.isConsoleOnly); } static void Run(string[] args, bool sdk = false, bool cmdonly = false)