add help dialog. add cmd args.

This commit is contained in:
Bitl 2022-09-15 09:46:16 -07:00
parent 0cbadf7859
commit ee3eb38ffe
4 changed files with 69 additions and 26 deletions

View File

@ -16,7 +16,6 @@ namespace Novetus.Bootstrapper
#region File Names
public static readonly string LauncherName = "Novetus.exe";
public static readonly string CMDName = "NovetusCMD.exe";
public static readonly string URIName = "NovetusURI.exe";
public static readonly string DependencyLauncherName = "Novetus_dependency_installer.bat";
#endregion

View File

@ -39,10 +39,10 @@ namespace Novetus.Bootstrapper
this.ArgLabel = new System.Windows.Forms.Label();
this.ArgBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.LauncherBox = new System.Windows.Forms.CheckBox();
this.URIButton = new System.Windows.Forms.Button();
this.VersionLabel = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.LauncherBox = new System.Windows.Forms.CheckBox();
this.CMDGroup.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@ -110,7 +110,7 @@ namespace Novetus.Bootstrapper
this.CMDGroup.Size = new System.Drawing.Size(263, 92);
this.CMDGroup.TabIndex = 6;
this.CMDGroup.TabStop = false;
this.CMDGroup.Text = "Novetus CMD";
this.CMDGroup.Text = "Novetus Console";
//
// ArgLabel
//
@ -141,6 +141,17 @@ namespace Novetus.Bootstrapper
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Other Options";
//
// LauncherBox
//
this.LauncherBox.AutoSize = true;
this.LauncherBox.Location = new System.Drawing.Point(51, 68);
this.LauncherBox.Name = "LauncherBox";
this.LauncherBox.Size = new System.Drawing.Size(120, 17);
this.LauncherBox.TabIndex = 7;
this.LauncherBox.Text = "Skip on next launch";
this.LauncherBox.UseVisualStyleBackColor = true;
this.LauncherBox.CheckedChanged += new System.EventHandler(this.LauncherBox_CheckedChanged);
//
// URIButton
//
this.URIButton.Location = new System.Drawing.Point(117, 19);
@ -174,17 +185,6 @@ namespace Novetus.Bootstrapper
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
//
// LauncherBox
//
this.LauncherBox.AutoSize = true;
this.LauncherBox.Location = new System.Drawing.Point(51, 68);
this.LauncherBox.Name = "LauncherBox";
this.LauncherBox.Size = new System.Drawing.Size(120, 17);
this.LauncherBox.TabIndex = 7;
this.LauncherBox.Text = "Skip on next launch";
this.LauncherBox.UseVisualStyleBackColor = true;
this.LauncherBox.CheckedChanged += new System.EventHandler(this.LauncherBox_CheckedChanged);
//
// NovetusLaunchForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -76,13 +76,13 @@ namespace Novetus.Bootstrapper
private void CMDButton_Click(object sender, EventArgs e)
{
LocalFuncs.LaunchApplication(LocalPaths.CMDName, ArgBox.Text);
LocalFuncs.LaunchApplication(LocalPaths.LauncherName, "-cmd " + ArgBox.Text);
Close();
}
private void CMDHelpButton_Click(object sender, EventArgs e)
{
LocalFuncs.LaunchApplication(LocalPaths.CMDName, "-help");
LocalFuncs.LaunchApplication(LocalPaths.LauncherName, "-cmd -help");
}
private void DependencyInstallerButton_Click(object sender, EventArgs e)

View File

@ -16,17 +16,14 @@ namespace NovetusLauncher
public partial class NovetusConsole : Form
{
static LauncherFormShared ConsoleForm;
bool helpMode = false;
string[] argList;
public NovetusConsole(string[] args)
{
ConsoleForm = new LauncherFormShared();
argList = args;
InitializeComponent();
if (args.Length > 0)
{
//DO ARGS HERE
ConsoleProcessArguments(args);
}
}
private void NovetusConsole_Load(object sender, EventArgs e)
@ -60,13 +57,27 @@ namespace NovetusLauncher
Util.InitUPnP();
Util.StartDiscord();
if (argList.Length > 0)
{
//DO ARGS HERE
ConsoleProcessArguments(argList);
}
}
private void ConsoleProcessArguments(string[] args)
{
CommandLineArguments.Arguments ConsoleArgs = new CommandLineArguments.Arguments(args);
if (ConsoleArgs["cmd"] != null)
if (ConsoleArgs["help"] != null)
{
helpMode = true;
ConsoleHelp();
}
bool CMDMode = (ConsoleArgs["cmd"] != null && !helpMode);
if (CMDMode)
{
//cmd mode
}
@ -197,6 +208,9 @@ namespace NovetusLauncher
Util.ConsolePrint("Please specify the IP address you would like to set Novetus to.", 2);
}
break;
case string clear when clear.Contains("clear", StringComparison.InvariantCultureIgnoreCase) == true:
ClearConsole();
break;
case string important when string.Compare(important, GlobalVars.Important, true, CultureInfo.InvariantCulture) == 0:
GlobalVars.AdminMode = true;
Util.ConsolePrint("ADMIN MODE ENABLED.", 4);
@ -215,6 +229,7 @@ namespace NovetusLauncher
public void ConsoleHelp()
{
ClearConsole();
Util.ConsolePrint("Help:", 3, true);
Util.ConsolePrint("---------", 1, true);
Util.ConsolePrint("Commands:", 3, true);
@ -228,21 +243,37 @@ namespace NovetusLauncher
Util.ConsolePrint("+ sdk | Launches the Novetus SDK Launcher", 4, true);
Util.ConsolePrint("+ dlldelete | Toggle the deletion of opengl32.dll when ReShade is off.", 4, true);
Util.ConsolePrint("+ altserverip <IP> | Sets the alternate server IP for server info. Replace <IP> with your specified IP or specify 'none' to remove the current alternate server IP", 4, true);
Util.ConsolePrint("+ clear | Clears all text in this window.", 4, true);
Util.ConsolePrint("+ help | Clears all text and shows this list.", 4, true);
Util.ConsolePrint("---------", 1, true);
Util.ConsolePrint("Command-Line Parameters:", 3, true);
Util.ConsolePrint("GLOBAL - Affects launcher session.", 5, true);
Util.ConsolePrint("CONSOLE - Affects console only.", 5, true);
Util.ConsolePrint("---------", 1, true);
Util.ConsolePrint("- sdk | Launches the Novetus SDK Launcher", 4, true);
Util.ConsolePrint("- client | Launches client with launcher settings", 4, true);
Util.ConsolePrint("- nofilelist | Disables file list generation", 4, true);
Util.ConsolePrint("- sdk (GLOBAL) | Launches the Novetus SDK Launcher.", 4, true);
Util.ConsolePrint("- cmd (GLOBAL) | Launches the Novetus Console only and puts it into NovetusCMD mode.", 4, true);
Util.ConsolePrint("- nofilelist (GLOBAL) | Disables file list generation", 4, true);
Util.ConsolePrint("- help (CONSOLE) | Clears all text and shows this list.", 4, true);
Util.ConsolePrint("---------", 1, true);
Util.ConsolePrint("= config save | Saves the config file", 4, true);
Util.ConsolePrint("= config load | Reloads the config file", 4, true);
Util.ConsolePrint("= config reset | Resets the config file", 4, true);
Util.ConsolePrint(GlobalVars.Important2, 0, true, true);
ScrollToTop();
}
private void ProcessConsole(object sender, KeyEventArgs e)
{
if (helpMode)
{
if (e.KeyCode == Keys.Enter)
{
e.Handled = true;
ConsoleForm.CloseEventInternal();
}
return;
}
//Command proxy
int totalLines = ConsoleBox.Lines.Length;
@ -272,6 +303,19 @@ namespace NovetusLauncher
}
}
private void ClearConsole()
{
ConsoleBox.Text = "";
ConsoleBox.SelectionStart = 0;
ConsoleBox.ScrollToCaret();
}
private void ScrollToTop()
{
ConsoleBox.SelectionStart = 0;
ConsoleBox.ScrollToCaret();
}
private void ConsoleClose(object sender, FormClosingEventArgs e)
{
ConsoleForm.CloseEventInternal();