help command line var for novetus cmd

This commit is contained in:
Bitl 2020-07-11 15:15:47 -07:00
parent bcd5fef4fe
commit 9a47a4d292
6 changed files with 140 additions and 60 deletions

35
.itch.toml Normal file
View File

@ -0,0 +1,35 @@
[[actions]]
name = "Play"
path = "bin/Novetus.exe"
sandbox = true
[[actions]]
name = "Install Required Dependencies"
path = "Novetus_dependency_installer.bat"
console = true
sandbox = true
[[actions]]
name = "Novetus SDK"
path = "bin/Novetus.exe"
args = ["-sdk"]
sandbox = true
[[actions]]
name = "Novetus CMD"
path = "bin/NovetusCMD.exe"
console = true
sandbox = true
[[actions]]
name = "Novetus CMD Help"
path = "bin/NovetusCMD.exe"
args = ["-help"]
console = true
sandbox = true
[[actions]]
name = "Install URI"
path = "itch_loadNovetusURI.bat"
console = true
sandbox = true

View File

@ -1,4 +1,5 @@
#region Usings
using System;
using System.Diagnostics;
using System.Linq;
#endregion
@ -12,6 +13,48 @@ namespace NovetusCMD
{
return Process.GetProcesses().Any(x => x.Id == id);
}
public static void CommandInfo()
{
GlobalFuncs.ConsolePrint("Novetus CMD Command Line Arguments", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("General", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("-help | Displays the help.", 4, true);
GlobalFuncs.ConsolePrint("-no3d | Launches server in NoGraphics mode", 4, true);
GlobalFuncs.ConsolePrint("-script <path to script> | Loads an additional server script.", 4, true);
GlobalFuncs.ConsolePrint("-outputinfo | Outputs all information about the running server to a text file.", 4, true);
GlobalFuncs.ConsolePrint("-overrideconfig | Override the launcher settings.", 4, true);
GlobalFuncs.ConsolePrint("-debug | Disables launching of the server for debugging purposes.", 4, true);
GlobalFuncs.ConsolePrint("-nowebserver | Disables launching of the web server.", 4, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Custom server options", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("-overrideconfig must be added in order for the below commands to function.", 5, true);
GlobalFuncs.ConsolePrint("-upnp | Turns on UPnP.", 4, true);
GlobalFuncs.ConsolePrint("-map <map filename> | Sets the map.", 4, true);
GlobalFuncs.ConsolePrint("-client <client name> | Sets the client.", 4, true);
GlobalFuncs.ConsolePrint("-port <port number> | Sets the server port.", 4, true);
GlobalFuncs.ConsolePrint("-maxplayers <number of players> | Sets the number of players.", 4, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("How to launch:", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Create a shortcut to NovetusCMD in the bin folder of Novetus' Directory or", 4, true);
GlobalFuncs.ConsolePrint("create a batch file that launches NovetusCMD.", 4, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Shortcuts", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Right-click your shortcut and then go to Properties -> Shortcut.", 4, true);
GlobalFuncs.ConsolePrint("Go to 'Target' and then click the end of where it says 'NovetusCMD.exe'", 4, true);
GlobalFuncs.ConsolePrint("Press space and then type in whatever arguments you please.", 4, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Batch", 3, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Click the end of where it says 'NovetusCMD.exe'", 4, true);
GlobalFuncs.ConsolePrint("Press space and then type in whatever arguments you please.", 4, true);
GlobalFuncs.ConsolePrint("---------", 1, true);
GlobalFuncs.ConsolePrint("Press any key to close...", 2, true);
}
}
#endregion
}

View File

@ -7,6 +7,7 @@
public static bool OverrideINI = false;
public static bool DebugMode = false;
public static bool NoWebServer = false;
public static bool PrintHelp = false;
}
#endregion
}

View File

@ -155,37 +155,15 @@ namespace NovetusCMD
#region Main Program Function
public static void Main(string[] args)
{
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true);
Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";
GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);
GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1);
if (args.Length == 0)
{
GlobalFuncs.ConsolePrint("Help: Command Line Arguments", 3);
GlobalFuncs.ConsolePrint("---------", 1);
GlobalFuncs.ConsolePrint("General", 3);
GlobalFuncs.ConsolePrint("-no3d | Launches server in NoGraphics mode", 4);
GlobalFuncs.ConsolePrint("-script <path to script> | Loads an additional server script.", 4);
GlobalFuncs.ConsolePrint("-outputinfo | Outputs all information about the running server to a text file.", 4);
GlobalFuncs.ConsolePrint("-overrideconfig | Override the launcher settings.", 4);
GlobalFuncs.ConsolePrint("-debug | Disables launching of the server for debugging purposes.", 4);
GlobalFuncs.ConsolePrint("-nowebserver | Disables launching of the web server.", 4);
GlobalFuncs.ConsolePrint("---------", 1);
GlobalFuncs.ConsolePrint("Custom server options", 3);
GlobalFuncs.ConsolePrint("-overrideconfig must be added in order for the below commands to function.", 5);
GlobalFuncs.ConsolePrint("-upnp | Turns on UPnP.", 4);
GlobalFuncs.ConsolePrint("-map <map filename> | Sets the map.", 4);
GlobalFuncs.ConsolePrint("-client <client name> | Sets the client.", 4);
GlobalFuncs.ConsolePrint("-port <port number> | Sets the server port.", 4);
GlobalFuncs.ConsolePrint("-maxplayers <number of players> | Sets the number of players.", 4);
GlobalFuncs.ConsolePrint("---------", 1);
}
else
if (args.Length > 0)
{
CommandLineArguments.Arguments CommandLine = new CommandLineArguments.Arguments(args);
if (CommandLine["help"] != null)
{
LocalVars.PrintHelp = true;
}
if (CommandLine["no3d"] != null)
{
LocalVars.StartInNo3D = true;
@ -261,42 +239,58 @@ namespace NovetusCMD
}
}
if (!LocalVars.OverrideINI)
if (!LocalVars.PrintHelp)
{
GlobalFuncs.ConsolePrint("NovetusCMD is now loading all server configurations from the INI file.", 5);
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true);
Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName))
GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);
GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1);
if (!LocalVars.OverrideINI)
{
GlobalFuncs.ConsolePrint("WARNING 2 - " + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5);
WriteConfigValues();
GlobalFuncs.ConsolePrint("NovetusCMD is now loading all server configurations from the INI file.", 5);
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName))
{
GlobalFuncs.ConsolePrint("WARNING 2 - " + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5);
WriteConfigValues();
}
ReadConfigValues();
}
else
{
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
ReadConfigValues();
InitUPnP();
if (!LocalVars.NoWebServer)
{
StartWebServer();
}
AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProgramClose);
GlobalFuncs.ConsolePrint("Launching a " + GlobalVars.UserConfiguration.SelectedClient + " server on " + GlobalVars.UserConfiguration.Map + " with " + GlobalVars.UserConfiguration.PlayerLimit + " players.", 1);
switch (LocalVars.DebugMode)
{
case true:
GlobalFuncs.CreateTXT();
break;
case false:
default:
StartServer(LocalVars.StartInNo3D);
break;
}
}
else
{
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
LocalFuncs.CommandInfo();
}
InitUPnP();
if (!LocalVars.NoWebServer)
{
StartWebServer();
}
AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProgramClose);
GlobalFuncs.ConsolePrint("Launching a " + GlobalVars.UserConfiguration.SelectedClient + " server on " + GlobalVars.UserConfiguration.Map + " with " + GlobalVars.UserConfiguration.PlayerLimit + " players.", 1);
if (!LocalVars.DebugMode)
{
StartServer(LocalVars.StartInNo3D);
}
else
{
GlobalFuncs.CreateTXT();
}
Console.ReadKey();
}

View File

@ -1109,9 +1109,12 @@ public class GlobalFuncs
box.AppendText(Environment.NewLine);
}
#elif CMD
public static void ConsolePrint(string text, int type)
public static void ConsolePrint(string text, int type, bool notime = false)
{
ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White);
if (!notime)
{
ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White);
}
switch (type)
{

View File

@ -37,8 +37,9 @@ ECHO 1 - Play
ECHO 2 = Install Required Dependencies
ECHO 3 - Novetus SDK
ECHO 4 - Novetus CMD
ECHO 5 - Install URI
ECHO 6 - Exit
ECHO 5 - Novetus CMD Help
ECHO 6 - Install URI
ECHO 7 - Exit
ECHO.
SET /P M=Choose an option by typing the number corresponding to which utility you want to launch:
IF %M%==1 CLS
@ -55,8 +56,11 @@ IF %M%==4 CLS
IF %M%==4 "bin/NovetusCMD.exe"
IF %M%==5 CLS
IF %M%==5 start "" "%CD%/bin/NovetusURI.exe"
IF %M%==5 EXIT
IF %M%==5 "bin/NovetusCMD.exe" -help
IF %M%==6 CLS
IF %M%==6 start "" "%CD%/bin/NovetusURI.exe"
IF %M%==6 EXIT
IF %M%==7 EXIT
EXIT