console changes

This commit is contained in:
Bitl 2023-03-10 10:00:23 -07:00
parent b499fd6879
commit fbf9183187
4 changed files with 21 additions and 13 deletions

View File

@ -1,4 +1,6 @@
 
using System.Collections.Generic;
namespace NovetusLauncher namespace NovetusLauncher
{ {
#region LocalVars #region LocalVars
@ -9,7 +11,8 @@ namespace NovetusLauncher
public static string prevsplash = ""; public static string prevsplash = "";
public static bool launcherInitState = true; public static bool launcherInitState = true;
//hack for linux. store the command line variables locally. //hack for linux. store the command line variables locally.
public static string cmdLine = ""; public static List<string> cmdLineArray = new List<string>();
public static string cmdLineString = "";
#endregion #endregion
} }
#endregion #endregion

View File

@ -574,7 +574,7 @@ namespace NovetusLauncher
public void RestartApp() public void RestartApp()
{ {
var process = Process.GetCurrentProcess(); var process = Process.GetCurrentProcess();
Process.Start(Assembly.GetExecutingAssembly().Location, LocalVars.cmdLine); Process.Start(Assembly.GetExecutingAssembly().Location, LocalVars.cmdLineString);
CloseEventInternal(); CloseEventInternal();
} }

View File

@ -23,10 +23,10 @@ namespace NovetusLauncher
string[] argList; string[] argList;
FileFormat.Config savedConfig; FileFormat.Config savedConfig;
public NovetusConsole(string[] args) public NovetusConsole()
{ {
ConsoleForm = new LauncherFormShared(); ConsoleForm = new LauncherFormShared();
argList = args; argList = LocalVars.cmdLineArray.ToArray();
InitializeComponent(); InitializeComponent();
} }
@ -86,7 +86,7 @@ namespace NovetusLauncher
{ {
//cmd mode //cmd mode
savedConfig = GlobalVars.UserConfiguration; savedConfig = GlobalVars.UserConfiguration;
disableCommands = true; //disableCommands = true;
bool no3d = false; bool no3d = false;
bool nomap = false; bool nomap = false;
@ -487,6 +487,9 @@ namespace NovetusLauncher
} }
ScrollToEnd(); ScrollToEnd();
break; break;
case string cmdArgs when cmdArgs.Contains("commandline", StringComparison.InvariantCultureIgnoreCase) == true:
Util.ConsolePrint(LocalVars.cmdLineString, 3);
break;
default: default:
Util.ConsolePrint("Command is either not registered or valid", 2); Util.ConsolePrint("Command is either not registered or valid", 2);
ScrollToEnd(); ScrollToEnd();

View File

@ -81,17 +81,19 @@ namespace NovetusLauncher
} }
} }
foreach (string argString in args) LocalVars.cmdLineArray = args.ToList();
{
LocalVars.cmdLine += argString;
if (!argString.Equals(args.Last())) foreach (string argString in LocalVars.cmdLineArray)
{
LocalVars.cmdLineString += argString;
if (!argString.Equals(LocalVars.cmdLineArray.Last()))
{ {
LocalVars.cmdLine += " "; LocalVars.cmdLineString += " ";
} }
} }
Run(args, isSDK, state); Run(isSDK, state);
} }
static void CreateFiles() static void CreateFiles()
@ -113,7 +115,7 @@ namespace NovetusLauncher
DiscordRPC.StartDiscord(); DiscordRPC.StartDiscord();
} }
static void Run(string[] args, bool sdk = false, CMDState state = CMDState.CMDOpen) static void Run(bool sdk = false, CMDState state = CMDState.CMDOpen)
{ {
try try
{ {
@ -125,7 +127,7 @@ namespace NovetusLauncher
{ {
if (state != CMDState.CMDNone) if (state != CMDState.CMDNone)
{ {
NovetusConsole console = new NovetusConsole(args); NovetusConsole console = new NovetusConsole();
GlobalVars.consoleForm = console; GlobalVars.consoleForm = console;
console.Show(); console.Show();
} }