From ea49872a1cfe362874d4b2c5c1d4081dcf259545 Mon Sep 17 00:00:00 2001 From: Bitl Date: Fri, 28 Dec 2018 20:36:32 -0700 Subject: [PATCH] post rc2 launcher changes --- .../NovetusLauncher/CharacterCustomization.cs | 2 +- .../NovetusLauncher/LauncherFuncs.cs | 112 ++++++----- .../NovetusLauncher/MainForm.Designer.cs | 21 +- NovetusLauncher/NovetusLauncher/MainForm.cs | 180 +++++++++++++++--- 4 files changed, 236 insertions(+), 79 deletions(-) diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs index 1ac29a5..45b53f4 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs @@ -1043,7 +1043,7 @@ namespace NovetusLauncher string mapfile = GlobalVars.ConfigDir + "\\preview\\content\\fonts\\3DView.rbxl"; string rbxexe = GlobalVars.ConfigDir + "\\preview\\3DView.exe"; string quote = "\""; - string args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); _G.CS3DView(0,'Player','" + GlobalVars.loadtext + ");" + quote; + string args = quote + mapfile + "\" -script \"dofile('" + luafile + "'); _G.CS3DView(0,'Player'," + GlobalVars.loadtext + ");" + quote; try { Process client = new Process(); diff --git a/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs b/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs index 7b93de7..bd977ed 100644 --- a/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs +++ b/NovetusLauncher/NovetusLauncher/LauncherFuncs.cs @@ -280,41 +280,45 @@ namespace NovetusLauncher public static void ReloadLoadtextValue() { - //todo: make sure webserver works after RC2, then use commented loadtext value and add charapp. + if (GlobalVars.IsWebServerOn == true) + { + string extra = GlobalVars.Custom_Extra_SelectionIsHat == true ? GlobalVars.WebServer_HatDir + GlobalVars.Custom_Extra : GlobalVars.WebServer_ExtraDir + GlobalVars.Custom_Extra; - /* - string extra = GlobalVars.Custom_Extra_SelectionIsHat == true ? GlobalVars.WebServer_HatDir + GlobalVars.Custom_Extra : GlobalVars.WebServer_ExtraDir + GlobalVars.Custom_Extra; + GlobalVars.loadtext = "'" + GlobalVars.WebServer_BodyColors + "','" + + GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat1ID_Offline + "','" + + GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat2ID_Offline + "','" + + GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat3ID_Offline + "'," + + GlobalVars.WebServer_TShirtDir + GlobalVars.Custom_T_Shirt_Offline + "','" + + GlobalVars.WebServer_ShirtDir + GlobalVars.Custom_Shirt_Offline + "','" + + GlobalVars.WebServer_PantsDir + GlobalVars.Custom_Pants_Offline + "','" + + GlobalVars.WebServer_FaceDir + GlobalVars.Custom_Face_Offline + "','" + + GlobalVars.WebServer_HeadDir + GlobalVars.Custom_Head_Offline + "','" + + GlobalVars.Custom_Icon_Offline + "','" + + extra + "', true"; - GlobalVars.loadtext = GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat1ID_Offline + "','" + - GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat2ID_Offline + "','" + - GlobalVars.WebServer_HatDir + GlobalVars.Custom_Hat3ID_Offline + "'," + - GlobalVars.WebServer_TShirtDir + GlobalVars.Custom_T_Shirt_Offline + "','" + - GlobalVars.WebServer_ShirtDir + GlobalVars.Custom_Shirt_Offline + "','" + - GlobalVars.WebServer_PantsDir + GlobalVars.Custom_Pants_Offline + "','" + - GlobalVars.WebServer_FaceDir + GlobalVars.Custom_Face_Offline + "','" + - GlobalVars.WebServer_HeadDir + GlobalVars.Custom_Head_Offline + "','" + - GlobalVars.Custom_Icon_Offline + "','" + - extra + "'"; + GlobalVars.sololoadtext = GlobalVars.loadtext.Replace(GlobalVars.WebServerURI,GlobalVars.LocalWebServerURI); + } + else + { + GlobalVars.loadtext = "'" + GlobalVars.Custom_Hat1ID_Offline + "','" + + GlobalVars.Custom_Hat2ID_Offline + "','" + + GlobalVars.Custom_Hat3ID_Offline + "'," + + GlobalVars.HeadColorID + "," + + GlobalVars.TorsoColorID + "," + + GlobalVars.LeftArmColorID + "," + + GlobalVars.RightArmColorID + "," + + GlobalVars.LeftLegColorID + "," + + GlobalVars.RightLegColorID + ",'" + + GlobalVars.Custom_T_Shirt_Offline + "','" + + GlobalVars.Custom_Shirt_Offline + "','" + + GlobalVars.Custom_Pants_Offline + "','" + + GlobalVars.Custom_Face_Offline + "','" + + GlobalVars.Custom_Head_Offline + "','" + + GlobalVars.Custom_Icon_Offline + "','" + + GlobalVars.Custom_Extra + "', false"; - GlobalVars.sololoadtext = GlobalVars.loadtext.Replace(GlobalVars.WebServerURI,GlobalVars.LocalWebServerURI); - */ - - GlobalVars.loadtext = GlobalVars.Custom_Hat1ID_Offline + "','" + - GlobalVars.Custom_Hat2ID_Offline + "','" + - GlobalVars.Custom_Hat3ID_Offline + "'," + - GlobalVars.HeadColorID + "," + - GlobalVars.TorsoColorID + "," + - GlobalVars.LeftArmColorID + "," + - GlobalVars.RightArmColorID + "," + - GlobalVars.LeftLegColorID + "," + - GlobalVars.RightLegColorID + ",'" + - GlobalVars.Custom_T_Shirt_Offline + "','" + - GlobalVars.Custom_Shirt_Offline + "','" + - GlobalVars.Custom_Pants_Offline + "','" + - GlobalVars.Custom_Face_Offline + "','" + - GlobalVars.Custom_Head_Offline + "','" + - GlobalVars.Custom_Icon_Offline + "','" + - GlobalVars.Custom_Extra + "'"; + GlobalVars.sololoadtext = GlobalVars.loadtext; + } } public static void ReadClientValues(string clientpath) @@ -987,23 +991,23 @@ namespace NovetusLauncher { if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == true) { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player','" + GlobalVars.loadtext + "," + md5s + ")"; + return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == false) { - return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == false) { - return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player','" + GlobalVars.loadtext + "," + md5s + ")"; + return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ")"; } else { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } } else if (type == ScriptType.Server) @@ -1014,23 +1018,23 @@ namespace NovetusLauncher { if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) { - return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == true) { - return "_G.CSSolo(" + GlobalVars.UserID + ",'Player','" + GlobalVars.loadtext + ")"; + return "_G.CSSolo(" + GlobalVars.UserID + ",'Player'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == false) { - return "_G.CSSolo(0,'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "_G.CSSolo(0,'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == false ) { - return "_G.CSSolo(0,'Player','" + GlobalVars.loadtext + ")"; + return "_G.CSSolo(0,'Player'," + GlobalVars.sololoadtext + ")"; } else { - return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } } else if (type == ScriptType.Studio) @@ -1261,23 +1265,23 @@ namespace NovetusLauncher { if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) { - return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == true) { - return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player','" + GlobalVars.loadtext + "," + md5s + ")"; + return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == false) { - return "dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == false) { - return "dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player','" + GlobalVars.loadtext + "," + md5s + ")"; + return "dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ")"; } else { - return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + "," + md5s + ")"; + return "dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ")"; } } else if (type == ScriptGenerator.ScriptType.Server) @@ -1288,23 +1292,23 @@ namespace NovetusLauncher { if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == true) { - return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == true) { - return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'Player','" + GlobalVars.loadtext + ")"; + return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'Player'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == true && GlobalVars.UsesID == false) { - return "dofile('" + luafile + "'); _G.CSSolo(0,'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "dofile('" + luafile + "'); _G.CSSolo(0,'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } else if (GlobalVars.UsesPlayerName == false && GlobalVars.UsesID == false ) { - return "dofile('" + luafile + "'); _G.CSSolo(0,'Player','" + GlobalVars.loadtext + ")"; + return "dofile('" + luafile + "'); _G.CSSolo(0,'Player'," + GlobalVars.sololoadtext + ")"; } else { - return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "','" + GlobalVars.loadtext + ")"; + return "dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; } } else if (type == ScriptGenerator.ScriptType.Studio) @@ -1738,6 +1742,7 @@ namespace NovetusLauncher //made by aksakalli public class SimpleHTTPServer { + private readonly string[] _indexFiles = { "index.html", "index.htm", @@ -1856,6 +1861,7 @@ namespace NovetusLauncher { _serverThread.Abort(); _listener.Stop(); + GlobalVars.IsWebServerOn = false; } private void Listen() @@ -1985,6 +1991,7 @@ namespace NovetusLauncher this._port = port; _serverThread = new Thread(this.Listen); _serverThread.Start(); + GlobalVars.IsWebServerOn = true; } } @@ -2084,6 +2091,7 @@ namespace NovetusLauncher public static string ScriptName = "CSMPFunctions"; public static string ScriptGenName = "CSMPBoot"; public static SimpleHTTPServer WebServer = null; + public static bool IsWebServerOn = false; //vars for loader public static bool ReadyToLaunch = false; //server settings. diff --git a/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs b/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs index 5f5c88a..156a8fc 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm.Designer.cs @@ -52,6 +52,7 @@ namespace NovetusLauncher this.label3 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.label17 = new System.Windows.Forms.Label(); this.checkBox4 = new System.Windows.Forms.CheckBox(); this.button6 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); @@ -308,6 +309,7 @@ namespace NovetusLauncher // // tabPage2 // + this.tabPage2.Controls.Add(this.label17); this.tabPage2.Controls.Add(this.checkBox4); this.tabPage2.Controls.Add(this.button6); this.tabPage2.Controls.Add(this.textBox3); @@ -331,6 +333,18 @@ namespace NovetusLauncher this.tabPage2.ToolTipText = "Start a server for other players to play"; this.tabPage2.UseVisualStyleBackColor = true; // + // label17 + // + this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label17.ForeColor = System.Drawing.Color.Red; + this.label17.Location = new System.Drawing.Point(10, 124); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(382, 36); + this.label17.TabIndex = 58; + this.label17.Text = "NOTE: If you changed the server port, go to the CONSOLE and type \"webserver resta" + + "rt\" or \"restart\" to restart the web server or restart the launcher."; + this.label17.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // // checkBox4 // this.checkBox4.Location = new System.Drawing.Point(152, 198); @@ -365,7 +379,7 @@ namespace NovetusLauncher this.treeView1.HideSelection = false; this.treeView1.Location = new System.Drawing.Point(10, 30); this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(382, 127); + this.treeView1.Size = new System.Drawing.Size(382, 91); this.treeView1.TabIndex = 54; this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeView1AfterSelect); // @@ -465,9 +479,9 @@ namespace NovetusLauncher // // button20 // - this.button20.Location = new System.Drawing.Point(292, 161); + this.button20.Location = new System.Drawing.Point(292, 163); this.button20.Name = "button20"; - this.button20.Size = new System.Drawing.Size(100, 48); + this.button20.Size = new System.Drawing.Size(100, 46); this.button20.TabIndex = 21; this.button20.Text = "SERVER INFORMATION"; this.button20.UseVisualStyleBackColor = true; @@ -1066,6 +1080,7 @@ namespace NovetusLauncher this.ResumeLayout(false); this.PerformLayout(); } + private System.Windows.Forms.Label label17; private System.Windows.Forms.Button button24; private System.Windows.Forms.CheckBox checkBox4; private System.Windows.Forms.Button button6; diff --git a/NovetusLauncher/NovetusLauncher/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm.cs index d76adce..35bfb30 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm.cs @@ -173,33 +173,74 @@ namespace NovetusLauncher void StartWebServer() { - GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.DataPath, GlobalVars.WebServer_Port); - ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); + if (SecurityFuncs.IsElevated) + { + try + { + GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.DataPath, GlobalVars.WebServer_Port); + ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); + } + catch (Exception ex) + { + ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); + } + } + else + { + ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (Did not run as Administrator)", 2); + } + } + + void StopWebServer() + { + if (SecurityFuncs.IsElevated) + { + try + { + ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); + GlobalVars.WebServer.Stop(); + } + catch (Exception ex) + { + ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); + } + } + else + { + ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (Did not run as Administrator)", 2); + } } void StartMusic() { - string file = GlobalVars.DataPath + "\\music\\music.mp3"; + try + { + string file = GlobalVars.DataPath + "\\music\\music.mp3"; - if (File.Exists(file)) - { - if (outputDevice == null) - { - outputDevice = new WaveOutEvent(); - } - if (audioFile == null) - { - audioFile = new AudioFileReader(file); - LoopStream loop = new LoopStream(audioFile); - outputDevice.Init(loop); - } - outputDevice.Play(); - } - else - { - button24.Visible = false; - button24.Enabled = false; - } + if (File.Exists(file)) + { + if (outputDevice == null) + { + outputDevice = new WaveOutEvent(); + } + if (audioFile == null) + { + audioFile = new AudioFileReader(file); + LoopStream loop = new LoopStream(audioFile); + outputDevice.Init(loop); + } + outputDevice.Play(); + } + else + { + button24.Visible = false; + button24.Enabled = false; + } + } + catch (Exception ex) + { + ConsolePrint("NAudio: Failed to play music. (" + ex.Message + ")", 2); + } } void EndMusic() @@ -356,7 +397,10 @@ namespace NovetusLauncher { WriteConfigValues(); DiscordRpc.Shutdown(); - GlobalVars.WebServer.Stop(); + if (GlobalVars.IsWebServerOn == true) + { + StopWebServer(); + } } void ReadConfigValues() @@ -1163,6 +1207,80 @@ namespace NovetusLauncher cc.Show(); ConsolePrint("Avatar Customization Loaded.", 4); } + else if (string.Compare(command,"webserver",true) == 0) + { + ConsoleHelp(3); + } + else if (string.Compare(command,"webserver start",true) == 0) + { + if (GlobalVars.IsWebServerOn == false) + { + StartWebServer(); + } + else + { + ConsolePrint("WebServer: There is already a web server open.", 2); + } + } + else if (string.Compare(command,"webserver stop",true) == 0) + { + if (GlobalVars.IsWebServerOn == true) + { + StopWebServer(); + } + else + { + ConsolePrint("WebServer: There is no web server open.", 2); + } + } + else if (string.Compare(command,"webserver restart",true) == 0) + { + try + { + ConsolePrint("WebServer: Restarting...", 4); + StopWebServer(); + StartWebServer(); + } + catch(Exception ex) + { + ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); + } + } + else if (string.Compare(command,"start",true) == 0) + { + if (GlobalVars.IsWebServerOn == false) + { + StartWebServer(); + } + else + { + ConsolePrint("WebServer: There is already a web server open.", 2); + } + } + else if (string.Compare(command,"stop",true) == 0) + { + if (GlobalVars.IsWebServerOn == true) + { + StopWebServer(); + } + else + { + ConsolePrint("WebServer: There is no web server open.", 2); + } + } + else if (string.Compare(command,"restart",true) == 0) + { + try + { + ConsolePrint("WebServer: Restarting...", 4); + StopWebServer(); + StartWebServer(); + } + catch(Exception ex) + { + ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); + } + } else if (string.Compare(command,GlobalVars.important,true) == 0) { GlobalVars.AdminMode = true; @@ -1206,6 +1324,14 @@ namespace NovetusLauncher ConsolePrint("= clientinfo | Launches the Novetus Client SDK", 4); ConsolePrint("= itemmaker | Launches the Novetus Item SDK", 4); } + else if (page == 3) + { + ConsolePrint("Help: webserver", 3); + ConsolePrint("-------------------------", 1); + ConsolePrint("= restart | Restarts the web server", 4); + ConsolePrint("= stop | Stops a web server if there is one on.", 4); + ConsolePrint("= start | Starts a web server if there isn't one on yet.", 4); + } else { ConsolePrint("Help: all", 3); @@ -1225,6 +1351,11 @@ namespace NovetusLauncher ConsolePrint("-- load | Reloads the config file", 4); ConsolePrint("-- reset | Resets the config file", 4); ConsolePrint("---------", 1); + ConsolePrint("= webserver", 3); + ConsolePrint("-- restart | Restarts the web server", 4); + ConsolePrint("-- stop | Stops a web server if there is one on.", 4); + ConsolePrint("-- start | Starts a web server if there isn't one on yet.", 4); + ConsolePrint("---------", 1); } } @@ -1257,12 +1388,15 @@ namespace NovetusLauncher GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown1.Value); numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.WebServer_Port = (GlobalVars.RobloxPort+1); } void NumericUpDown2ValueChanged(object sender, EventArgs e) { GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown2.Value); numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); + label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.WebServer_Port = (GlobalVars.RobloxPort+1); } void NumericUpDown3ValueChanged(object sender, EventArgs e)