ported over to compact. sesperated ports

This commit is contained in:
Bitl 2021-03-23 12:13:06 -07:00
parent c0de6d5547
commit cbe44f75fe
14 changed files with 368 additions and 1328 deletions

View File

@ -129,7 +129,8 @@ namespace NovetusCMD
{
GlobalFuncs.ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2);
GlobalVars.WebServer.Stop();
}
GlobalVars.WebServer = null;
}
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2);
@ -230,14 +231,6 @@ namespace NovetusCMD
static void ProgramClose(object sender, EventArgs e)
{
if (!LocalVars.OverrideINI)
{
WriteConfigValues();
}
if (GlobalVars.IsWebServerOn)
{
StopWebServer();
}
if (GlobalVars.ProcessID != 0)
{
if (LocalFuncs.ProcessExists(GlobalVars.ProcessID))
@ -246,6 +239,16 @@ namespace NovetusCMD
proc.Kill();
}
}
if (!LocalVars.OverrideINI)
{
WriteConfigValues();
}
if (GlobalVars.IsWebServerOn)
{
StopWebServer();
}
Application.Exit();
}
static void LoadCMDArgs(string[] args)

View File

@ -134,27 +134,28 @@ public class SimpleHTTPServer
/// </summary>
public void Stop()
{
_serverThread.Abort();
_listener.Prefixes.Clear();
_listener.Stop();
GlobalVars.IsWebServerOn = false;
_serverThread.Abort();
}
private void Listen()
{
_listener = new HttpListener();
_listener.Prefixes.Add("http://*:" + _port.ToString() + "/");
_listener.Start();
while (true)
try
{
try
_listener = new HttpListener();
_listener.Prefixes.Add("http://*:" + _port.ToString() + "/");
_listener.Start();
while (true)
{
HttpListenerContext context = _listener.GetContext();
Process(context);
}
catch (Exception)
{
}
}
catch (Exception)
{
Stop();
}
}

View File

@ -33,8 +33,8 @@ public static class GlobalVars
#region Joining
public static string IP = "localhost";
public static int JoinPort = 53640;
public static int DefaultRobloxPort = 53640;
public static int JoinPort = DefaultRobloxPort;
#endregion
#region NovetusCMD

View File

@ -60,7 +60,7 @@ public class ScriptFuncs
return "_G.CSConnect("
+ (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ GlobalVars.JoinPort + ",'"
+ (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.Loadout + ","
+ md5s + ",'"
@ -186,7 +186,7 @@ public class ScriptFuncs
return "dofile('" + luafile + "'); _G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'"
+ GlobalVars.JoinPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.Loadout + ","
+ md5s + ",'"
@ -321,6 +321,7 @@ public class ScriptFuncs
.Replace("%charapp%", GlobalVars.UserCustomization.CharacterID)
.Replace("%ip%", GlobalVars.IP)
.Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString())
.Replace("%joinport%", GlobalVars.JoinPort.ToString())
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName)
.Replace("%icone%", ConvertIconStringToInt().ToString())
.Replace("%icon%", GlobalVars.UserCustomization.Icon)

View File

@ -207,7 +207,7 @@ public class SecurityFuncs
+ GlobalVars.ProgramInformation.Version + " - "
+ clientname + " "
+ ScriptFuncs.Generator.GetNameForType(type)
+ " [" + GlobalVars.IP + ":" + GlobalVars.UserConfiguration.RobloxPort + "]"
+ " [" + GlobalVars.IP + ":" + GlobalVars.JoinPort + "]"
+ RandomStringTitle());
break;
case ScriptType.Server:

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NovetusLauncher
{
class CharacterCustomizationShared
{
public CharacterCustomizationShared()
{
//Stub
}
}
}

View File

@ -63,7 +63,6 @@ namespace NovetusLauncher
this.label19 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.button23 = new System.Windows.Forms.Button();
this.button22 = new System.Windows.Forms.Button();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
@ -366,7 +365,6 @@ namespace NovetusLauncher
this.tabPage2.Controls.Add(this.label19);
this.tabPage2.Controls.Add(this.textBox3);
this.tabPage2.Controls.Add(this.checkBox4);
this.tabPage2.Controls.Add(this.button23);
this.tabPage2.Controls.Add(this.button22);
this.tabPage2.Controls.Add(this.numericUpDown3);
this.tabPage2.Controls.Add(this.numericUpDown2);
@ -441,24 +439,13 @@ namespace NovetusLauncher
this.checkBox4.CheckedChanged += new System.EventHandler(this.CheckBox4CheckedChanged);
this.checkBox4.Click += new System.EventHandler(this.CheckBox4Click);
//
// button23
//
this.button23.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button23.Location = new System.Drawing.Point(23, 184);
this.button23.Name = "button23";
this.button23.Size = new System.Drawing.Size(66, 25);
this.button23.TabIndex = 51;
this.button23.Text = "SAVE";
this.button23.UseVisualStyleBackColor = true;
this.button23.Click += new System.EventHandler(this.Button23Click);
//
// button22
//
this.button22.Location = new System.Drawing.Point(97, 184);
this.button22.Location = new System.Drawing.Point(23, 184);
this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(63, 25);
this.button22.Size = new System.Drawing.Size(137, 25);
this.button22.TabIndex = 50;
this.button22.Text = "RESET";
this.button22.Text = "RESET PORT";
this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.Button22Click);
//
@ -1428,6 +1415,55 @@ namespace NovetusLauncher
this.PerformLayout();
}
private void InitCompactForm()
{
//*vomits*
launcherForm = new LauncherFormShared();
launcherForm.Parent = this;
launcherForm.FormStyle = Settings.UIOptions.Style.Compact;
launcherForm.ConsoleBox = richTextBox1;
launcherForm.Tabs = tabControl1;
launcherForm.MapDescBox = textBox4;
launcherForm.ServerInfo = textBox3;
launcherForm.Tree = treeView1;
launcherForm._TreeCache = _fieldsTreeCache;
launcherForm.TabPageHost = "tabPage2";
launcherForm.TabPageMaps = "tabPage4";
launcherForm.TabPageClients = "tabPage3";
launcherForm.TabPageSaved = "tabPage6";
launcherForm.ServerBox = listBox3;
launcherForm.PortBox = listBox4;
launcherForm.ClientBox = listBox2;
launcherForm.SplashLabel = label12;
launcherForm.SearchBar = SearchBar;
launcherForm.StyleSelectorBox = comboBox3;
launcherForm.ChangelogBox = richTextBox2;
launcherForm.ReadmeBox = richTextBox3;
launcherForm.ProductVersionLabel = label8;
launcherForm.NovetusVersionLabel = label11;
launcherForm.WebServerCheckbox = checkBox8;
launcherForm.CloseOnLaunchCheckbox = checkBox1;
launcherForm.DiscordPresenceCheckbox = checkBox2;
launcherForm.uPnPCheckBox = checkBox4;
launcherForm.ShowServerNotifsCheckBox = checkBox9;
launcherForm.PlayerIDTextBox = textBox5;
launcherForm.PlayerTripcodeLabel = label18;
launcherForm.RegeneratePlayerIDButton = button4;
launcherForm.PlayerNameTextBox = textBox2;
launcherForm.LocalPlayCheckBox = checkBox3;
launcherForm.IPLabel = label37;
launcherForm.PortLabel = label38;
launcherForm.SelectedClientLabel = label26;
launcherForm.SelectedMapLabel = label28;
launcherForm.PlayerLimitBox = numericUpDown3;
launcherForm.HostPortBox = numericUpDown2;
launcherForm.JoinPortBox = numericUpDown1;
launcherForm.ClientWarningLabel = label30;
launcherForm.ClientDescriptionBox = textBox6;
launcherForm.IPBox = textBox1;
}
private System.Windows.Forms.CheckBox checkBox4;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.TreeView treeView1;
@ -1437,7 +1473,6 @@ namespace NovetusLauncher
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Button button23;
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.PictureBox pictureBox2;
@ -1545,5 +1580,6 @@ namespace NovetusLauncher
private System.Windows.Forms.Button button36;
private System.Windows.Forms.CheckBox checkBox9;
//private System.Windows.Forms.CheckBox checkBox8;
private LauncherFormShared launcherForm;
}
}

View File

@ -86,11 +86,11 @@ namespace NovetusLauncher
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.checkBox9 = new System.Windows.Forms.CheckBox();
this.checkBox8 = new System.Windows.Forms.CheckBox();
this.label19 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.button23 = new System.Windows.Forms.Button();
this.button22 = new System.Windows.Forms.Button();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
@ -156,7 +156,6 @@ namespace NovetusLauncher
this.panel4 = new System.Windows.Forms.Panel();
this.button35 = new System.Windows.Forms.Button();
this.UAButton = new System.Windows.Forms.Button();
this.checkBox9 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
@ -656,7 +655,6 @@ namespace NovetusLauncher
this.tabPage2.Controls.Add(this.label19);
this.tabPage2.Controls.Add(this.textBox3);
this.tabPage2.Controls.Add(this.checkBox4);
this.tabPage2.Controls.Add(this.button23);
this.tabPage2.Controls.Add(this.button22);
this.tabPage2.Controls.Add(this.numericUpDown3);
this.tabPage2.Controls.Add(this.numericUpDown2);
@ -673,6 +671,17 @@ namespace NovetusLauncher
this.tabPage2.ToolTipText = "Start a server for other players to play";
this.tabPage2.UseVisualStyleBackColor = true;
//
// checkBox9
//
this.checkBox9.AutoSize = true;
this.checkBox9.Location = new System.Drawing.Point(468, 180);
this.checkBox9.Name = "checkBox9";
this.checkBox9.Size = new System.Drawing.Size(84, 17);
this.checkBox9.TabIndex = 62;
this.checkBox9.Text = "Notifications";
this.checkBox9.UseVisualStyleBackColor = true;
this.checkBox9.CheckedChanged += new System.EventHandler(this.checkBox9_CheckedChanged);
//
// checkBox8
//
this.checkBox8.AutoSize = true;
@ -716,24 +725,13 @@ namespace NovetusLauncher
this.checkBox4.CheckedChanged += new System.EventHandler(this.CheckBox4CheckedChanged);
this.checkBox4.Click += new System.EventHandler(this.CheckBox4Click);
//
// button23
//
this.button23.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button23.Location = new System.Drawing.Point(176, 177);
this.button23.Name = "button23";
this.button23.Size = new System.Drawing.Size(66, 25);
this.button23.TabIndex = 51;
this.button23.Text = "SAVE";
this.button23.UseVisualStyleBackColor = true;
this.button23.Click += new System.EventHandler(this.Button23Click);
//
// button22
//
this.button22.Location = new System.Drawing.Point(248, 177);
this.button22.Location = new System.Drawing.Point(179, 178);
this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(63, 25);
this.button22.Size = new System.Drawing.Size(131, 24);
this.button22.TabIndex = 50;
this.button22.Text = "RESET";
this.button22.Text = "RESET PORT";
this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.Button22Click);
//
@ -1465,17 +1463,6 @@ namespace NovetusLauncher
this.UAButton.Size = new System.Drawing.Size(75, 23);
this.UAButton.TabIndex = 0;
//
// checkBox9
//
this.checkBox9.AutoSize = true;
this.checkBox9.Location = new System.Drawing.Point(468, 180);
this.checkBox9.Name = "checkBox9";
this.checkBox9.Size = new System.Drawing.Size(84, 17);
this.checkBox9.TabIndex = 62;
this.checkBox9.Text = "Notifications";
this.checkBox9.UseVisualStyleBackColor = true;
this.checkBox9.CheckedChanged += new System.EventHandler(this.checkBox9_CheckedChanged);
//
// LauncherFormExtended
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1577,6 +1564,7 @@ namespace NovetusLauncher
launcherForm.JoinPortBox = numericUpDown1;
launcherForm.ClientWarningLabel = label30;
launcherForm.ClientDescriptionBox = textBox6;
launcherForm.IPBox = textBox1;
}
private System.Windows.Forms.CheckBox checkBox4;
@ -1588,7 +1576,6 @@ namespace NovetusLauncher
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Button button23;
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.PictureBox pictureBox2;

View File

@ -105,29 +105,7 @@ namespace NovetusLauncher
void ListBox2SelectedIndexChanged(object sender, EventArgs e)
{
string ourselectedclient = GlobalVars.UserConfiguration.SelectedClient;
GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString();
if (!ourselectedclient.Equals(GlobalVars.UserConfiguration.SelectedClient))
{
launcherForm.ReadClientValues(true);
}
else
{
launcherForm.ReadClientValues();
}
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
//iterate through
if (frm.Name == "CustomGraphicsOptions")
{
frm.Close();
break;
}
}
launcherForm.ChangeClient();
}
void CheckBox3CheckedChanged(object sender, EventArgs e)
@ -137,22 +115,7 @@ namespace NovetusLauncher
void TextBox5TextChanged(object sender, EventArgs e)
{
int parsedValue;
if (int.TryParse(textBox5.Text, out parsedValue))
{
if (textBox5.Text.Equals(""))
{
GlobalVars.UserConfiguration.UserID = 0;
}
else
{
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(textBox5.Text);
}
}
else
{
GlobalVars.UserConfiguration.UserID = 0;
}
launcherForm.ChangeUserID();
}
void Button8Click(object sender, EventArgs e)
@ -163,88 +126,57 @@ namespace NovetusLauncher
void Button9Click(object sender, EventArgs e)
{
launcherForm.ResetConfigValues();
MessageBox.Show("Config Reset!");
launcherForm.ResetConfigValues(true);
}
void ListBox3SelectedIndexChanged(object sender, EventArgs e)
{
GlobalVars.IP = listBox3.SelectedItem.ToString();
textBox1.Text = GlobalVars.IP;
checkBox3.Enabled = false;
GlobalVars.LocalPlayMode = false;
label37.Text = GlobalVars.IP;
launcherForm.SelectIPListing();
}
void ListBox4SelectedIndexChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(listBox4.SelectedItem.ToString());
numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
launcherForm.SelectPortListing();
}
void Button10Click(object sender, EventArgs e)
{
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP);
}
void Button11Click(object sender, EventArgs e)
{
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort);
}
void Button12Click(object sender, EventArgs e)
{
if (listBox3.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox3.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp");
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
}
launcherForm.RemoveIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp");
}
void Button13Click(object sender, EventArgs e)
{
if (listBox4.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { listBox4.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp");
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
}
launcherForm.RemoveIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp");
}
void Button14Click(object sender, EventArgs e)
{
File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose();
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
launcherForm.ResetIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt");
}
void Button15Click(object sender, EventArgs e)
{
File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose();
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
launcherForm.ResetIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt");
}
void Button16Click(object sender, EventArgs e)
{
File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine);
listBox3.Items.Clear();
string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt");
listBox3.Items.AddRange(lines_server);
launcherForm.AddIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP);
}
void Button17Click(object sender, EventArgs e)
{
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
listBox4.Items.Clear();
string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt");
listBox4.Items.AddRange(lines_ports);
launcherForm.AddIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort);
}
void richTextBox1_KeyDown(object sender, KeyEventArgs e)
@ -259,16 +191,12 @@ namespace NovetusLauncher
void NumericUpDown1ValueChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown1.Value);
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString();
launcherForm.ChangeJoinPort();
}
void NumericUpDown2ValueChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown2.Value);
numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString();
launcherForm.ChangeServerPort();
}
void NumericUpDown3ValueChanged(object sender, EventArgs e)
@ -278,21 +206,12 @@ namespace NovetusLauncher
void Button7Click(object sender, EventArgs e)
{
numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
GlobalVars.UserConfiguration.RobloxPort = GlobalVars.DefaultRobloxPort;
}
void Button23Click(object sender, EventArgs e)
{
File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine);
launcherForm.ResetCurPort(numericUpDown1, GlobalVars.JoinPort);
}
void Button22Click(object sender, EventArgs e)
{
numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
GlobalVars.UserConfiguration.RobloxPort = GlobalVars.DefaultRobloxPort;
launcherForm.ResetCurPort(numericUpDown2, GlobalVars.UserConfiguration.RobloxPort);
}
void TreeView1AfterSelect(object sender, TreeViewEventArgs e)
@ -312,7 +231,8 @@ namespace NovetusLauncher
void CheckBox4Click(object sender, EventArgs e)
{
launcherForm.RestartLauncherAfterSetting(checkBox4);
launcherForm.RestartLauncherAfterSetting(checkBox4, "Novetus - UPnP", "Make sure to check if your router has UPnP functionality enabled.\n" +
"Please note that some routers may not support UPnP, and some ISPs will block the UPnP protocol.\nThis may not work for all users.");
}
void Button24Click(object sender, EventArgs e)
@ -337,18 +257,7 @@ namespace NovetusLauncher
void CheckBox2Click(object sender, EventArgs e)
{
switch (checkBox2.Checked)
{
case false:
MessageBox.Show("Novetus will now restart.", "Novetus - Discord Rich Presence", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
default:
MessageBox.Show("Novetus will now restart." + Environment.NewLine + "Make sure the Discord app is open so this change can take effect.", "Novetus - Discord Rich Presence", MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
}
launcherForm.WriteConfigValues();
Application.Restart();
launcherForm.RestartLauncherAfterSetting(checkBox2, "Novetus - Discord Rich Presence", "Make sure the Discord app is open so this change can take effect.");
}
private void button27_Click(object sender, EventArgs e)
@ -391,16 +300,6 @@ namespace NovetusLauncher
tabControl1.SelectedTab = tabPage5;
}
private void button34_Click(object sender, EventArgs e)
{
launcherForm.LoadLauncher();
}
private void label8_Click(object sender, EventArgs e)
{
launcherForm.EasterEggLogic();
}
private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.ReShade = checkBox5.Checked;
@ -417,7 +316,7 @@ namespace NovetusLauncher
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
{
switch (comboBox1.SelectedIndex)
{
case 1:
@ -481,16 +380,6 @@ namespace NovetusLauncher
}
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
launcherForm.SwitchStyles();
}
private void SearchButton_Click(object sender, EventArgs e)
{
launcherForm.SearchMaps();
}
private void button36_Click(object sender, EventArgs e)
{
if (GlobalVars.UserConfiguration.QualityLevel == Settings.GraphicsOptions.Level.Custom)
@ -504,6 +393,26 @@ namespace NovetusLauncher
}
}
private void button34_Click(object sender, EventArgs e)
{
launcherForm.LoadLauncher();
}
private void label8_Click(object sender, EventArgs e)
{
launcherForm.EasterEggLogic();
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
launcherForm.SwitchStyles();
}
private void SearchButton_Click(object sender, EventArgs e)
{
launcherForm.SearchMaps();
}
private void checkBox8_CheckedChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.WebServer = checkBox8.Checked;
@ -511,7 +420,8 @@ namespace NovetusLauncher
void CheckBox8Click(object sender, EventArgs e)
{
launcherForm.RestartLauncherAfterSetting(checkBox8, true);
launcherForm.RestartLauncherAfterSetting(checkBox8, "Novetus - Web Server", "Make sure you are running the launcher in Administrator Mode" +
"in order for the Web Server to function.");
}
private void button37_Click(object sender, EventArgs e)

View File

@ -29,7 +29,7 @@ namespace NovetusLauncher
public Settings.UIOptions.Style FormStyle = Settings.UIOptions.Style.None;
public RichTextBox ConsoleBox, ChangelogBox, ReadmeBox = null;
public TabControl Tabs = null;
public TextBox MapDescBox, ServerInfo, SearchBar, PlayerIDTextBox, PlayerNameTextBox, ClientDescriptionBox = null;
public TextBox MapDescBox, ServerInfo, SearchBar, PlayerIDTextBox, PlayerNameTextBox, ClientDescriptionBox, IPBox = null;
public TreeView Tree, _TreeCache = null;
public ListBox ServerBox, PortBox, ClientBox = null;
public Label SplashLabel, ProductVersionLabel, NovetusVersionLabel, PlayerTripcodeLabel, IPLabel, PortLabel,
@ -214,6 +214,7 @@ namespace NovetusLauncher
{
GlobalFuncs.ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2, ConsoleBox);
GlobalVars.WebServer.Stop();
GlobalVars.WebServer = null;
}
catch (Exception ex)
{
@ -305,6 +306,7 @@ namespace NovetusLauncher
{
StopWebServer();
}
Application.Exit();
}
public async Task ChangeTabs()
@ -766,14 +768,22 @@ namespace NovetusLauncher
SelectedMapLabel.Text = GlobalVars.UserConfiguration.Map;
Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
Tree.Focus();
JoinPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
JoinPortBox.Value = Convert.ToDecimal(GlobalVars.JoinPort);
HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
IPLabel.Text = GlobalVars.IP;
PortLabel.Text = GlobalVars.UserConfiguration.RobloxPort.ToString();
PortLabel.Text = GlobalVars.JoinPort.ToString();
DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence;
ReShadeCheckbox.Checked = GlobalVars.UserConfiguration.ReShade;
ReShadeFPSDisplayCheckBox.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay;
ReShadePerformanceModeCheckBox.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode;
if (FormStyle == Settings.UIOptions.Style.Extended)
{
if (ReShadeCheckbox != null)
ReShadeCheckbox.Checked = GlobalVars.UserConfiguration.ReShade;
if (ReShadeFPSDisplayCheckBox != null)
ReShadeFPSDisplayCheckBox.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay;
if (ReShadePerformanceModeCheckBox != null)
ReShadePerformanceModeCheckBox.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode;
}
uPnPCheckBox.Checked = GlobalVars.UserConfiguration.UPnP;
ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications;
@ -866,7 +876,7 @@ namespace NovetusLauncher
GlobalFuncs.ConsolePrint("Config Saved.", 3, ConsoleBox);
}
public void ResetConfigValues()
public void ResetConfigValues(bool ShowBox = false)
{
//https://stackoverflow.com/questions/9029351/close-all-open-forms-except-the-main-menu-in-c-sharp
List<Form> openForms = new List<Form>();
@ -883,6 +893,10 @@ namespace NovetusLauncher
GlobalFuncs.ResetConfigValues();
WriteConfigValues();
ReadConfigValues();
if (ShowBox)
{
MessageBox.Show("Config Reset!");
}
}
public void ReadClientValues(bool initial = false)
@ -1003,13 +1017,8 @@ namespace NovetusLauncher
}
}
public void RestartLauncherAfterSetting(CheckBox box, bool webServer = false)
public void RestartLauncherAfterSetting(CheckBox box, string title, string subText)
{
string title = webServer ? "Novetus - Web Server" : "Novetus - UPnP";
string subText = webServer ? "Make sure you are running the launcher in Administrator Mode in order for the Web Server to function." :
"Make sure to check if your router has UPnP functionality enabled.\n" +
"Please note that some routers may not support UPnP, and some ISPs will block the UPnP protocol.\nThis may not work for all users.";
switch (box.Checked)
{
case false:
@ -1081,6 +1090,128 @@ namespace NovetusLauncher
MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void AddIPPortListing(ListBox box, string file, object val)
{
File.AppendAllText(file, val + Environment.NewLine);
if (box != null)
{
box.Items.Clear();
string[] lines = File.ReadAllLines(file);
box.Items.AddRange(lines);
}
}
public void ResetIPPortListing(ListBox box, string file)
{
File.Create(file).Dispose();
if (box != null)
{
box.Items.Clear();
string[] lines = File.ReadAllLines(file);
box.Items.AddRange(lines);
}
}
public void RemoveIPPortListing(ListBox box, string file, string file_tmp)
{
if (box != null)
{
if (box.SelectedIndex >= 0)
{
TextLineRemover.RemoveTextLines(new List<string> { box.SelectedItem.ToString() }, file, file_tmp);
box.Items.Clear();
string[] lines = File.ReadAllLines(file);
box.Items.AddRange(lines);
}
}
else
{
//requires a ListBox.
return;
}
}
public void SelectIPListing()
{
GlobalVars.IP = ServerBox.SelectedItem.ToString();
IPBox.Text = GlobalVars.IP;
LocalPlayCheckBox.Enabled = false;
GlobalVars.LocalPlayMode = false;
IPLabel.Text = GlobalVars.IP;
}
public void SelectPortListing()
{
GlobalVars.JoinPort = Convert.ToInt32(PortBox.SelectedItem.ToString());
JoinPortBox.Value = Convert.ToDecimal(GlobalVars.JoinPort);
}
public void ResetCurPort(NumericUpDown box, int value)
{
box.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort);
value = GlobalVars.DefaultRobloxPort;
}
public void ChangeJoinPort()
{
GlobalVars.JoinPort = Convert.ToInt32(JoinPortBox.Value);
PortLabel.Text = GlobalVars.JoinPort.ToString();
}
public void ChangeServerPort()
{
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(HostPortBox.Value);
}
public void ChangeClient()
{
string ourselectedclient = GlobalVars.UserConfiguration.SelectedClient;
GlobalVars.UserConfiguration.SelectedClient = ClientBox.SelectedItem.ToString();
if (!ourselectedclient.Equals(GlobalVars.UserConfiguration.SelectedClient))
{
ReadClientValues(true);
}
else
{
ReadClientValues();
}
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
FormCollection fc = Application.OpenForms;
foreach (Form frm in fc)
{
//iterate through
if (frm.Name == "CustomGraphicsOptions")
{
frm.Close();
break;
}
}
}
public void ChangeUserID()
{
int parsedValue;
if (int.TryParse(PlayerIDTextBox.Text, out parsedValue))
{
if (PlayerIDTextBox.Text.Equals(""))
{
GlobalVars.UserConfiguration.UserID = 0;
}
else
{
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(PlayerIDTextBox.Text);
}
}
else
{
GlobalVars.UserConfiguration.UserID = 0;
}
}
#endregion
#region Helper Functions

View File

@ -76,6 +76,7 @@ partial class ClientinfoEditor
this.doublequoteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.serverToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.limitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.notificationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.securityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.md5launcherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.md5scriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -151,7 +152,7 @@ partial class ClientinfoEditor
this.label9 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.notificationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.joinportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -402,7 +403,8 @@ partial class ClientinfoEditor
this.addonscriptpathToolStripMenuItem,
this.scripttypeToolStripMenuItem,
this.versionToolStripMenuItem,
this.doublequoteToolStripMenuItem});
this.doublequoteToolStripMenuItem,
this.joinportToolStripMenuItem});
this.generalToolStripMenuItem.Name = "generalToolStripMenuItem";
this.generalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.generalToolStripMenuItem.Text = "General";
@ -493,6 +495,13 @@ partial class ClientinfoEditor
this.limitToolStripMenuItem.Text = "%limit%";
this.limitToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click);
//
// notificationsToolStripMenuItem
//
this.notificationsToolStripMenuItem.Name = "notificationsToolStripMenuItem";
this.notificationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.notificationsToolStripMenuItem.Text = "%notifications%";
this.notificationsToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click);
//
// securityToolStripMenuItem
//
this.securityToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1119,12 +1128,12 @@ partial class ClientinfoEditor
this.label10.TabIndex = 33;
this.label10.Text = "When applying the settings (if there is a settings XML file):";
//
// notificationsToolStripMenuItem
// joinportToolStripMenuItem
//
this.notificationsToolStripMenuItem.Name = "notificationsToolStripMenuItem";
this.notificationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.notificationsToolStripMenuItem.Text = "%notifications%";
this.notificationsToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click);
this.joinportToolStripMenuItem.Name = "joinportToolStripMenuItem";
this.joinportToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
this.joinportToolStripMenuItem.Text = "%joinport%";
this.joinportToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click);
//
// ClientinfoEditor
//
@ -1279,4 +1288,5 @@ partial class ClientinfoEditor
private System.Windows.Forms.ToolStripMenuItem doublequoteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem notificationsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem joinportToolStripMenuItem;
}

View File

@ -151,6 +151,7 @@
<Compile Include="Classes\Launcher\AddonLoader.cs" />
<Compile Include="Classes\Launcher\SplashLoader.cs" />
<Compile Include="Classes\LocalVars.cs" />
<Compile Include="Forms\CharCustom\CharacterCustomizationShared.cs" />
<Compile Include="Forms\CustomGraphicsOptions.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -43,7 +43,7 @@ namespace NovetusURI
string client = SecurityFuncs.Base64Decode(SplitArg[2]);
GlobalVars.UserConfiguration.SelectedClient = client;
GlobalVars.IP = ip;
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port);
GlobalVars.JoinPort = Convert.ToInt32(port);
GlobalFuncs.ReadClientValues();
}
}