diff --git a/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs b/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs index 82bad31..1744ce3 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/ClientManagement.cs @@ -1410,8 +1410,8 @@ public class ScriptFuncs case ScriptType.Client: return "_G.CSConnect(" + (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'" - + GlobalVars.IP + "'," - + GlobalVars.JoinPort + ",'" + + GlobalVars.CurrentServer.ServerIP + "'," + + GlobalVars.CurrentServer.ServerPort + ",'" + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + GlobalVars.Loadout + "," + md5s + ",'" @@ -1689,9 +1689,10 @@ public class ScriptFuncs .Replace("%mapfile%", mapfile) .Replace("%luafile%", luafile) .Replace("%charapp%", GlobalVars.UserCustomization.CharacterID) - .Replace("%ip%", GlobalVars.IP) + .Replace("%server%", GlobalVars.CurrentServer.ToString()) + .Replace("%ip%", GlobalVars.CurrentServer.ServerIP) .Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString()) - .Replace("%joinport%", GlobalVars.JoinPort.ToString()) + .Replace("%joinport%", GlobalVars.CurrentServer.ServerPort.ToString()) .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) .Replace("%icone%", ConvertIconStringToInt().ToString()) .Replace("%icon%", GlobalVars.UserCustomization.Icon) diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs index 96da8e9..2624301 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs @@ -8,6 +8,7 @@ */ #region Usings +using System; using System.Collections.Generic; using System.Windows.Forms; #endregion @@ -24,6 +25,25 @@ public enum ScriptType } #endregion +#region Game Server Definition +public class GameServer +{ + public GameServer(string ip, int port) + { + ServerIP = ip; + ServerPort = port; + } + + public override string ToString() + { + return ServerIP + ":" + ServerPort.ToString(); + } + + public string ServerIP { get; set; } + public int ServerPort { get; set; } +} +#endregion + #region Global Variables public static class GlobalVars { @@ -52,10 +72,10 @@ public static class GlobalVars #endregion #region Joining/Hosting - public static string IP = "localhost"; - public static string ExternalIP = SecurityFuncs.GetExternalIPAddress(); + public static string DefaultIP = "localhost"; public static int DefaultRobloxPort = 53640; - public static int JoinPort = DefaultRobloxPort; + public static GameServer CurrentServer = new GameServer(DefaultIP, DefaultRobloxPort); + public static string ExternalIP = SecurityFuncs.GetExternalIPAddress(); public static ScriptType GameOpened = ScriptType.None; public static string PlayerTripcode = ""; #endregion diff --git a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs index 3b7b99c..4ac5072 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs @@ -273,7 +273,7 @@ public class SecurityFuncs + GlobalVars.ProgramInformation.Version + " - " + clientname + " " + ScriptFuncs.Generator.GetNameForType(type) - + " [" + GlobalVars.IP + ":" + GlobalVars.JoinPort + "]" + + " [" + GlobalVars.CurrentServer.ToString() + "]" + RandomStringTitle()); break; case ScriptType.Server: diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs index 95bf7a1..fab3a3b 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs @@ -79,10 +79,10 @@ namespace NovetusLauncher return; } - GlobalVars.IP = textBox1.Text; + GlobalVars.CurrentServer.ServerIP = textBox1.Text; checkBox3.Enabled = false; GlobalVars.LocalPlayMode = false; - label37.Text = GlobalVars.IP; + label37.Text = GlobalVars.CurrentServer.ServerIP; } void CheckBox1CheckedChanged(object sender, EventArgs e) @@ -142,12 +142,12 @@ namespace NovetusLauncher void Button10Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP); + launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.CurrentServer.ServerIP); } void Button11Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort); + launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.CurrentServer.ServerPort); } void Button12Click(object sender, EventArgs e) @@ -172,12 +172,12 @@ namespace NovetusLauncher void Button16Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP); + launcherForm.AddIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.CurrentServer.ServerIP); } void Button17Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort); + launcherForm.AddIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.CurrentServer.ServerPort); } void NumericUpDown1ValueChanged(object sender, EventArgs e) @@ -197,7 +197,7 @@ namespace NovetusLauncher void Button7Click(object sender, EventArgs e) { - launcherForm.ResetCurPort(numericUpDown1, GlobalVars.JoinPort); + launcherForm.ResetCurPort(numericUpDown1, GlobalVars.CurrentServer.ServerPort); } void Button22Click(object sender, EventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs index 7d9ec54..03dd9c9 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs @@ -84,10 +84,10 @@ namespace NovetusLauncher return; } - GlobalVars.IP = textBox1.Text; + GlobalVars.CurrentServer.ServerIP = textBox1.Text; checkBox3.Enabled = false; GlobalVars.LocalPlayMode = false; - label37.Text = GlobalVars.IP; + label37.Text = GlobalVars.CurrentServer.ServerIP; } void CheckBox1CheckedChanged(object sender, EventArgs e) @@ -147,12 +147,12 @@ namespace NovetusLauncher void Button10Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP); + launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.CurrentServer.ServerIP); } void Button11Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort); + launcherForm.AddIPPortListing(null, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.CurrentServer.ServerPort); } void Button12Click(object sender, EventArgs e) @@ -177,12 +177,12 @@ namespace NovetusLauncher void Button16Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP); + launcherForm.AddIPPortListing(listBox3, GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.CurrentServer.ServerIP); } void Button17Click(object sender, EventArgs e) { - launcherForm.AddIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.JoinPort); + launcherForm.AddIPPortListing(listBox4, GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.CurrentServer.ServerPort); } void NumericUpDown1ValueChanged(object sender, EventArgs e) @@ -202,7 +202,7 @@ namespace NovetusLauncher void Button7Click(object sender, EventArgs e) { - launcherForm.ResetCurPort(numericUpDown1, GlobalVars.JoinPort); + launcherForm.ResetCurPort(numericUpDown1, GlobalVars.CurrentServer.ServerPort); } void Button22Click(object sender, EventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index 0ca88ad..017e835 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -571,10 +571,10 @@ namespace NovetusLauncher SelectedMapLabel.Text = GlobalVars.UserConfiguration.Map; Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes); Tree.Focus(); - JoinPortBox.Value = Convert.ToDecimal(GlobalVars.JoinPort); + JoinPortBox.Value = Convert.ToDecimal(GlobalVars.CurrentServer.ServerPort); HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); - IPLabel.Text = GlobalVars.IP; - PortLabel.Text = GlobalVars.JoinPort.ToString(); + IPLabel.Text = GlobalVars.CurrentServer.ServerIP; + PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString(); DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence; uPnPCheckBox.Checked = GlobalVars.UserConfiguration.UPnP; ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications; @@ -683,7 +683,7 @@ namespace NovetusLauncher switch (GlobalVars.SelectedClientInfo.UsesID) { case true: - if (GlobalVars.IP.Equals("localhost")) + if (GlobalVars.CurrentServer.ServerIP.Equals("localhost")) { LocalPlayCheckBox.Enabled = true; } @@ -905,17 +905,17 @@ namespace NovetusLauncher public void SelectIPListing() { - GlobalVars.IP = ServerBox.SelectedItem.ToString(); - IPBox.Text = GlobalVars.IP; + GlobalVars.CurrentServer.ServerIP = ServerBox.SelectedItem.ToString(); + IPBox.Text = GlobalVars.CurrentServer.ServerIP; LocalPlayCheckBox.Enabled = false; GlobalVars.LocalPlayMode = false; - IPLabel.Text = GlobalVars.IP; + IPLabel.Text = GlobalVars.CurrentServer.ServerIP; } public void SelectPortListing() { - GlobalVars.JoinPort = Convert.ToInt32(PortBox.SelectedItem.ToString()); - JoinPortBox.Value = Convert.ToDecimal(GlobalVars.JoinPort); + GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(PortBox.SelectedItem.ToString()); + JoinPortBox.Value = Convert.ToDecimal(GlobalVars.CurrentServer.ServerPort); } public void ResetCurPort(NumericUpDown box, int value) @@ -926,8 +926,8 @@ namespace NovetusLauncher public void ChangeJoinPort() { - GlobalVars.JoinPort = Convert.ToInt32(JoinPortBox.Value); - PortLabel.Text = GlobalVars.JoinPort.ToString(); + GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(JoinPortBox.Value); + PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString(); } public void ChangeServerPort() diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs index be86f82..8fc2377 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylish.cs @@ -115,7 +115,7 @@ namespace NovetusLauncher launcherFormStylishInterface1.mapsBox.SelectedNode.BackColor = SystemColors.Highlight; launcherFormStylishInterface1.mapsBox.SelectedNode.ForeColor = SystemColors.HighlightText; } - launcherFormStylishInterface1.joinPortBox.Text = GlobalVars.JoinPort.ToString(); + launcherFormStylishInterface1.joinPortBox.Text = GlobalVars.CurrentServer.ServerPort.ToString(); launcherFormStylishInterface1.serverPortBox.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); launcherFormStylishInterface1.discordRichPresenceBox.IsChecked = GlobalVars.UserConfiguration.DiscordPresence; launcherFormStylishInterface1.uPnPBox.IsChecked = GlobalVars.UserConfiguration.UPnP; diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs index b60f49c..540169c 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs @@ -325,14 +325,14 @@ namespace NovetusLauncher { if (!IsLoaded) return; - GlobalVars.IP = ipAddressBox.Text; + GlobalVars.CurrentServer.ServerIP = ipAddressBox.Text; } private void joinPortBox_TextChanged(object sender, TextChangedEventArgs e) { if (!IsLoaded) return; - GlobalVars.JoinPort = Convert.ToInt32(joinPortBox.Text); + GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(joinPortBox.Text); } private void serverPortBox_TextChanged(object sender, TextChangedEventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/NovetusConsole.cs b/Novetus/NovetusLauncher/Forms/NovetusConsole.cs index 6c473ed..1ca3fcf 100644 --- a/Novetus/NovetusLauncher/Forms/NovetusConsole.cs +++ b/Novetus/NovetusLauncher/Forms/NovetusConsole.cs @@ -31,28 +31,8 @@ namespace NovetusLauncher private void NovetusConsole_Load(object sender, EventArgs e) { - Util.ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4); + Util.ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded.", 4); Util.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4); - if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName)) - { - Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5); - ConsoleForm.WriteConfigValues(); - } - if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization)) - { - Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization + " not found. Creating one with default values.", 5); - ConsoleForm.WriteCustomizationValues(); - } - if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt")) - { - Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); - File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); - } - if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt")) - { - Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); - File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); - } NovetusFuncs.SetupAdminPassword(); if (argList.Length > 0) diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs index 17870df..625e468 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs @@ -83,6 +83,7 @@ partial class ClientinfoEditor this.usenewsignformatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.useloadfileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.userbxassetforgenerationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.generatescriptToolStripMenuItem = 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(); @@ -165,7 +166,7 @@ partial class ClientinfoEditor this.checkBox8 = new System.Windows.Forms.CheckBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); - this.generatescriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.serverToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -454,7 +455,8 @@ partial class ClientinfoEditor this.usenewsignformatToolStripMenuItem, this.useloadfileToolStripMenuItem, this.userbxassetforgenerationToolStripMenuItem, - this.generatescriptToolStripMenuItem}); + this.generatescriptToolStripMenuItem, + this.serverToolStripMenuItem2}); this.generalToolStripMenuItem.Name = "generalToolStripMenuItem"; this.generalToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.generalToolStripMenuItem.Text = "General"; @@ -571,6 +573,13 @@ partial class ClientinfoEditor this.userbxassetforgenerationToolStripMenuItem.Text = "%userbxassetforgeneration%"; this.userbxassetforgenerationToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // + // generatescriptToolStripMenuItem + // + this.generatescriptToolStripMenuItem.Name = "generatescriptToolStripMenuItem"; + this.generatescriptToolStripMenuItem.Size = new System.Drawing.Size(227, 22); + this.generatescriptToolStripMenuItem.Text = "%generatescript%"; + this.generatescriptToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); + // // serverToolStripMenuItem1 // this.serverToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -584,21 +593,21 @@ partial class ClientinfoEditor // limitToolStripMenuItem // this.limitToolStripMenuItem.Name = "limitToolStripMenuItem"; - this.limitToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.limitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); 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(160, 22); + this.notificationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.notificationsToolStripMenuItem.Text = "%notifications%"; this.notificationsToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // portToolStripMenuItem // this.portToolStripMenuItem.Name = "portToolStripMenuItem"; - this.portToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.portToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.portToolStripMenuItem.Text = "%port%"; this.portToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // @@ -619,49 +628,49 @@ partial class ClientinfoEditor // md5launcherToolStripMenuItem // this.md5launcherToolStripMenuItem.Name = "md5launcherToolStripMenuItem"; - this.md5launcherToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5launcherToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5launcherToolStripMenuItem.Text = "%md5launcher%"; this.md5launcherToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5scriptToolStripMenuItem // this.md5scriptToolStripMenuItem.Name = "md5scriptToolStripMenuItem"; - this.md5scriptToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5scriptToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5scriptToolStripMenuItem.Text = "%md5script%"; this.md5scriptToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5exeToolStripMenuItem // this.md5exeToolStripMenuItem.Name = "md5exeToolStripMenuItem"; - this.md5exeToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5exeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5exeToolStripMenuItem.Text = "%md5exe%"; this.md5exeToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5scriptdToolStripMenuItem // this.md5scriptdToolStripMenuItem.Name = "md5scriptdToolStripMenuItem"; - this.md5scriptdToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5scriptdToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5scriptdToolStripMenuItem.Text = "%md5scriptd%"; this.md5scriptdToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5exedToolStripMenuItem // this.md5exedToolStripMenuItem.Name = "md5exedToolStripMenuItem"; - this.md5exedToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5exedToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5exedToolStripMenuItem.Text = "%md5exed%"; this.md5exedToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5sToolStripMenuItem // this.md5sToolStripMenuItem.Name = "md5sToolStripMenuItem"; - this.md5sToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5sToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5sToolStripMenuItem.Text = "%md5s%"; this.md5sToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // md5sdToolStripMenuItem // this.md5sdToolStripMenuItem.Name = "md5sdToolStripMenuItem"; - this.md5sdToolStripMenuItem.Size = new System.Drawing.Size(164, 22); + this.md5sdToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.md5sdToolStripMenuItem.Text = "%md5sd%"; this.md5sdToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // @@ -1270,12 +1279,12 @@ partial class ClientinfoEditor this.label3.TabIndex = 37; this.label3.Text = "EXE Name:"; // - // generatescriptToolStripMenuItem + // serverToolStripMenuItem2 // - this.generatescriptToolStripMenuItem.Name = "generatescriptToolStripMenuItem"; - this.generatescriptToolStripMenuItem.Size = new System.Drawing.Size(227, 22); - this.generatescriptToolStripMenuItem.Text = "%generatescript%"; - this.generatescriptToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); + this.serverToolStripMenuItem2.Name = "serverToolStripMenuItem2"; + this.serverToolStripMenuItem2.Size = new System.Drawing.Size(227, 22); + this.serverToolStripMenuItem2.Text = "%server%"; + this.serverToolStripMenuItem2.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // ClientinfoEditor // @@ -1448,4 +1457,5 @@ partial class ClientinfoEditor private System.Windows.Forms.ToolStripMenuItem useloadfileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem userbxassetforgenerationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem generatescriptToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem serverToolStripMenuItem2; } diff --git a/Novetus/NovetusLauncher/Forms/ServerBrowser.cs b/Novetus/NovetusLauncher/Forms/ServerBrowser.cs index 8ec2e92..150f28f 100644 --- a/Novetus/NovetusLauncher/Forms/ServerBrowser.cs +++ b/Novetus/NovetusLauncher/Forms/ServerBrowser.cs @@ -18,8 +18,8 @@ namespace NovetusLauncher public partial class ServerBrowser : Form { #region Private Variables - List serverList = new List(); - private GameServer selectedServer; + List serverList = new List(); + private ServerBrowserDef selectedServer; private string oldIP; private int oldPort; #endregion @@ -45,10 +45,10 @@ namespace NovetusLauncher { if (selectedServer.IsValid()) { - oldIP = GlobalVars.IP; - oldPort = GlobalVars.JoinPort; - GlobalVars.IP = selectedServer.ServerIP; - GlobalVars.JoinPort = selectedServer.ServerPort; + oldIP = GlobalVars.CurrentServer.ServerIP; + oldPort = GlobalVars.CurrentServer.ServerPort; + GlobalVars.CurrentServer.ServerIP = selectedServer.ServerIP; + GlobalVars.CurrentServer.ServerPort = selectedServer.ServerPort; ClientManagement.LaunchRBXClient(selectedServer.ServerClient, ScriptType.Client, false, true, new EventHandler(ClientExited)); } } @@ -70,8 +70,8 @@ namespace NovetusLauncher GlobalVars.GameOpened = ScriptType.None; } ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened)); - GlobalVars.IP = oldIP; - GlobalVars.JoinPort = oldPort; + GlobalVars.CurrentServer.ServerIP = oldIP; + GlobalVars.CurrentServer.ServerPort = oldPort; } private void ServerListView_SelectedIndexChanged(object sender, EventArgs e) @@ -152,7 +152,7 @@ namespace NovetusLauncher } string[] serverInfo = DecodedLine.Split('|'); - GameServer gameServer = new GameServer(serverInfo[0], serverInfo[1], serverInfo[2], serverInfo[3], serverInfo[4]); + ServerBrowserDef gameServer = new ServerBrowserDef(serverInfo[0], serverInfo[1], serverInfo[2], serverInfo[3], serverInfo[4]); if (gameServer.IsValid()) { serverList.Add(gameServer); @@ -247,10 +247,10 @@ namespace NovetusLauncher } #endregion - #region Game Server Definition - public class GameServer + #region Server browser Definition + public class ServerBrowserDef { - public GameServer(string name, string ip, string port, string client, string version) + public ServerBrowserDef(string name, string ip, string port, string client, string version) { ServerName = SecurityFuncs.Base64DecodeOld(name); ServerIP = SecurityFuncs.Base64DecodeOld(ip); diff --git a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs index d629172..4abdf28 100644 --- a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs +++ b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs @@ -23,6 +23,7 @@ namespace NovetusLauncher } static bool formsOpen = false; + static LauncherFormShared entryPointForm; /// /// Program entry point. @@ -32,6 +33,7 @@ namespace NovetusLauncher { System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); + entryPointForm = new LauncherFormShared(); if (!Directory.Exists(GlobalPaths.LogDir)) { @@ -79,15 +81,29 @@ namespace NovetusLauncher Run(args, isSDK, state); } + static void CreateFiles() + { + if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt")) + { + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); + } + if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt")) + { + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); + } + + FileManagement.CreateInitialFileListIfNeededMulti(); + FileManagement.CreateAssetCacheDirectories(); + Util.InitUPnP(); + Util.StartDiscord(); + } + static void Run(string[] args, bool sdk = false, CMDState state = CMDState.CMDOpen) { try { - FileManagement.CreateInitialFileListIfNeededMulti(); - FileManagement.CreateAssetCacheDirectories(); - Util.InitUPnP(); - Util.StartDiscord(); - while (!GlobalVars.AppClosed) { System.Windows.Forms.Application.DoEvents(); @@ -101,6 +117,8 @@ namespace NovetusLauncher console.Show(); } + CreateFiles(); + if (state != CMDState.CMDOnly) { if (!sdk) diff --git a/Novetus/NovetusURI/Classes/LocalFuncs.cs b/Novetus/NovetusURI/Classes/LocalFuncs.cs index 2be669b..af16a46 100644 --- a/Novetus/NovetusURI/Classes/LocalFuncs.cs +++ b/Novetus/NovetusURI/Classes/LocalFuncs.cs @@ -87,8 +87,8 @@ namespace NovetusURI string port = SecurityFuncs.Base64Decode(SplitArg[1]); string client = SecurityFuncs.Base64Decode(SplitArg[2]); GlobalVars.UserConfiguration.SelectedClient = client; - GlobalVars.IP = ip; - GlobalVars.JoinPort = Convert.ToInt32(port); + GlobalVars.CurrentServer.ServerIP = ip; + GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(port); ClientManagement.ReadClientValues(); } catch (Exception ex)