From 99585ff635ead46b79c420968a38a9193a496a0c Mon Sep 17 00:00:00 2001 From: Bitl Date: Mon, 12 Sep 2022 14:56:40 -0700 Subject: [PATCH] fixing shit part 2 --- .../CharacterCustomizationExtended.cs | 4 +- .../Forms/LauncherForm/LauncherFormShared.cs | 188 +++++++++--------- .../NovetusLauncher/Forms/SDK/AssetFixer.cs | 20 +- .../NovetusLauncher/Forms/SDK/NovetusSDK.cs | 14 +- .../NovetusLauncher/Forms/ServerBrowser.cs | 14 +- .../NovetusLauncher/Novetus.Launcher.csproj | 5 +- .../NovetusLauncherEntryPoint.cs | 8 +- Novetus/NovetusURI/Classes/LocalFuncs.cs | 10 +- Novetus/NovetusURI/Forms/InstallForm.cs | 4 +- 9 files changed, 135 insertions(+), 132 deletions(-) diff --git a/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs b/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs index 5f36094..9b3d649 100644 --- a/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs +++ b/Novetus/NovetusCore/CharCustom/Forms/Extended/CharacterCustomizationExtended.cs @@ -912,7 +912,7 @@ public partial class CharacterCustomizationExtended : Form { if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) { - GlobalFuncs.DrawBorderSimple(e.Graphics, label9.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1); + Util.DrawBorderSimple(e.Graphics, label9.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1); } } @@ -920,7 +920,7 @@ public partial class CharacterCustomizationExtended : Form { if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) { - GlobalFuncs.DrawBorderSimple(e.Graphics, panel1.DisplayRectangle, Color.Black, ButtonBorderStyle.Solid, 1); + Util.DrawBorderSimple(e.Graphics, panel1.DisplayRectangle, Color.Black, ButtonBorderStyle.Solid, 1); } } #endregion diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index e67d276..64ea52b 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -72,12 +72,12 @@ namespace NovetusLauncher try { NetFuncs.InitUPnP(DeviceFound, DeviceLost); - GlobalFuncs.ConsolePrint("UPnP: Service initialized", 3, ConsoleBox); + Util.ConsolePrint("UPnP: Service initialized", 3, ConsoleBox); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2, ConsoleBox); } } } @@ -90,12 +90,12 @@ namespace NovetusLauncher { NetFuncs.StartUPnP(device, protocol, port); string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); - GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3, ConsoleBox); + Util.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3, ConsoleBox); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2, ConsoleBox); } } } @@ -108,12 +108,12 @@ namespace NovetusLauncher { NetFuncs.StopUPnP(device, protocol, port); string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); - GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3, ConsoleBox); + Util.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3, ConsoleBox); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2, ConsoleBox); } } } @@ -124,14 +124,14 @@ namespace NovetusLauncher { INatDevice device = args.Device; string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); - GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3, ConsoleBox); + Util.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3, ConsoleBox); StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2, ConsoleBox); } } @@ -141,14 +141,14 @@ namespace NovetusLauncher { INatDevice device = args.Device; string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); - GlobalFuncs.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3, ConsoleBox); + Util.ConsolePrint("UPnP: Device '" + IP + "' disconnected.", 3, ConsoleBox); StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox); } } #endregion @@ -156,17 +156,17 @@ namespace NovetusLauncher #region Discord public void ReadyCallback() { - GlobalFuncs.ConsolePrint("Discord RPC: Ready", 3, ConsoleBox); + Util.ConsolePrint("Discord RPC: Ready", 3, ConsoleBox); } public void DisconnectedCallback(int errorCode, string message) { - GlobalFuncs.ConsolePrint("Discord RPC: Disconnected. Reason - " + errorCode + ": " + message, 2, ConsoleBox); + Util.ConsolePrint("Discord RPC: Disconnected. Reason - " + errorCode + ": " + message, 2, ConsoleBox); } public void ErrorCallback(int errorCode, string message) { - GlobalFuncs.ConsolePrint("Discord RPC: Error. Reason - " + errorCode + ": " + message, 2, ConsoleBox); + Util.ConsolePrint("Discord RPC: Error. Reason - " + errorCode + ": " + message, 2, ConsoleBox); } public void JoinCallback(string secret) @@ -194,7 +194,7 @@ namespace NovetusLauncher handlers.requestCallback += RequestCallback; DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); - GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened), true); + ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened), true); } } #endregion @@ -202,7 +202,7 @@ namespace NovetusLauncher #region Form Event Functions public void InitForm() { - GlobalFuncs.CreateInitialFileListIfNeededMulti(); + FileManagement.CreateInitialFileListIfNeededMulti(); HideMasterAddressWarning = false; @@ -210,8 +210,8 @@ namespace NovetusLauncher { Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version; } - GlobalFuncs.ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4, ConsoleBox); - GlobalFuncs.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4, ConsoleBox); + Util.ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4, ConsoleBox); + Util.ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4, ConsoleBox); if (FormStyle != Settings.Style.Stylish) { @@ -221,7 +221,7 @@ namespace NovetusLauncher } else { - GlobalFuncs.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2, ConsoleBox); + Util.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2, ConsoleBox); } if (File.Exists(GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT")) @@ -230,28 +230,28 @@ namespace NovetusLauncher } else { - GlobalFuncs.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT not found.", 2, ConsoleBox); + Util.ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\README-AND-CREDITS.TXT not found.", 2, ConsoleBox); } } if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName)) { - GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5, ConsoleBox); + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName + " not found. Creating one with default values.", 5, ConsoleBox); WriteConfigValues(); } if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization)) { - GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization + " not found. Creating one with default values.", 5, ConsoleBox); + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization + " not found. Creating one with default values.", 5, ConsoleBox); WriteCustomizationValues(); } if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt")) { - GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5, ConsoleBox); + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5, ConsoleBox); File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); } if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt")) { - GlobalFuncs.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5, ConsoleBox); + Util.ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5, ConsoleBox); File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); } @@ -262,7 +262,7 @@ namespace NovetusLauncher GlobalVars.UserConfiguration.Map + "]"; } - GlobalFuncs.CreateAssetCacheDirectories(); + FileManagement.CreateAssetCacheDirectories(); SetupImportantData(); @@ -524,19 +524,19 @@ namespace NovetusLauncher switch (gameType) { case ScriptType.Client: - GlobalFuncs.LaunchRBXClient(ScriptType.Client, false, true, new EventHandler(ClientExited), ConsoleBox); + ClientManagement.LaunchRBXClient(ScriptType.Client, false, true, new EventHandler(ClientExited), ConsoleBox); break; case ScriptType.Server: - GlobalFuncs.LaunchRBXClient(ScriptType.Server, no3d, false, new EventHandler(ServerExited), ConsoleBox); + ClientManagement.LaunchRBXClient(ScriptType.Server, no3d, false, new EventHandler(ServerExited), ConsoleBox); break; case ScriptType.Solo: - GlobalFuncs.LaunchRBXClient(ScriptType.Solo, false, false, new EventHandler(SoloExited), ConsoleBox); + ClientManagement.LaunchRBXClient(ScriptType.Solo, false, false, new EventHandler(SoloExited), ConsoleBox); break; case ScriptType.Studio: - GlobalFuncs.LaunchRBXClient(ScriptType.Studio, false, nomap, new EventHandler(ClientExitedBase), ConsoleBox); + ClientManagement.LaunchRBXClient(ScriptType.Studio, false, nomap, new EventHandler(ClientExitedBase), ConsoleBox); break; case ScriptType.EasterEgg: - GlobalFuncs.LaunchRBXClient(ScriptType.EasterEgg, false, false, new EventHandler(EasterEggExited), ConsoleBox); + ClientManagement.LaunchRBXClient(ScriptType.EasterEgg, false, false, new EventHandler(EasterEggExited), ConsoleBox); break; case ScriptType.None: default: @@ -600,7 +600,7 @@ namespace NovetusLauncher void ServerExited(object sender, EventArgs e) { GlobalVars.GameOpened = ScriptType.None; - GlobalFuncs.PingMasterServer(false, "The server has removed itself from the master server list.", ConsoleBox); + NovetusFuncs.PingMasterServer(false, "The server has removed itself from the master server list.", ConsoleBox); ClientExitedBase(sender, e); } @@ -617,7 +617,7 @@ namespace NovetusLauncher void ClientExitedBase(object sender, EventArgs e) { - GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened)); + ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened)); if (GlobalVars.UserConfiguration.CloseOnLaunch) { @@ -664,7 +664,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("The map '" + searchText + "' cannot be found. Please try another term.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } @@ -755,7 +755,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); StartGame(ScriptType.Server, false, false, true); } break; @@ -785,7 +785,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); StartGame(ScriptType.Studio, false, false, true); } break; @@ -808,13 +808,13 @@ namespace NovetusLauncher } else { - GlobalFuncs.ConsolePrint("Please specify 'save', 'load', or 'reset'.", 4, ConsoleBox); + Util.ConsolePrint("Please specify 'save', 'load', or 'reset'.", 4, ConsoleBox); } } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("Please specify 'save', 'load', or 'reset'.", 4, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("Please specify 'save', 'load', or 'reset'.", 4, ConsoleBox); } break; case string help when string.Compare(help, "help", true, CultureInfo.InvariantCulture) == 0: @@ -827,12 +827,12 @@ namespace NovetusLauncher if (GlobalVars.UserConfiguration.DisableReshadeDelete == true) { GlobalVars.UserConfiguration.DisableReshadeDelete = false; - GlobalFuncs.ConsolePrint("ReShade DLL deletion enabled.", 4, ConsoleBox); + Util.ConsolePrint("ReShade DLL deletion enabled.", 4, ConsoleBox); } else { GlobalVars.UserConfiguration.DisableReshadeDelete = true; - GlobalFuncs.ConsolePrint("ReShade DLL deletion disabled.", 4, ConsoleBox); + Util.ConsolePrint("ReShade DLL deletion disabled.", 4, ConsoleBox); } break; case string altserverip when altserverip.Contains("altserverip", StringComparison.InvariantCultureIgnoreCase) == true: @@ -843,32 +843,32 @@ namespace NovetusLauncher if (vals[1].Equals("none", StringComparison.InvariantCultureIgnoreCase)) { GlobalVars.UserConfiguration.AlternateServerIP = ""; - GlobalFuncs.ConsolePrint("Alternate Server IP removed.", 4, ConsoleBox); + Util.ConsolePrint("Alternate Server IP removed.", 4, ConsoleBox); } else { GlobalVars.UserConfiguration.AlternateServerIP = vals[1]; - GlobalFuncs.ConsolePrint("Alternate Server IP set to " + vals[1], 4, ConsoleBox); + Util.ConsolePrint("Alternate Server IP set to " + vals[1], 4, ConsoleBox); } } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); - GlobalFuncs.ConsolePrint("Please specify the IP address you would like to set Novetus to.", 4, ConsoleBox); + Util.LogExceptions(ex); + Util.ConsolePrint("Please specify the IP address you would like to set Novetus to.", 4, ConsoleBox); } break; case string important when string.Compare(important, LocalVars.important, true, CultureInfo.InvariantCulture) == 0: GlobalVars.AdminMode = true; - GlobalFuncs.ConsolePrint("ADMIN MODE ENABLED.", 4, ConsoleBox); - GlobalFuncs.ConsolePrint("YOU ARE GOD.", 2, ConsoleBox); + Util.ConsolePrint("ADMIN MODE ENABLED.", 4, ConsoleBox); + Util.ConsolePrint("YOU ARE GOD.", 2, ConsoleBox); break; - case string decode when string.Compare(decode, "decode", true, CultureInfo.InvariantCulture) == 0: + case string decode when (string.Compare(decode, "decode", true, CultureInfo.InvariantCulture) == 0 || string.Compare(decode, "decrypt", true, CultureInfo.InvariantCulture) == 0): Decoder de = new Decoder(); de.Show(); - GlobalFuncs.ConsolePrint("???", 2, ConsoleBox); + Util.ConsolePrint("???", 2, ConsoleBox); break; default: - GlobalFuncs.ConsolePrint("Command is either not registered or valid", 2, ConsoleBox); + Util.ConsolePrint("Command is either not registered or valid", 2, ConsoleBox); break; } } @@ -877,27 +877,27 @@ namespace NovetusLauncher { NovetusSDK im = new NovetusSDK(); im.Show(); - GlobalFuncs.ConsolePrint("Novetus SDK Launcher Loaded.", 4, ConsoleBox); + Util.ConsolePrint("Novetus SDK Launcher Loaded.", 4, ConsoleBox); } public void ConsoleHelp() { - GlobalFuncs.ConsolePrint("Help:", 3, ConsoleBox, true); - GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= client | Launches client with launcher settings", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= solo | Launches client in Play Solo mode with launcher settings", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= server 3d | Launches server with launcher settings", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= server no3d | Launches server in NoGraphics mode with launcher settings", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= studio map | Launches Roblox Studio with the selected map", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= studio nomap | Launches Roblox Studio without the selected map", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= sdk | Launches the Novetus SDK Launcher", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= dlldelete | Toggle the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= altserverip | Sets the alternate server IP for server info. Replace with your specified IP or specify 'none' to remove the current alternate server IP", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= config save | Saves the config file", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= config load | Reloads the config file", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint("= config reset | Resets the config file", 4, ConsoleBox, true); - GlobalFuncs.ConsolePrint(LocalVars.important2, 0, ConsoleBox, true, true); + Util.ConsolePrint("Help:", 3, ConsoleBox, true); + Util.ConsolePrint("---------", 1, ConsoleBox, true); + Util.ConsolePrint("= client | Launches client with launcher settings", 4, ConsoleBox, true); + Util.ConsolePrint("= solo | Launches client in Play Solo mode with launcher settings", 4, ConsoleBox, true); + Util.ConsolePrint("= server 3d | Launches server with launcher settings", 4, ConsoleBox, true); + Util.ConsolePrint("= server no3d | Launches server in NoGraphics mode with launcher settings", 4, ConsoleBox, true); + Util.ConsolePrint("= studio map | Launches Roblox Studio with the selected map", 4, ConsoleBox, true); + Util.ConsolePrint("= studio nomap | Launches Roblox Studio without the selected map", 4, ConsoleBox, true); + Util.ConsolePrint("= sdk | Launches the Novetus SDK Launcher", 4, ConsoleBox, true); + Util.ConsolePrint("= dlldelete | Toggle the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox, true); + Util.ConsolePrint("= altserverip | Sets the alternate server IP for server info. Replace with your specified IP or specify 'none' to remove the current alternate server IP", 4, ConsoleBox, true); + Util.ConsolePrint("---------", 1, ConsoleBox, true); + Util.ConsolePrint("= config save | Saves the config file", 4, ConsoleBox, true); + Util.ConsolePrint("= config load | Reloads the config file", 4, ConsoleBox, true); + Util.ConsolePrint("= config reset | Resets the config file", 4, ConsoleBox, true); + Util.ConsolePrint(LocalVars.important2, 0, ConsoleBox, true, true); } public void SwitchStyles() @@ -956,7 +956,7 @@ namespace NovetusLauncher public void ReadConfigValues(bool initial = false) { - GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); + FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); @@ -991,15 +991,15 @@ namespace NovetusLauncher break; } - GlobalFuncs.ConsolePrint("Config loaded.", 3, ConsoleBox); + Util.ConsolePrint("Config loaded.", 3, ConsoleBox); ReadClientValues(initial); } public void WriteConfigValues(bool ShowBox = false) { - GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); - GlobalFuncs.ReadClientValues(ConsoleBox); - GlobalFuncs.ConsolePrint("Config Saved.", 3, ConsoleBox); + FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); + ClientManagement.ReadClientValues(ConsoleBox); + Util.ConsolePrint("Config Saved.", 3, ConsoleBox); if (ShowBox) { MessageBox.Show("Config Saved!", "Novetus - Config Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -1008,8 +1008,8 @@ namespace NovetusLauncher public void WriteCustomizationValues() { - GlobalFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true); - GlobalFuncs.ConsolePrint("Config Saved.", 3, ConsoleBox); + FileManagement.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true); + Util.ConsolePrint("Config Saved.", 3, ConsoleBox); } public void ResetConfigValues(bool ShowBox = false) @@ -1026,7 +1026,7 @@ namespace NovetusLauncher f.Close(); } - GlobalFuncs.ResetConfigValues(FormStyle); + FileManagement.ResetConfigValues(FormStyle); WriteConfigValues(); ReadConfigValues(); if (ShowBox) @@ -1044,11 +1044,11 @@ namespace NovetusLauncher try { MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.\n\nNovetus will attempt to generate one.", "Novetus - Client Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - GlobalFuncs.GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath)); + ClientManagement.GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath)); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("Failed to generate default clientinfo.nov. Info: " + ex.Message + "\n\nLoading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", "Novetus - Client Info Generation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; return false; @@ -1069,7 +1069,7 @@ namespace NovetusLauncher } } - GlobalFuncs.ReadClientValues(ConsoleBox, initial); + ClientManagement.ReadClientValues(ConsoleBox, initial); PlayerNameTextBox.Enabled = GlobalVars.SelectedClientInfo.UsesPlayerName; @@ -1105,7 +1105,7 @@ namespace NovetusLauncher public void GeneratePlayerID() { - GlobalFuncs.GeneratePlayerID(); + NovetusFuncs.GeneratePlayerID(); PlayerIDTextBox.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID); } @@ -1118,15 +1118,15 @@ namespace NovetusLauncher await addon.LoadMod(); if (!string.IsNullOrWhiteSpace(addon.getOutcome())) { - GlobalFuncs.ConsolePrint("ModManager - " + addon.getOutcome(), 3, ConsoleBox); + Util.ConsolePrint("ModManager - " + addon.getOutcome(), 3, ConsoleBox); } } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); if (!string.IsNullOrWhiteSpace(addon.getOutcome())) { - GlobalFuncs.ConsolePrint("ModManager - " + addon.getOutcome(), 2, ConsoleBox); + Util.ConsolePrint("ModManager - " + addon.getOutcome(), 2, ConsoleBox); } } @@ -1148,8 +1148,8 @@ namespace NovetusLauncher if (Directory.Exists(GlobalPaths.AssetCacheDir)) { Directory.Delete(GlobalPaths.AssetCacheDir, true); - GlobalFuncs.CreateAssetCacheDirectories(); - GlobalFuncs.ConsolePrint("Asset cache cleared!", 3, ConsoleBox); + FileManagement.CreateAssetCacheDirectories(); + Util.ConsolePrint("Asset cache cleared!", 3, ConsoleBox); MessageBox.Show("Asset cache cleared!", "Novetus - Asset Cache Cleared", MessageBoxButtons.OK, MessageBoxIcon.Information); } else @@ -1160,16 +1160,16 @@ namespace NovetusLauncher public void RefreshMaps() { - GlobalFuncs.ResetMapIfNecessary(); + FileManagement.ResetMapIfNecessary(); Tree.Nodes.Clear(); _TreeCache.Nodes.Clear(); string mapdir = GlobalPaths.MapsDir; - string[] filePaths = GlobalFuncs.FindAllFiles(GlobalPaths.MapsDir); + string[] filePaths = Util.FindAllFiles(GlobalPaths.MapsDir); foreach (string path in filePaths) { - GlobalFuncs.RenameFileWithInvalidChars(path); + Util.RenameFileWithInvalidChars(path); } string[] fileexts = new string[] { ".rbxl", ".rbxlx" }; @@ -1377,7 +1377,7 @@ namespace NovetusLauncher return; } - GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened)); + ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened)); FormCollection fc = Application.OpenForms; @@ -1486,11 +1486,11 @@ namespace NovetusLauncher try { - GlobalFuncs.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true); + Util.FixedFileCopy(ofd.FileName, GlobalPaths.MapsDirCustom + @"\\" + mapname, true, true); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("Novetus has experienced an error when adding your map file: " + ex.Message + "\n\nYour file has not been added. Please try again.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); success = false; } @@ -1515,7 +1515,7 @@ namespace NovetusLauncher void SettingsExited(object sender, FormClosingEventArgs e) { - GlobalFuncs.ReadClientValues(ConsoleBox); + ClientManagement.ReadClientValues(ConsoleBox); } #endregion diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs index de8f415..65a039e 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetFixer.cs @@ -63,7 +63,7 @@ public partial class AssetFixer : Form SetAssetCachePaths(); - GlobalFuncs.CreateAssetCacheDirectories(); + FileManagement.CreateAssetCacheDirectories(); } void AssetSDK_Close(object sender, CancelEventArgs e) @@ -225,14 +225,14 @@ public partial class AssetFixer : Form if (useURLs) { string oldurl = line; - urlFixed = GlobalFuncs.FixURLString(oldurl, url); + urlFixed = NovetusFuncs.FixURLString(oldurl, url); } else { string newurl = ((!link.Contains("http://") || !link.Contains("https://")) ? "https://" : "") + "assetdelivery.roblox.com/v1/asset/?id="; string urlReplaced = newurl.Contains("https://") ? link.Replace("http://", "").Replace("https://", "") : link.Replace("http://", "https://"); - urlFixed = GlobalFuncs.FixURLString(urlReplaced, newurl); + urlFixed = NovetusFuncs.FixURLString(urlReplaced, newurl); } string peram = "id="; @@ -261,10 +261,10 @@ public partial class AssetFixer : Form } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); errors += 1; - GlobalFuncs.LogPrint("ASSETFIX|FILE " + path + " LINE #" + (index) + " " + ex.Message, 2); - GlobalFuncs.LogPrint("ASSETFIX|Asset might be private or unavailable."); + Util.LogPrint("ASSETFIX|FILE " + path + " LINE #" + (index) + " " + ex.Message, 2); + Util.LogPrint("ASSETFIX|Asset might be private or unavailable."); ProgressChangedEvent(); continue; } @@ -294,11 +294,11 @@ public partial class AssetFixer : Form { try { - GlobalFuncs.FixedFileCopy(path, path.Replace(".", " - BAK."), false); + Util.FixedFileCopy(path, path.Replace(".", " - BAK."), false); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); return; } } @@ -317,7 +317,7 @@ public partial class AssetFixer : Form } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("Error: Unable to load the asset. " + ex.Message + "\n\nIf the asset is a modern place or model, try converting the place or model to rbxlx/rbxmx format using MODERN Roblox Studio, then convert it using the Roblox Legacy Place Converter. It should then load fine in the Asset Fixer.", "Asset Fixer - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } @@ -336,7 +336,7 @@ public partial class AssetFixer : Form GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts; GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets"; - GlobalFuncs.CreateAssetCacheDirectories(); + FileManagement.CreateAssetCacheDirectories(); GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir; GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir; diff --git a/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs b/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs index 296bf98..eac3acf 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/NovetusSDK.cs @@ -40,7 +40,7 @@ public partial class NovetusSDK : Form #region Form Events private void NovetusSDK_Load(object sender, EventArgs e) { - GlobalFuncs.CreateInitialFileListIfNeededMulti(); + FileManagement.CreateInitialFileListIfNeededMulti(); if (!File.Exists(GlobalPaths.DataDir + "\\RSG.exe")) { @@ -52,7 +52,7 @@ public partial class NovetusSDK : Form DisableApp(SDKApps.LegacyPlaceConverter); } - if (!GlobalFuncs.IsClientValid("ClientScriptTester")) + if (!ClientManagement.IsClientValid("ClientScriptTester")) { DisableApp(SDKApps.ClientScriptTester); } @@ -63,11 +63,11 @@ public partial class NovetusSDK : Form private void NovetusSDK_Close(object sender, CancelEventArgs e) { - GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); + FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); #if LAUNCHER - GlobalFuncs.ReadClientValues(null); + ClientManagement.ReadClientValues(null); #else - GlobalFuncs.ReadClientValues(); + ClientManagement.ReadClientValues(); #endif } @@ -158,9 +158,9 @@ public partial class NovetusSDK : Form case SDKApps.ClientScriptTester: MessageBox.Show("Note: If you want to test a specific way of loading a client, select the ClientScript Tester in the 'Versions' tab of the Novetus Launcher, then launch it through any way you wish.", "Novetus SDK - Client Script Tester Help", MessageBoxButtons.OK, MessageBoxIcon.Information); #if LAUNCHER - GlobalFuncs.LaunchRBXClient("ClientScriptTester", ScriptType.Client, false, false, null, null); + ClientManagement.LaunchRBXClient("ClientScriptTester", ScriptType.Client, false, false, null, null); #else - GlobalFuncs.LaunchRBXClient("ClientScriptTester", ScriptType.Client, false, false, null); + ClientManagement.LaunchRBXClient("ClientScriptTester", ScriptType.Client, false, false, null); #endif GlobalVars.GameOpened = ScriptType.None; break; diff --git a/Novetus/NovetusLauncher/Forms/ServerBrowser.cs b/Novetus/NovetusLauncher/Forms/ServerBrowser.cs index ac3baac..44c4b24 100644 --- a/Novetus/NovetusLauncher/Forms/ServerBrowser.cs +++ b/Novetus/NovetusLauncher/Forms/ServerBrowser.cs @@ -49,7 +49,7 @@ namespace NovetusLauncher oldPort = GlobalVars.JoinPort; GlobalVars.IP = selectedServer.ServerIP; GlobalVars.JoinPort = selectedServer.ServerPort; - GlobalFuncs.LaunchRBXClient(selectedServer.ServerClient, ScriptType.Client, false, true, new EventHandler(ClientExited), null); + ClientManagement.LaunchRBXClient(selectedServer.ServerClient, ScriptType.Client, false, true, new EventHandler(ClientExited), null); } } else @@ -59,7 +59,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("Cannot join server (" + ex.GetBaseException().Message + ").", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -70,7 +70,7 @@ namespace NovetusLauncher { GlobalVars.GameOpened = ScriptType.None; } - GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened)); + ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened)); GlobalVars.IP = oldIP; GlobalVars.JoinPort = oldPort; } @@ -91,7 +91,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); } } @@ -234,7 +234,7 @@ namespace NovetusLauncher message = "There are no servers available on this master server."; } - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show(message, "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ServerListView.Clear(); } @@ -267,8 +267,8 @@ namespace NovetusLauncher !string.IsNullOrWhiteSpace(ServerIP) && !string.IsNullOrWhiteSpace(ServerPort.ToString()) && !string.IsNullOrWhiteSpace(ServerVersion) && - GlobalFuncs.IsClientValid(ServerClient) && - GlobalFuncs.IsIPValid(ServerIP) && + ClientManagement.IsClientValid(ServerClient) && + Util.IsIPValid(ServerIP) && (!ServerIP.Equals("localhost") || !ServerIP.Equals("127.0.0.1"))) { return true; diff --git a/Novetus/NovetusLauncher/Novetus.Launcher.csproj b/Novetus/NovetusLauncher/Novetus.Launcher.csproj index 3de28f7..4b3d00d 100644 --- a/Novetus/NovetusLauncher/Novetus.Launcher.csproj +++ b/Novetus/NovetusLauncher/Novetus.Launcher.csproj @@ -4,7 +4,7 @@ {F92FFBED-2767-4676-9711-BB89CDA58A43} Debug AnyCPU - WinExe + Exe NovetusLauncher Novetus v4.0 @@ -76,6 +76,9 @@ app.manifest + + + ..\packages\DotNetZip.1.11.0\lib\net20\DotNetZip.dll diff --git a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs index 5660af4..7835ba5 100644 --- a/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs +++ b/Novetus/NovetusLauncher/NovetusLauncherEntryPoint.cs @@ -28,9 +28,9 @@ namespace NovetusLauncher config.AddRuleForAllLevels(logfile); LogManager.Configuration = config; - GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName); - GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); - GlobalVars.ColorsLoaded = GlobalFuncs.InitColors(); + FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName); + FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); + GlobalVars.ColorsLoaded = FileManagement.InitColors(); if (args.Length == 0) { RunLauncher(); @@ -71,7 +71,7 @@ namespace NovetusLauncher } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); } } } diff --git a/Novetus/NovetusURI/Classes/LocalFuncs.cs b/Novetus/NovetusURI/Classes/LocalFuncs.cs index c14fbcc..ec14fc8 100644 --- a/Novetus/NovetusURI/Classes/LocalFuncs.cs +++ b/Novetus/NovetusURI/Classes/LocalFuncs.cs @@ -25,14 +25,14 @@ namespace NovetusURI } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); form.Close(); } } else { - GlobalFuncs.LogPrint("Failed to register. (Error: Did not run as Administrator)", 2); + Util.LogPrint("Failed to register. (Error: Did not run as Administrator)", 2); MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); form.Close(); } @@ -72,7 +72,7 @@ namespace NovetusURI } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); } } } @@ -90,11 +90,11 @@ namespace NovetusURI GlobalVars.UserConfiguration.SelectedClient = client; GlobalVars.IP = ip; GlobalVars.JoinPort = Convert.ToInt32(port); - GlobalFuncs.ReadClientValues(); + ClientManagement.ReadClientValues(); } catch (Exception ex) { - GlobalFuncs.LogExceptions(ex); + Util.LogExceptions(ex); } } } diff --git a/Novetus/NovetusURI/Forms/InstallForm.cs b/Novetus/NovetusURI/Forms/InstallForm.cs index 998c64b..7962a0f 100644 --- a/Novetus/NovetusURI/Forms/InstallForm.cs +++ b/Novetus/NovetusURI/Forms/InstallForm.cs @@ -18,14 +18,14 @@ namespace NovetusURI #region Form Events private void InstallForm_Load(object sender, EventArgs e) { - GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true, + FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true, GlobalPaths.RootPathLauncher + "\\Novetus.exe"); CenterToScreen(); } private void button1_Click(object sender, EventArgs e) { - GlobalFuncs.LogPrint("Attempting to install URI."); + Util.LogPrint("Attempting to install URI."); LocalFuncs.RegisterURI(this); Close(); }