diff --git a/NovetusLauncher/NovetusCMD/Program.cs b/NovetusLauncher/NovetusCMD/Program.cs index c636be0..c72b6ba 100644 --- a/NovetusLauncher/NovetusCMD/Program.cs +++ b/NovetusLauncher/NovetusCMD/Program.cs @@ -18,14 +18,14 @@ namespace NovetusCMD { public static void InitUPnP() { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); } @@ -34,14 +34,14 @@ namespace NovetusCMD public static void StartUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); } @@ -50,14 +50,14 @@ namespace NovetusCMD public static void StopUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); } @@ -70,12 +70,12 @@ namespace NovetusCMD { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3); - StartUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StartUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); } @@ -87,12 +87,12 @@ namespace NovetusCMD { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3); - StopUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StopUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); } @@ -104,10 +104,10 @@ namespace NovetusCMD { try { - GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.ServerDir, GlobalVars.WebServer_Port); + GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); } @@ -127,7 +127,7 @@ namespace NovetusCMD ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); GlobalVars.WebServer.Stop(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); } @@ -140,7 +140,7 @@ namespace NovetusCMD static void WriteConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } @@ -163,25 +163,25 @@ namespace NovetusCMD static void ReadConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); ConsolePrint("Config loaded.", 3); - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); } static void ReadClientValues(string ClientName) { - string clientpath = GlobalVars.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); - GlobalVars.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; ReadClientValues(ClientName); } else { LauncherFuncs.ReadClientValues(clientpath); - ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); + ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3); } } @@ -192,11 +192,11 @@ namespace NovetusCMD public static void Main(string[] args) { - LauncherFuncs.ReadInfoFile(GlobalVars.ConfigDir + "\\" + GlobalVars.InfoName, true); + LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName, true); Console.Title = "Novetus " + GlobalVars.Version + " CMD"; ConsolePrint("NovetusCMD version " + GlobalVars.Version + " loaded.", 1); - ConsolePrint("Novetus path: " + GlobalVars.BasePath, 1); + ConsolePrint("Novetus path: " + Directories.BasePath, 1); if (args.Length == 0) { @@ -236,13 +236,13 @@ namespace NovetusCMD if (CommandLine["upnp"] != null) { - GlobalVars.UPnP = true; + GlobalVars.UserConfiguration.UPnP = true; ConsolePrint("NovetusCMD will now use UPnP for port forwarding.", 4); } if (CommandLine["map"] != null) { - GlobalVars.MapPath = CommandLine["map"]; + GlobalVars.UserConfiguration.MapPath = CommandLine["map"]; } else { @@ -251,7 +251,7 @@ namespace NovetusCMD if (CommandLine["client"] != null) { - GlobalVars.SelectedClient = CommandLine["client"]; + GlobalVars.UserConfiguration.SelectedClient = CommandLine["client"]; } else { @@ -260,12 +260,12 @@ namespace NovetusCMD if (CommandLine["port"] != null) { - GlobalVars.RobloxPort = Convert.ToInt32(CommandLine["port"]); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(CommandLine["port"]); } if (CommandLine["maxplayers"] != null) { - GlobalVars.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]); + GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(CommandLine["maxplayers"]); } } @@ -302,7 +302,7 @@ namespace NovetusCMD { ConsolePrint("NovetusCMD is now loading all server configurations from the INI file.", 5); - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) { ConsolePrint("WARNING 2 - " + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); @@ -312,7 +312,7 @@ namespace NovetusCMD } else { - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); } InitUPnP(); @@ -324,7 +324,7 @@ namespace NovetusCMD AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProgramClose); - ConsolePrint("Launching a " + GlobalVars.SelectedClient + " server on " + GlobalVars.Map + " with " + GlobalVars.PlayerLimit + " players.", 1); + ConsolePrint("Launching a " + GlobalVars.UserConfiguration.SelectedClient + " server on " + GlobalVars.UserConfiguration.Map + " with " + GlobalVars.UserConfiguration.PlayerLimit + " players.", 1); if (!LocalVars.DebugMode) { @@ -346,17 +346,17 @@ namespace NovetusCMD } else { - luafile = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } - string mapfile = GlobalVars.MapPath; + string mapfile = GlobalVars.UserConfiguration.MapPath; string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_server.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; } string quote = "\""; string args = ""; @@ -390,15 +390,15 @@ namespace NovetusCMD client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.UserConfiguration.Map); LocalVars.ProcessID = client.Id; CreateTXT(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); } @@ -416,14 +416,14 @@ namespace NovetusCMD string IP = await SecurityFuncs.GetExternalIPAddressAsync(); string[] lines1 = { SecurityFuncs.Base64Encode(IP), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1, true)); string[] lines2 = { SecurityFuncs.Base64Encode("localhost"), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2, true)); @@ -432,11 +432,11 @@ namespace NovetusCMD "Don't copy the Process ID when sharing the server.", "--------------------", "Server Info:", - "Client: " + GlobalVars.SelectedClient, + "Client: " + GlobalVars.UserConfiguration.SelectedClient, "IP: " + IP, - "Port: " + GlobalVars.RobloxPort.ToString(), - "Map: " + GlobalVars.Map, - "Players: " + GlobalVars.PlayerLimit, + "Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(), + "Map: " + GlobalVars.UserConfiguration.Map, + "Players: " + GlobalVars.UserConfiguration.PlayerLimit, "Version: Novetus " + GlobalVars.Version, "Online URI Link:", URI, @@ -448,8 +448,8 @@ namespace NovetusCMD GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" ); - File.WriteAllText(GlobalVars.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text)); - ConsolePrint("Server Information sent to file " + GlobalVars.BasePath + "\\" + LocalVars.ServerInfoFileName, 4); + File.WriteAllText(Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text)); + ConsolePrint("Server Information sent to file " + Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, 4); } } diff --git a/NovetusLauncher/NovetusFuncs/AddonLoader.cs b/NovetusLauncher/NovetusFuncs/AddonLoader.cs deleted file mode 100644 index fb0cec2..0000000 --- a/NovetusLauncher/NovetusFuncs/AddonLoader.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using System.Linq; -using System.Text; -using Ionic.Zip; - -public class AddonLoader -{ - private readonly OpenFileDialog openFileDialog1; - private string installOutcome = ""; - private int fileListDisplay = 0; - - public AddonLoader() - { - openFileDialog1 = new OpenFileDialog() - { - FileName = "Select an addon .zip file", - Filter = "Compressed zip files (*.zip)|*.zip", - Title = "Open addon .zip" - }; - } - - public void setInstallOutcome(string text) - { - installOutcome = text; - } - - public string getInstallOutcome() - { - return installOutcome; - } - - public void setFileListDisplay(int number) - { - fileListDisplay = number; - } - - public void LoadAddon() - { - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - try - { - int filecount = 0; - StringBuilder filelistbuilder = new StringBuilder(); - - using (Stream str = openFileDialog1.OpenFile()) - { - using (var zipFile = ZipFile.Read(str)) - { - ZipEntry[] entries = zipFile.Entries.ToArray(); - - foreach (ZipEntry entry in entries) - { - filelistbuilder.Append(entry.FileName + " ("+ entry.UncompressedSize +")"); - filelistbuilder.Append(Environment.NewLine); - } - - zipFile.ExtractAll(GlobalVars.BasePath, ExtractExistingFileAction.OverwriteSilently); - } - } - - string filelist = filelistbuilder.ToString(); - - if (filecount > fileListDisplay) - { - installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!"; - } - else - { - installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist; - } - } - catch (Exception ex) when (!Env.Debugging) - { - installOutcome = "Error when installing addon: " + ex.Message; - } - } - } -} diff --git a/NovetusLauncher/NovetusFuncs/CryptoRandom.cs b/NovetusLauncher/NovetusFuncs/CryptoRandom.cs deleted file mode 100644 index e20feed..0000000 --- a/NovetusLauncher/NovetusFuncs/CryptoRandom.cs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:06 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Text; -using System.Security.Cryptography; - -public class CryptoRandom : RandomNumberGenerator -{ - private static RandomNumberGenerator r; - - public CryptoRandom() - { - r = RandomNumberGenerator.Create(); - } - - ///An array of bytes to contain random numbers. - public override void GetBytes(byte[] buffer) - { - r.GetBytes(buffer); - } - - public override void GetNonZeroBytes(byte[] data) - { - r.GetNonZeroBytes(data); - } - public double NextDouble() - { - byte[] b = new byte[4]; - r.GetBytes(b); - return (double)BitConverter.ToUInt32(b, 0) / UInt32.MaxValue; - } - - ///The inclusive lower bound of the random number returned. - ///The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue. - public int Next(int minValue, int maxValue) - { - return (int)Math.Round(NextDouble() * (maxValue - minValue - 1)) + minValue; - } - public int Next() - { - return Next(0, Int32.MaxValue); - } - - ///The inclusive upper bound of the random number returned. maxValue must be greater than or equal 0 - public int Next(int maxValue) - { - return Next(0, maxValue); - } -} diff --git a/NovetusLauncher/NovetusFuncs/DiscordRpc.cs b/NovetusLauncher/NovetusFuncs/DiscordRpc.cs deleted file mode 100644 index 8000020..0000000 --- a/NovetusLauncher/NovetusFuncs/DiscordRpc.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 6:57 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System.Runtime.InteropServices; - -//Discord Rich Presence Integration :D -public class DiscordRpc -{ - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void ReadyCallback(); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void DisconnectedCallback(int errorCode, string message); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void ErrorCallback(int errorCode, string message); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void JoinCallback(string secret); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void SpectateCallback(string secret); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void RequestCallback(JoinRequest request); - - public struct EventHandlers - { - public ReadyCallback readyCallback; - public DisconnectedCallback disconnectedCallback; - public ErrorCallback errorCallback; - public JoinCallback joinCallback; - public SpectateCallback spectateCallback; - public RequestCallback requestCallback; - } - - [System.Serializable] - public struct RichPresence - { - public string state; - /* max 128 bytes */ - public string details; - /* max 128 bytes */ - public long startTimestamp; - public long endTimestamp; - public string largeImageKey; - /* max 32 bytes */ - public string largeImageText; - /* max 128 bytes */ - public string smallImageKey; - /* max 32 bytes */ - public string smallImageText; - /* max 128 bytes */ - public string partyId; - /* max 128 bytes */ - public int partySize; - public int partyMax; - public string matchSecret; - /* max 128 bytes */ - public string joinSecret; - /* max 128 bytes */ - public string spectateSecret; - /* max 128 bytes */ - public bool instance; - } - - [System.Serializable] - public struct JoinRequest - { - public string userId; - public string username; - public string avatar; - } - - public enum Reply - { - No = 0, - Yes = 1, - Ignore = 2 - } - [DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)] - public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId); - - [DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)] - public static extern void Shutdown(); - - [DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)] - public static extern void RunCallbacks(); - - [DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)] - public static extern void UpdatePresence(ref RichPresence presence); - - [DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)] - public static extern void Respond(string userId, Reply reply); -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/GlobalVars.cs b/NovetusLauncher/NovetusFuncs/GlobalVars.cs deleted file mode 100644 index 87e8d32..0000000 --- a/NovetusLauncher/NovetusFuncs/GlobalVars.cs +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:05 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -//using LiteNetLib; -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -public static class Env -{ -#if DEBUG - public static readonly bool Debugging = true; -#else - public static readonly bool Debugging = false; -#endif -} - -public static class GlobalVars -{ - public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\"); - public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString(); - public static readonly string BasePath = RootPath.Replace(@"\", @"\\"); - public static readonly string DataPath = BasePath + @"\\shareddata"; - public static readonly string ServerDir = DataPath + "\\server"; - public static readonly string ConfigDir = BasePath + @"\\config"; - public static readonly string ConfigDirData = BasePathLauncher + @"\\data"; - public static readonly string ClientDir = BasePath + @"\\clients"; - public static readonly string MapsDir = BasePath + @"\\maps"; - public static readonly string MapsDirBase = "maps"; - public static string MapPath = ""; - public static string MapPathSnip = ""; - public static readonly string BaseGameDir = "rbxasset://../../../"; - public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/"; - public static readonly string DirFonts = "\\fonts"; - public static readonly string DirSounds = "\\sounds"; - public static readonly string DirTextures = "\\textures"; - public static readonly string DirScripts = "\\scripts"; - - public static readonly string FontsGameDir = "fonts/"; - public static readonly string SoundsGameDir = "sounds/"; - public static readonly string TexturesGameDir = "textures/"; - public static readonly string ScriptsGameDir = "scripts/"; - //customization - public static readonly string CustomPlayerDir = DataPath + "\\charcustom"; - public static readonly string hatdir = CustomPlayerDir + "\\hats"; - public static readonly string facedir = CustomPlayerDir + "\\faces"; - public static readonly string headdir = CustomPlayerDir + "\\heads"; - public static readonly string tshirtdir = CustomPlayerDir + "\\tshirts"; - public static readonly string shirtdir = CustomPlayerDir + "\\shirts"; - public static readonly string pantsdir = CustomPlayerDir + "\\pants"; - public static readonly string extradir = CustomPlayerDir + "\\custom"; - - public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/"; - public static readonly string hatGameDir = CharCustomGameDir + "hats/"; - public static readonly string faceGameDir = CharCustomGameDir + "faces/"; - public static readonly string headGameDir = CharCustomGameDir + "heads/"; - public static readonly string tshirtGameDir = CharCustomGameDir + "tshirts/"; - public static readonly string shirtGameDir = CharCustomGameDir + "shirts/"; - public static readonly string pantsGameDir = CharCustomGameDir + "pants/"; - public static readonly string extraGameDir = CharCustomGameDir + "custom/"; - - //item asset dirs - public static readonly string hatdirFonts = hatdir + DirFonts; - public static readonly string hatdirTextures = hatdir + DirTextures; - public static readonly string hatdirSounds = hatdir + DirSounds; - public static readonly string hatdirScripts = hatdir + DirScripts; - public static readonly string facedirTextures = facedir + DirTextures; - public static readonly string headdirFonts = headdir + DirFonts; - public static readonly string headdirTextures = headdir + DirTextures; - public static readonly string tshirtdirTextures = tshirtdir + DirTextures; - public static readonly string shirtdirTextures = shirtdir + DirTextures; - public static readonly string pantsdirTextures = pantsdir + DirTextures; - public static readonly string extradirIcons = extradir + "\\icons"; - - public static readonly string hatGameDirFonts = hatGameDir + FontsGameDir; - public static readonly string hatGameDirTextures = hatGameDir + TexturesGameDir; - public static readonly string hatGameDirSounds = hatGameDir + SoundsGameDir; - public static readonly string hatGameDirScripts = hatGameDir + ScriptsGameDir; - public static readonly string faceGameDirTextures = faceGameDir + TexturesGameDir; - public static readonly string headGameDirFonts = headGameDir + FontsGameDir; - public static readonly string headGameDirTextures = headGameDir + TexturesGameDir; - public static readonly string tshirtGameDirTextures = tshirtGameDir + TexturesGameDir; - public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir; - public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir; - //asset cache - public static readonly string AssetCacheDir = DataPath + "\\assetcache"; - - public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky"; - public static readonly string AssetCacheDirFonts = AssetCacheDir + DirFonts; - public static readonly string AssetCacheDirSounds = AssetCacheDir + DirSounds; - public static readonly string AssetCacheDirTextures = AssetCacheDir + DirTextures; - public static readonly string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui"; - public static readonly string AssetCacheDirScripts = AssetCacheDir + DirScripts; - - public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/"; - public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir; - public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/"; - public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + SoundsGameDir; - public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir; - public static readonly string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/"; - public static readonly string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir; - - //defs - public static AssetCacheDef Fonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { AssetCacheDirFonts, AssetCacheDirTextures }, new string[] { AssetCacheFontsGameDir, AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Sky { get { return new AssetCacheDef("Sky", new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, new string[] { ".png" }, new string[] { AssetCacheDirSky }, new string[] { AssetCacheSkyGameDir }); } } - public static AssetCacheDef Decal { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Texture { get { return new AssetCacheDef("Texture", new string[] { "Texture" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef HopperBin { get { return new AssetCacheDef("HopperBin", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Tool { get { return new AssetCacheDef("Tool", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Sound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { AssetCacheDirSounds }, new string[] { AssetCacheSoundsGameDir }); } } - public static AssetCacheDef ImageLabel { get { return new AssetCacheDef("ImageLabel", new string[] { "Image" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Shirt { get { return new AssetCacheDef("Shirt", new string[] { "ShirtTemplate" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef ShirtGraphic { get { return new AssetCacheDef("ShirtGraphic", new string[] { "Graphic" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Pants { get { return new AssetCacheDef("Pants", new string[] { "PantsTemplate" }, new string[] { ".png" }, new string[] { AssetCacheDirTextures }, new string[] { AssetCacheTexturesGameDir }); } } - public static AssetCacheDef Script { get { return new AssetCacheDef("Script", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { AssetCacheDirScripts }, new string[] { AssetCacheScriptsGameDir }); } } - public static AssetCacheDef LocalScript { get { return new AssetCacheDef("LocalScript", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { AssetCacheDirScripts }, new string[] { AssetCacheScriptsGameDir }); } } - //item defs below - public static AssetCacheDef ItemHatFonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { hatdirFonts, hatdirTextures }, new string[] { hatGameDirFonts, hatGameDirTextures }); } } - public static AssetCacheDef ItemHatSound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { hatdirSounds }, new string[] { hatGameDirSounds }); } } - public static AssetCacheDef ItemHatScript { get { return new AssetCacheDef("Script", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { hatdirScripts }, new string[] { hatGameDirScripts }); } } - public static AssetCacheDef ItemHatLocalScript { get { return new AssetCacheDef("LocalScript", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { hatdirScripts }, new string[] { hatGameDirScripts }); } } - public static AssetCacheDef ItemHeadFonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { headdirFonts, headdirTextures }, new string[] { headGameDirFonts, headGameDirTextures }); } } - public static AssetCacheDef ItemFaceTexture { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { facedirTextures }, new string[] { faceGameDirTextures }); } } - public static AssetCacheDef ItemShirtTexture { get { return new AssetCacheDef("Shirt", new string[] { "ShirtTemplate" }, new string[] { ".png" }, new string[] { shirtdirTextures }, new string[] { shirtGameDirTextures }); } } - public static AssetCacheDef ItemTShirtTexture { get { return new AssetCacheDef("ShirtGraphic", new string[] { "Graphic" }, new string[] { ".png" }, new string[] { tshirtdirTextures }, new string[] { tshirtGameDirTextures }); } } - public static AssetCacheDef ItemPantsTexture { get { return new AssetCacheDef("Pants", new string[] { "PantsTemplate" }, new string[] { ".png" }, new string[] { pantsdirTextures }, new string[] { pantsGameDirTextures }); } } - - public static string IP = "localhost"; - public static string Version = ""; - public static string Branch = ""; - public static string SharedArgs = ""; - public static readonly string ScriptName = "CSMPFunctions"; - public static readonly string ScriptGenName = "CSMPBoot"; - public static SimpleHTTPServer WebServer = null; - //public static NetManager WebServerUDPInstance = null; - public static bool IsWebServerOn = false; - public static bool IsSnapshot = false; - //vars for loader - public static bool ReadyToLaunch = false; - //server settings. - public static bool UPnP = false; - //public static bool UDP = true; - public static string Map = ""; - public static string FullMapPath = ""; - public static int RobloxPort = 53640; - public static int DefaultRobloxPort = 53640; - public static int WebServer_Port = 40735; - public static int PlayerLimit = 12; - //player settings - public static int UserID = 0; - public static string PlayerName = "Player"; - public static string PlayerTripcode = ""; - //config name - public static readonly string ConfigName = "config.ini"; - public static string ConfigNameCustomization = "config_customization.ini"; - public static readonly string InfoName = "info.txt"; - //launcher settings. - public static bool CloseOnLaunch = false; - public static bool LocalPlayMode = false; - public static bool OldLayout = false; - //client shit - public static string SelectedClient = ""; - public static ClientInfo SelectedClientInfo = new ClientInfo(); - public static string AddonScriptPath = ""; - //info shit - public static string DefaultClient = ""; - public static string RegisterClient1 = ""; - public static string RegisterClient2 = ""; - public static string DefaultMap = ""; - //charcustom - public static CustomizationConfig UserCustomization = new CustomizationConfig(); - public static string loadtext = ""; - public static string sololoadtext = ""; - //color menu. - public static bool AdminMode = false; - public static string important = ""; - //discord - public static bool DiscordPresence = true; - public static DiscordRpc.RichPresence presence; - public static string appid = "505955125727330324"; - public static string imagekey_large = "novetus_large"; - public static string image_ingame = "ingame_small"; - public static string image_inlauncher = "inlauncher_small"; - public static string image_instudio = "instudio_small"; - public static string image_incustomization = "incustomization_small"; - //webserver - public static string WebServerURI = "http://" + IP + ":" + (WebServer_Port).ToString(); - public static string LocalWebServerURI = "http://localhost:" + (WebServer_Port).ToString(); - public static string WebServer_CustomPlayerDir = WebServerURI + "/charcustom/"; - public static string WebServer_HatDir = WebServer_CustomPlayerDir + "hats/"; - public static string WebServer_FaceDir = WebServer_CustomPlayerDir + "faces/"; - public static string WebServer_HeadDir = WebServer_CustomPlayerDir + "heads/"; - public static string WebServer_TShirtDir = WebServer_CustomPlayerDir + "tshirts/"; - public static string WebServer_ShirtDir = WebServer_CustomPlayerDir + "shirts/"; - public static string WebServer_PantsDir = WebServer_CustomPlayerDir + "pants/"; - public static string WebServer_ExtraDir = WebServer_CustomPlayerDir + "custom/"; - //itemmaker - public static bool DisabledHelp = false; - //reshade - public static bool ReShade = false; - public static bool ReShadeFPSDisplay = false; - public static bool ReShadePerformanceMode = false; - //video - public static GraphicsMode GraphicsMode = GraphicsMode.OpenGL; - public static QualityLevel QualityLevel = QualityLevel.Ultra; - - public static string MultiLine(params string[] args) - { - return string.Join(Environment.NewLine, args); - } - - public static string RemoveEmptyLines(string lines) - { - return Regex.Replace(lines, @"^\s*$\n|\r", string.Empty, RegexOptions.Multiline).TrimEnd(); - } - - public static bool ProcessExists(int id) - { - return Process.GetProcesses().Any(x => x.Id == id); - } - - //task.delay is only available on net 4.5....... - public static async void Delay(int miliseconds) - { - await TaskEx.Delay(miliseconds); - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/IconLoader.cs b/NovetusLauncher/NovetusFuncs/IconLoader.cs deleted file mode 100644 index bab7456..0000000 --- a/NovetusLauncher/NovetusFuncs/IconLoader.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; - -public class IconLoader -{ - private OpenFileDialog openFileDialog1; - private string installOutcome = ""; - - public IconLoader() - { - openFileDialog1 = new OpenFileDialog() - { - FileName = "Select an icon .png file", - Filter = "Portable Network Graphics image (*.png)|*.png", - Title = "Open icon .png" - }; - } - - public void setInstallOutcome(string text) - { - installOutcome = text; - } - - public string getInstallOutcome() - { - return installOutcome; - } - - public void LoadImage() - { - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - try - { - using (Stream str = openFileDialog1.OpenFile()) - { - using (Stream output = new FileStream(GlobalVars.extradir + "\\icons\\" + GlobalVars.PlayerName + ".png", FileMode.Create)) - { - byte[] buffer = new byte[32 * 1024]; - int read; - - while ((read = str.Read(buffer, 0, buffer.Length)) > 0) - { - output.Write(buffer, 0, read); - } - } - - str.Close(); - } - - installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!"; - } - catch (Exception ex) when (!Env.Debugging) - { - installOutcome = "Error when installing icon: " + ex.Message; - } - } - } -} diff --git a/NovetusLauncher/NovetusFuncs/IniFile.cs b/NovetusLauncher/NovetusFuncs/IniFile.cs deleted file mode 100644 index 5ca9f5d..0000000 --- a/NovetusLauncher/NovetusFuncs/IniFile.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:04 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System.Text; -using System.Runtime.InteropServices; -using System; - -//credit to BLaZiNiX -public class IniFile -{ - public string path; - - [DllImport("kernel32")] - private static extern long WritePrivateProfileString(string section, - string key, string val, string filePath); - [DllImport("kernel32")] - private static extern int GetPrivateProfileString(string section, - string key, string def, StringBuilder retVal, - int size, string filePath); - - /// - /// INIFile Constructor. - /// - /// - public IniFile(string INIPath) - { - path = INIPath; - } - /// - /// Write Data to the INI File - /// - /// - /// Section name - /// - /// Key Name - /// - /// Value Name - public void IniWriteValue(string Section, string Key, string Value) - { - WritePrivateProfileString(Section, Key, Value, this.path); - } - - /// - /// Read Data Value From the Ini File - /// - /// - /// - /// - /// - public string IniReadValue(string Section, string Key, string DefaultValue = "") - { - try - { - StringBuilder temp = new StringBuilder(255); - int i = GetPrivateProfileString(Section, Key, "", temp, - 255, this.path); - return temp.ToString(); - } - catch (Exception) - { - IniWriteValue(Section, Key, DefaultValue); - return IniReadValue(Section, Key); - } - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/NetFuncs.cs b/NovetusLauncher/NovetusFuncs/NetFuncs.cs deleted file mode 100644 index 50d615e..0000000 --- a/NovetusLauncher/NovetusFuncs/NetFuncs.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:03 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -//using LiteNetLib; -using Mono.Nat; - -public static class UPnP -{ - public static void InitUPnP(EventHandler DeviceFound, EventHandler DeviceLost) - { - if (GlobalVars.UPnP == true) - { - NatUtility.DeviceFound += DeviceFound; - NatUtility.DeviceLost += DeviceLost; - NatUtility.StartDiscovery(); - } - } - - public static void StartUPnP(INatDevice device, Protocol protocol, int port) - { - if (GlobalVars.UPnP == true) - { - Mapping checker = device.GetSpecificMapping(protocol, port); - int mapPublic = checker.PublicPort; - int mapPrivate = checker.PrivatePort; - - if (mapPublic == -1 && mapPrivate == -1) - { - Mapping portmap = new Mapping(protocol, port, port); - portmap.Description = "Novetus"; - device.CreatePortMap(portmap); - } - } - } - - public static void StopUPnP(INatDevice device, Protocol protocol, int port) - { - if (GlobalVars.UPnP == true) - { - Mapping checker = device.GetSpecificMapping(protocol, port); - int mapPublic = checker.PublicPort; - int mapPrivate = checker.PrivatePort; - - if (mapPublic != -1 && mapPrivate != -1) - { - Mapping portmap = new Mapping(protocol, port, port); - portmap.Description = "Novetus"; - device.DeletePortMap(portmap); - } - } - } -} - -/* -public static class UDP -{ - private static NetManager StartUDPListener(int port = -1) - { - if (GlobalVars.UDP == true) - { - EventBasedNetListener listener = new EventBasedNetListener(); - NetManager list = new NetManager(listener); - if (port > -1) - { - list.Start(port); - } - else - { - list.Start(); - } - - return list; - } - - return null; - } - - public static NetManager StartClient(string ip, int port) - { - if (GlobalVars.UDP == true) - { - //we don't need a port here, we are a client. - NetManager client = StartUDPListener(); - EventBasedNatPunchListener natPunchListener = new EventBasedNatPunchListener(); - client.Connect(ip, port, ""); - client.NatPunchEnabled = true; - client.NatPunchModule.Init(natPunchListener); - return client; - } - - return null; - } - - public static NetManager StartServer(int port) - { - if (GlobalVars.UDP == true) - { - NetManager server = StartUDPListener(port); - EventBasedNatPunchListener natPunchListener = new EventBasedNatPunchListener(); - server.NatPunchEnabled = true; - server.NatPunchModule.Init(natPunchListener); - return server; - } - - return null; - } -}*/ \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/CodeExtensions.cs b/NovetusLauncher/NovetusFuncs/NovetusCodeExtensions.cs similarity index 93% rename from NovetusLauncher/NovetusFuncs/CodeExtensions.cs rename to NovetusLauncher/NovetusFuncs/NovetusCodeExtensions.cs index c5410a4..c04e243 100644 --- a/NovetusLauncher/NovetusFuncs/CodeExtensions.cs +++ b/NovetusLauncher/NovetusFuncs/NovetusCodeExtensions.cs @@ -1,12 +1,4 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:00 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - +#region Usings using System; using System.Drawing; using System.Windows.Forms; @@ -16,7 +8,9 @@ using System.IO; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; +#endregion +#region Rich Text Box Extensions public static class RichTextBoxExtensions { public static void AppendText(this RichTextBox box, string text, Color color) @@ -29,22 +23,26 @@ public static class RichTextBoxExtensions box.SelectionColor = box.ForeColor; } } - +#endregion + +#region Process Extensions public static class ProcessExtensions { public static bool IsRunning(this Process process) { try { Process.GetProcessById(process.Id); - } catch (InvalidOperationException) when (!Env.Debugging) { + } catch (InvalidOperationException) { return false; - } catch (ArgumentException) when (!Env.Debugging) { + } catch (ArgumentException) { return false; } return true; } } - +#endregion + +#region #String Extensions public static class StringExtensions { public static bool Contains(this string source, string toCheck, StringComparison comp) @@ -54,7 +52,9 @@ public static class StringExtensions return source.IndexOf(toCheck, comp) >= 0; } } +#endregion +#region Array Helper //credit to code4life public static class ArrayHelper { @@ -79,7 +79,9 @@ public static class ArrayHelper return result; } } +#endregion +#region Substring Extensions //dotnetperls static class SubstringExtensions { @@ -137,7 +139,9 @@ static class SubstringExtensions return value.Substring(adjustedPosA); } } +#endregion +#region Tab Control without Header //credit to https://stackoverflow.com/questions/23247941/c-sharp-how-to-remove-tabcontrol-border public partial class TabControlWithoutHeader : TabControl { @@ -175,7 +179,9 @@ public partial class TabControlWithoutHeader : TabControl base.WndProc(ref m); } } +#endregion +#region Form Extensions //https://stackoverflow.com/questions/12422619/can-i-disable-the-close-button-of-a-form-using-c public static class FormExt { @@ -197,7 +203,9 @@ public static class FormExt EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 0); } } +#endregion +#region String Utilities //https://stackoverflow.com/questions/9031537/really-simple-encryption-with-c-sharp-and-symmetricalgorithm public static class StringUtil { @@ -221,4 +229,5 @@ public static class StringUtil byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length); return Encoding.Unicode.GetString(outputBuffer); } -} \ No newline at end of file +} +#endregion \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems b/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems index 2593d5a..1d355a9 100644 --- a/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems +++ b/NovetusLauncher/NovetusFuncs/NovetusFuncs.projitems @@ -9,26 +9,11 @@ NovetusFuncs - - - + + + - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/NovetusGlobalFuncs.cs b/NovetusLauncher/NovetusFuncs/NovetusGlobalFuncs.cs new file mode 100644 index 0000000..05c81ba --- /dev/null +++ b/NovetusLauncher/NovetusFuncs/NovetusGlobalFuncs.cs @@ -0,0 +1,1377 @@ +#region Usings +using Microsoft.Win32; +using Mono.Nat; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Xml; +using System.Xml.Linq; +#endregion + +/* + * Finish classes for: + * + * info + * reshade + * + * change field names for all forms + * Rewrite client launching into one function. + */ + +#region Enums + +#region Quality Level +public enum QualityLevel +{ + VeryLow = 1, + Low = 2, + Medium = 3, + High = 4, + Ultra = 5 +} +#endregion + +#region Graphics Mode +public enum GraphicsMode +{ + None = 0, + OpenGL = 1, + DirectX = 2 +} +#endregion + +#region Roblox File Types +public enum RobloxFileType +{ + //RBXL and RBXM + RBXL, + RBXM, + //Items + Hat, + Head, + Face, + TShirt, + Shirt, + Pants +} +#endregion + +#endregion + +#region Classes + +#region Definition Classes + +#region GlobalVars +public static class GlobalVars +{ + public static Config UserConfiguration = new Config(); + public static string IP = "localhost"; + public static string Version = ""; + public static string Branch = ""; + public static string SharedArgs = ""; + public static readonly string ScriptName = "CSMPFunctions"; + public static readonly string ScriptGenName = "CSMPBoot"; + public static SimpleHTTPServer WebServer = null; + public static bool IsWebServerOn = false; + public static bool IsSnapshot = false; + //misc vars + public static string FullMapPath = ""; + //weebserver + public static int WebServerPort = 40735; + public static string LocalWebServerURI = "http://localhost:" + (WebServerPort).ToString(); + public static string WebServerURI = "http://" + IP + ":" + (WebServerPort).ToString(); + //config name + public static readonly string ConfigName = "config.ini"; + public static string ConfigNameCustomization = "config_customization.ini"; + public static readonly string InfoName = "info.txt"; + //client shit + public static ClientInfo SelectedClientInfo = new ClientInfo(); + public static string AddonScriptPath = ""; + //info shit + public static string DefaultClient = ""; + public static string RegisterClient1 = ""; + public static string RegisterClient2 = ""; + public static string DefaultMap = ""; + //charcustom + public static CustomizationConfig UserCustomization = new CustomizationConfig(); + public static string loadtext = ""; + public static string sololoadtext = ""; + //color menu. + public static bool AdminMode = false; + public static string important = ""; + //discord + public static DiscordRpc.RichPresence presence; + public static string appid = "505955125727330324"; + public static string imagekey_large = "novetus_large"; + public static string image_ingame = "ingame_small"; + public static string image_inlauncher = "inlauncher_small"; + public static string image_instudio = "instudio_small"; + public static string image_incustomization = "incustomization_small"; + //reshade + public static bool ReShadeFPSDisplay = false; + public static bool ReShadePerformanceMode = false; + + public static string MultiLine(params string[] args) + { + return string.Join(Environment.NewLine, args); + } + + public static string RemoveEmptyLines(string lines) + { + return Regex.Replace(lines, @"^\s*$\n|\r", string.Empty, RegexOptions.Multiline).TrimEnd(); + } + + public static bool ProcessExists(int id) + { + return Process.GetProcesses().Any(x => x.Id == id); + } + + //task.delay is only available on net 4.5....... + public static async void Delay(int miliseconds) + { + await TaskEx.Delay(miliseconds); + } +} +#endregion + +#region Directories +public class Directories +{ + public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\"); + public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString(); + public static readonly string BasePath = RootPath.Replace(@"\", @"\\"); + public static readonly string DataPath = BasePath + @"\\shareddata"; + public static readonly string ServerDir = DataPath + "\\server"; + public static readonly string ConfigDir = BasePath + @"\\config"; + public static readonly string ConfigDirData = BasePathLauncher + @"\\data"; + public static readonly string ClientDir = BasePath + @"\\clients"; + public static readonly string MapsDir = BasePath + @"\\maps"; + public static readonly string MapsDirBase = "maps"; + public static readonly string BaseGameDir = "rbxasset://../../../"; + public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/"; + public static readonly string DirFonts = "\\fonts"; + public static readonly string DirSounds = "\\sounds"; + public static readonly string DirTextures = "\\textures"; + public static readonly string DirScripts = "\\scripts"; + + public static readonly string FontsGameDir = "fonts/"; + public static readonly string SoundsGameDir = "sounds/"; + public static readonly string TexturesGameDir = "textures/"; + public static readonly string ScriptsGameDir = "scripts/"; + //customization + public static readonly string CustomPlayerDir = DataPath + "\\charcustom"; + public static readonly string hatdir = CustomPlayerDir + "\\hats"; + public static readonly string facedir = CustomPlayerDir + "\\faces"; + public static readonly string headdir = CustomPlayerDir + "\\heads"; + public static readonly string tshirtdir = CustomPlayerDir + "\\tshirts"; + public static readonly string shirtdir = CustomPlayerDir + "\\shirts"; + public static readonly string pantsdir = CustomPlayerDir + "\\pants"; + public static readonly string extradir = CustomPlayerDir + "\\custom"; + + public static readonly string CharCustomGameDir = SharedDataGameDir + "charcustom/"; + public static readonly string hatGameDir = CharCustomGameDir + "hats/"; + public static readonly string faceGameDir = CharCustomGameDir + "faces/"; + public static readonly string headGameDir = CharCustomGameDir + "heads/"; + public static readonly string tshirtGameDir = CharCustomGameDir + "tshirts/"; + public static readonly string shirtGameDir = CharCustomGameDir + "shirts/"; + public static readonly string pantsGameDir = CharCustomGameDir + "pants/"; + public static readonly string extraGameDir = CharCustomGameDir + "custom/"; + //item asset dirs + public static readonly string hatdirFonts = hatdir + DirFonts; + public static readonly string hatdirTextures = hatdir + DirTextures; + public static readonly string hatdirSounds = hatdir + DirSounds; + public static readonly string hatdirScripts = hatdir + DirScripts; + public static readonly string facedirTextures = facedir + DirTextures; + public static readonly string headdirFonts = headdir + DirFonts; + public static readonly string headdirTextures = headdir + DirTextures; + public static readonly string tshirtdirTextures = tshirtdir + DirTextures; + public static readonly string shirtdirTextures = shirtdir + DirTextures; + public static readonly string pantsdirTextures = pantsdir + DirTextures; + public static readonly string extradirIcons = extradir + "\\icons"; + + public static readonly string hatGameDirFonts = hatGameDir + FontsGameDir; + public static readonly string hatGameDirTextures = hatGameDir + TexturesGameDir; + public static readonly string hatGameDirSounds = hatGameDir + SoundsGameDir; + public static readonly string hatGameDirScripts = hatGameDir + ScriptsGameDir; + public static readonly string faceGameDirTextures = faceGameDir + TexturesGameDir; + public static readonly string headGameDirFonts = headGameDir + FontsGameDir; + public static readonly string headGameDirTextures = headGameDir + TexturesGameDir; + public static readonly string tshirtGameDirTextures = tshirtGameDir + TexturesGameDir; + public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir; + public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir; + //asset cache + public static readonly string AssetCacheDir = DataPath + "\\assetcache"; + + public static readonly string AssetCacheDirSky = AssetCacheDir + "\\sky"; + public static readonly string AssetCacheDirFonts = AssetCacheDir + DirFonts; + public static readonly string AssetCacheDirSounds = AssetCacheDir + DirSounds; + public static readonly string AssetCacheDirTextures = AssetCacheDir + DirTextures; + public static readonly string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui"; + public static readonly string AssetCacheDirScripts = AssetCacheDir + DirScripts; + + public static readonly string AssetCacheGameDir = SharedDataGameDir + "assetcache/"; + public static readonly string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir; + public static readonly string AssetCacheSkyGameDir = AssetCacheGameDir + "sky/"; + public static readonly string AssetCacheSoundsGameDir = AssetCacheGameDir + SoundsGameDir; + public static readonly string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir; + public static readonly string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/"; + public static readonly string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir; + //webserver + public static string WebServer_CustomPlayerDir = GlobalVars.WebServerURI + "/charcustom/"; + public static string WebServer_HatDir = WebServer_CustomPlayerDir + "hats/"; + public static string WebServer_FaceDir = WebServer_CustomPlayerDir + "faces/"; + public static string WebServer_HeadDir = WebServer_CustomPlayerDir + "heads/"; + public static string WebServer_TShirtDir = WebServer_CustomPlayerDir + "tshirts/"; + public static string WebServer_ShirtDir = WebServer_CustomPlayerDir + "shirts/"; + public static string WebServer_PantsDir = WebServer_CustomPlayerDir + "pants/"; + public static string WebServer_ExtraDir = WebServer_CustomPlayerDir + "custom/"; +} +#endregion + +#endregion + +#region Variable Storage Classes + +#region Asset Cache Definition +public class AssetCacheDef +{ + public AssetCacheDef(string clas, string[] id, string[] ext, + string[] dir, string[] gamedir) + { + Class = clas; + Id = id; + Ext = ext; + Dir = dir; + GameDir = gamedir; + } + + public string Class { get; set; } + public string[] Id { get; set; } + public string[] Ext { get; set; } + public string[] Dir { get; set; } + public string[] GameDir { get; set; } +} +#endregion + +#region Client Information +public class ClientInfo +{ + public ClientInfo() + { + UsesPlayerName = false; + UsesID = true; + Description = ""; + Warning = ""; + LegacyMode = false; + ClientMD5 = ""; + ScriptMD5 = ""; + Fix2007 = false; + AlreadyHasSecurity = false; + NoGraphicsOptions = false; + CommandLineArgs = ""; + } + + public bool UsesPlayerName { get; set; } + public bool UsesID { get; set; } + public string Description { get; set; } + public string Warning { get; set; } + public bool LegacyMode { get; set; } + public string ClientMD5 { get; set; } + public string ScriptMD5 { get; set; } + public bool Fix2007 { get; set; } + public bool AlreadyHasSecurity { get; set; } + public bool NoGraphicsOptions { get; set; } + public string CommandLineArgs { get; set; } +} +#endregion + +#region Configuration +public class Config +{ + public Config() + { + SelectedClient = ""; + Map = ""; + CloseOnLaunch = false; + UserID = 0; + PlayerName = "Player"; + PlayerTripcode = ""; + RobloxPort = 53640; + PlayerLimit = 12; + UPnP = false; + DisabledItemMakerHelp = false; + DiscordPresence = true; + MapPath = ""; + MapPathSnip = ""; + GraphicsMode = GraphicsMode.OpenGL; + ReShade = false; + QualityLevel = QualityLevel.Ultra; + OldLayout = false; + } + + public string SelectedClient { get; set; } + public string Map { get; set; } + public bool CloseOnLaunch { get; set; } + public int UserID { get; set; } + public string PlayerName { get; set; } + public string PlayerTripcode { get; set; } + public int RobloxPort { get; set; } + public int PlayerLimit { get; set; } + public bool UPnP { get; set; } + public bool DisabledItemMakerHelp { get; set; } + public bool DiscordPresence { get; set; } + public string MapPath { get; set; } + public string MapPathSnip { get; set; } + public GraphicsMode GraphicsMode { get; set; } + public bool ReShade { get; set; } + public QualityLevel QualityLevel { get; set; } + public bool OldLayout { get; set; } +} +#endregion + +#region Customization Configuration +public class CustomizationConfig +{ + public CustomizationConfig() + { + Hat1 = "NoHat.rbxm"; + Hat2 = "NoHat.rbxm"; + Hat3 = "NoHat.rbxm"; + Face = "DefaultFace.rbxm"; + Head = "DefaultHead.rbxm"; + TShirt = "NoTShirt.rbxm"; + Shirt = "NoShirt.rbxm"; + Pants = "NoPants.rbxm"; + Icon = "NBC"; + Extra = "NoExtra.rbxm"; + HeadColorID = 24; + TorsoColorID = 23; + LeftArmColorID = 24; + RightArmColorID = 24; + LeftLegColorID = 119; + RightLegColorID = 119; + HeadColorString = "Color [A=255, R=245, G=205, B=47]"; + TorsoColorString = "Color [A=255, R=13, G=105, B=172]"; + LeftArmColorString = "Color [A=255, R=245, G=205, B=47]"; + RightArmColorString = "Color [A=255, R=245, G=205, B=47]"; + LeftLegColorString = "Color [A=255, R=164, G=189, B=71]"; + RightLegColorString = "Color [A=255, R=164, G=189, B=71]"; + ExtraSelectionIsHat = false; + ShowHatsInExtra = false; + CharacterID = ""; + } + + public string Hat1 { get; set; } + public string Hat2 { get; set; } + public string Hat3 { get; set; } + public string Face { get; set; } + public string Head { get; set; } + public string TShirt { get; set; } + public string Shirt { get; set; } + public string Pants { get; set; } + public string Icon { get; set; } + public string Extra { get; set; } + public int HeadColorID { get; set; } + public int TorsoColorID { get; set; } + public int LeftArmColorID { get; set; } + public int RightArmColorID { get; set; } + public int LeftLegColorID { get; set; } + public int RightLegColorID { get; set; } + public string HeadColorString { get; set; } + public string TorsoColorString { get; set; } + public string LeftArmColorString { get; set; } + public string RightArmColorString { get; set; } + public string LeftLegColorString { get; set; } + public string RightLegColorString { get; set; } + public bool ExtraSelectionIsHat { get; set; } + public bool ShowHatsInExtra { get; set; } + public string CharacterID { get; set; } +} +#endregion + +#region Program Information (WIP) +public class ProgramInfo +{ + public ProgramInfo() + { + + } +} +#endregion + +#region ReShade Configuration (WIP) +public class ReShadeConfig +{ + public ReShadeConfig() + { + + } +} +#endregion + +#region Part Colors +public class PartColors +{ + public int ColorID { get; set; } + public Color ButtonColor { get; set; } +} + +#endregion + +#region Discord RPC +public class DiscordRpc +{ + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ReadyCallback(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void DisconnectedCallback(int errorCode, string message); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ErrorCallback(int errorCode, string message); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void JoinCallback(string secret); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void SpectateCallback(string secret); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void RequestCallback(JoinRequest request); + + public struct EventHandlers + { + public ReadyCallback readyCallback; + public DisconnectedCallback disconnectedCallback; + public ErrorCallback errorCallback; + public JoinCallback joinCallback; + public SpectateCallback spectateCallback; + public RequestCallback requestCallback; + } + + [System.Serializable] + public struct RichPresence + { + public string state; + /* max 128 bytes */ + public string details; + /* max 128 bytes */ + public long startTimestamp; + public long endTimestamp; + public string largeImageKey; + /* max 32 bytes */ + public string largeImageText; + /* max 128 bytes */ + public string smallImageKey; + /* max 32 bytes */ + public string smallImageText; + /* max 128 bytes */ + public string partyId; + /* max 128 bytes */ + public int partySize; + public int partyMax; + public string matchSecret; + /* max 128 bytes */ + public string joinSecret; + /* max 128 bytes */ + public string spectateSecret; + /* max 128 bytes */ + public bool instance; + } + + [System.Serializable] + public struct JoinRequest + { + public string userId; + public string username; + public string avatar; + } + + public enum Reply + { + No = 0, + Yes = 1, + Ignore = 2 + } + [DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)] + public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId); + + [DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)] + public static extern void Shutdown(); + + [DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)] + public static extern void RunCallbacks(); + + [DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)] + public static extern void UpdatePresence(ref RichPresence presence); + + [DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)] + public static extern void Respond(string userId, Reply reply); +} +#endregion + +#endregion + +#region Function Classes + +#region UPNP +public static class UPnP +{ + public static void InitUPnP(EventHandler DeviceFound, EventHandler DeviceLost) + { + if (GlobalVars.UserConfiguration.UPnP == true) + { + NatUtility.DeviceFound += DeviceFound; + NatUtility.DeviceLost += DeviceLost; + NatUtility.StartDiscovery(); + } + } + + public static void StartUPnP(INatDevice device, Protocol protocol, int port) + { + if (GlobalVars.UserConfiguration.UPnP == true) + { + Mapping checker = device.GetSpecificMapping(protocol, port); + int mapPublic = checker.PublicPort; + int mapPrivate = checker.PrivatePort; + + if (mapPublic == -1 && mapPrivate == -1) + { + Mapping portmap = new Mapping(protocol, port, port); + portmap.Description = "Novetus"; + device.CreatePortMap(portmap); + } + } + } + + public static void StopUPnP(INatDevice device, Protocol protocol, int port) + { + if (GlobalVars.UserConfiguration.UPnP == true) + { + Mapping checker = device.GetSpecificMapping(protocol, port); + int mapPublic = checker.PublicPort; + int mapPrivate = checker.PrivatePort; + + if (mapPublic != -1 && mapPrivate != -1) + { + Mapping portmap = new Mapping(protocol, port, port); + portmap.Description = "Novetus"; + device.DeletePortMap(portmap); + } + } + } +} +#endregion + +#region URI Registration +//code based off https://stackoverflow.com/questions/35626050/registering-custom-url-handler-in-c-sharp-on-windows-8 +public class URIReg +{ + private static string _Protocol = ""; + private static string _ProtocolHandler = ""; + + private static readonly string _launch = string.Format( + "{0}{1}{0} {0}%1{0}", (char)34, Application.ExecutablePath); + + private static readonly Version _win8Version = new Version(6, 2, 9200, 0); + + private static readonly bool _isWin8 = + Environment.OSVersion.Platform == PlatformID.Win32NT && + Environment.OSVersion.Version >= _win8Version; + + public URIReg(string protocol, string protocolhandle) + { + _Protocol = protocol; + _ProtocolHandler = protocolhandle; + } + + public void Register() + { + if (_isWin8) RegisterWin8(); + else RegisterWin7(); + } + + private static void RegisterWin7() + { + var regKey = Registry.ClassesRoot.CreateSubKey(_Protocol); + + regKey.CreateSubKey("DefaultIcon") + .SetValue(null, string.Format("{0}{1},1{0}", (char)34, + Application.ExecutablePath)); + + regKey.SetValue(null, "URL:" + _Protocol + " Protocol"); + regKey.SetValue("URL Protocol", ""); + + regKey = regKey.CreateSubKey(@"shell\open\command"); + regKey.SetValue(null, _launch); + } + + private static void RegisterWin8() + { + RegisterWin7(); + + var regKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes") + .CreateSubKey(_ProtocolHandler); + + regKey.SetValue(null, _Protocol); + + regKey.CreateSubKey("DefaultIcon") + .SetValue(null, string.Format("{0}{1},1{0}", (char)34, + Application.ExecutablePath)); + + regKey.CreateSubKey(@"shell\open\command").SetValue(null, _launch); + + Registry.LocalMachine.CreateSubKey(string.Format( + @"SOFTWARE\{0}\{1}\Capabilities\ApplicationDescription\URLAssociations", + Application.CompanyName, Application.ProductName)) + .SetValue(_Protocol, _ProtocolHandler); + + Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications") + .SetValue(Application.ProductName, string.Format( + @"SOFTWARE\{0}\Capabilities", Application.ProductName)); + } + + public void Unregister() + { + if (!_isWin8) + { + Registry.ClassesRoot.DeleteSubKeyTree(_Protocol, false); + return; + } + + // extra work required. + Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes") + .DeleteSubKeyTree(_ProtocolHandler, false); + + Registry.LocalMachine.DeleteSubKeyTree(string.Format(@"SOFTWARE\{0}\{1}", + Application.CompanyName, Application.ProductName)); + + Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications") + .DeleteValue(Application.ProductName); + } +} +#endregion + +#region INI File Parser +//credit to BLaZiNiX +public class IniFile +{ + public string path; + + [DllImport("kernel32")] + private static extern long WritePrivateProfileString(string section, + string key, string val, string filePath); + [DllImport("kernel32")] + private static extern int GetPrivateProfileString(string section, + string key, string def, StringBuilder retVal, + int size, string filePath); + + /// + /// INIFile Constructor. + /// + /// + public IniFile(string INIPath) + { + path = INIPath; + } + /// + /// Write Data to the INI File + /// + /// + /// Section name + /// + /// Key Name + /// + /// Value Name + public void IniWriteValue(string Section, string Key, string Value) + { + WritePrivateProfileString(Section, Key, Value, this.path); + } + + /// + /// Read Data Value From the Ini File + /// + /// + /// + /// + /// + public string IniReadValue(string Section, string Key, string DefaultValue = "") + { + try + { + StringBuilder temp = new StringBuilder(255); + int i = GetPrivateProfileString(Section, Key, "", temp, + 255, this.path); + return temp.ToString(); + } + catch (Exception) + { + IniWriteValue(Section, Key, DefaultValue); + return IniReadValue(Section, Key); + } + } +} +#endregion + +#region CryptoRandom +public class CryptoRandom : RandomNumberGenerator +{ + private static RandomNumberGenerator r; + + public CryptoRandom() + { + r = Create(); + } + + ///An array of bytes to contain random numbers. + public override void GetBytes(byte[] buffer) + { + r.GetBytes(buffer); + } + + public override void GetNonZeroBytes(byte[] data) + { + r.GetNonZeroBytes(data); + } + public double NextDouble() + { + byte[] b = new byte[4]; + r.GetBytes(b); + return (double)BitConverter.ToUInt32(b, 0) / UInt32.MaxValue; + } + + ///The inclusive lower bound of the random number returned. + ///The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue. + public int Next(int minValue, int maxValue) + { + return (int)Math.Round(NextDouble() * (maxValue - minValue - 1)) + minValue; + } + public int Next() + { + return Next(0, int.MaxValue); + } + + ///The inclusive upper bound of the random number returned. maxValue must be greater than or equal 0 + public int Next(int maxValue) + { + return Next(0, maxValue); + } +} +#endregion + +#region Tree Node Helper +public static class TreeNodeHelper +{ + public static void ListDirectory(TreeView treeView, string path, string filter = ".*") + { + treeView.Nodes.Clear(); + var rootDirectoryInfo = new DirectoryInfo(path); + treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo, filter)); + } + + public static TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo, string filter = ".*") + { + var directoryNode = new TreeNode(directoryInfo.Name); + foreach (var directory in directoryInfo.GetDirectories()) + directoryNode.Nodes.Add(CreateDirectoryNode(directory, filter)); + foreach (var file in directoryInfo.GetFiles("*" + filter)) + directoryNode.Nodes.Add(new TreeNode(file.Name)); + return directoryNode; + } + + //https://stackoverflow.com/questions/42295131/searching-a-treeview-for-a-specific-string + public static TreeNode SearchTreeView(string p_sSearchTerm, TreeNodeCollection p_Nodes) + { + foreach (TreeNode node in p_Nodes) + { + if (node.Text == p_sSearchTerm) + return node; + + if (node.Nodes.Count > 0) + { + TreeNode child = SearchTreeView(p_sSearchTerm, node.Nodes); + if (child != null) + { + return child; + } + } + } + + return null; + } + + public static string GetFolderNameFromPrefix(string source, string seperator = " -") + { + try + { + string result = source.Substring(0, source.IndexOf(seperator)); + + if (Directory.Exists(Directories.MapsDir + @"\\" + result)) + { + return result + @"\\"; + } + else + { + return ""; + } + } + catch (Exception) + { + return ""; + } + } + + public static void CopyNodes(TreeNodeCollection oldcollection, TreeNodeCollection newcollection) + { + foreach (TreeNode node in oldcollection) + { + newcollection.Add((TreeNode)node.Clone()); + } + } + + public static List GetAllNodes(this TreeView _self) + { + List result = new List(); + foreach (TreeNode child in _self.Nodes) + { + result.AddRange(child.GetAllNodes()); + } + return result; + } + + public static List GetAllNodes(this TreeNode _self) + { + List result = new List(); + result.Add(_self); + foreach (TreeNode child in _self.Nodes) + { + result.AddRange(child.GetAllNodes()); + } + return result; + } + + public static List Ancestors(this TreeNode node) + { + return AncestorsInternal(node).Reverse().ToList(); + } + public static List AncestorsAndSelf(this TreeNode node) + { + return AncestorsInternal(node, true).Reverse().ToList(); + } + private static IEnumerable AncestorsInternal(TreeNode node, bool self = false) + { + if (self) + yield return node; + while (node.Parent != null) + { + node = node.Parent; + yield return node; + } + } +} +#endregion + +#region Text Line Remover and Friends +public static class TextLineRemover +{ + public static void RemoveTextLines(IList linesToRemove, string filename, string tempFilename) + { + // Initial values + int lineNumber = 0; + int linesRemoved = 0; + DateTime startTime = DateTime.Now; + + // Read file + using (var sr = new StreamReader(filename)) + { + // Write new file + using (var sw = new StreamWriter(tempFilename)) + { + // Read lines + string line; + while ((line = sr.ReadLine()) != null) + { + lineNumber++; + // Look for text to remove + if (!ContainsString(line, linesToRemove)) + { + // Keep lines that does not match + sw.WriteLine(line); + } + else + { + // Ignore lines that DO match + linesRemoved++; + InvokeOnRemovedLine(new RemovedLineArgs + { + RemovedLine = line, + RemovedLineNumber = lineNumber + }); + } + } + } + } + // Delete original file + File.Delete(filename); + + // ... and put the temp file in its place. + File.Move(tempFilename, filename); + + // Final calculations + DateTime endTime = DateTime.Now; + InvokeOnFinished(new FinishedArgs + { + LinesRemoved = linesRemoved, + TotalLines = lineNumber, + TotalTime = endTime.Subtract(startTime) + }); + } + + private static bool ContainsString(string line, IEnumerable linesToRemove) + { + foreach (var lineToRemove in linesToRemove) + { + if (line.Contains(lineToRemove)) + return true; + } + return false; + } + + public static event RemovedLine OnRemovedLine; + public static event Finished OnFinished; + + public static void InvokeOnFinished(FinishedArgs args) + { + Finished handler = OnFinished; + if (handler != null) + handler(null, args); + } + + public static void InvokeOnRemovedLine(RemovedLineArgs args) + { + RemovedLine handler = OnRemovedLine; + if (handler != null) + handler(null, args); + } +} + +public delegate void Finished(object sender, FinishedArgs args); + +public class FinishedArgs +{ + public int TotalLines { get; set; } + public int LinesRemoved { get; set; } + public TimeSpan TotalTime { get; set; } +} + +public delegate void RemovedLine(object sender, RemovedLineArgs args); + +public class RemovedLineArgs +{ + public string RemovedLine { get; set; } + public int RemovedLineNumber { get; set; } +} +#endregion + +#region Simple HTTP Server +//made by aksakalli +public class SimpleHTTPServer +{ + + private readonly string[] _indexFiles = { + "index.html", + "index.htm", + "index.php", + "default.html", + "default.htm", + "default.php" + }; + + private static IDictionary _mimeTypeMappings = new Dictionary(StringComparer.InvariantCultureIgnoreCase) { + { ".asf", "video/x-ms-asf" }, + { ".asx", "video/x-ms-asf" }, + { ".avi", "video/x-msvideo" }, + { ".bin", "application/octet-stream" }, + { ".cco", "application/x-cocoa" }, + { ".crt", "application/x-x509-ca-cert" }, + { ".css", "text/css" }, + { ".deb", "application/octet-stream" }, + { ".der", "application/x-x509-ca-cert" }, + { ".dll", "application/octet-stream" }, + { ".dmg", "application/octet-stream" }, + { ".ear", "application/java-archive" }, + { ".eot", "application/octet-stream" }, + { ".exe", "application/octet-stream" }, + { ".flv", "video/x-flv" }, + { ".gif", "image/gif" }, + { ".hqx", "application/mac-binhex40" }, + { ".htc", "text/x-component" }, + { ".htm", "text/html" }, + { ".html", "text/html" }, + { ".ico", "image/x-icon" }, + { ".img", "application/octet-stream" }, + { ".iso", "application/octet-stream" }, + { ".jar", "application/java-archive" }, + { ".jardiff", "application/x-java-archive-diff" }, + { ".jng", "image/x-jng" }, + { ".jnlp", "application/x-java-jnlp-file" }, + { ".jpeg", "image/jpeg" }, + { ".jpg", "image/jpeg" }, + { ".js", "application/x-javascript" }, + { ".mml", "text/mathml" }, + { ".mng", "video/x-mng" }, + { ".mov", "video/quicktime" }, + { ".mp3", "audio/mpeg" }, + { ".mpeg", "video/mpeg" }, + { ".mpg", "video/mpeg" }, + { ".msi", "application/octet-stream" }, + { ".msm", "application/octet-stream" }, + { ".msp", "application/octet-stream" }, + { ".pdb", "application/x-pilot" }, + { ".pdf", "application/pdf" }, + { ".pem", "application/x-x509-ca-cert" }, + { ".php", "text/html" }, + { ".pl", "application/x-perl" }, + { ".pm", "application/x-perl" }, + { ".png", "image/png" }, + { ".prc", "application/x-pilot" }, + { ".ra", "audio/x-realaudio" }, + { ".rar", "application/x-rar-compressed" }, + { ".rpm", "application/x-redhat-package-manager" }, + { ".rss", "text/xml" }, + { ".run", "application/x-makeself" }, + { ".sea", "application/x-sea" }, + { ".shtml", "text/html" }, + { ".sit", "application/x-stuffit" }, + { ".swf", "application/x-shockwave-flash" }, + { ".tcl", "application/x-tcl" }, + { ".tk", "application/x-tcl" }, + { ".txt", "text/plain" }, + { ".war", "application/java-archive" }, + { ".wbmp", "image/vnd.wap.wbmp" }, + { ".wmv", "video/x-ms-wmv" }, + { ".xml", "text/xml" }, + { ".xpi", "application/x-xpinstall" }, + { ".zip", "application/zip" }, + }; + private Thread _serverThread; + private string _rootDirectory; + private HttpListener _listener; + private int _port; + + public int Port + { + get { return _port; } + private set { } + } + + /// + /// Construct server with given port. + /// + /// Directory path to serve. + /// Port of the server. + public SimpleHTTPServer(string path, int port) + { + this.Initialize(path, port); + } + + /// + /// Construct server with suitable port. + /// + /// Directory path to serve. + public SimpleHTTPServer(string path) + { + //get an empty port + TcpListener l = new TcpListener(IPAddress.Loopback, 0); + l.Start(); + int port = ((IPEndPoint)l.LocalEndpoint).Port; + l.Stop(); + this.Initialize(path, port); + } + + /// + /// Stop server and dispose all functions. + /// + public void Stop() + { + _serverThread.Abort(); + _listener.Stop(); + GlobalVars.IsWebServerOn = false; + } + + private void Listen() + { + _listener = new HttpListener(); + _listener.Prefixes.Add("http://*:" + _port.ToString() + "/"); + _listener.Start(); + while (true) + { + try + { + HttpListenerContext context = _listener.GetContext(); + Process(context); + } + catch (Exception) + { + + } + } + } + + private string ProcessPhpPage(string phpCompilerPath, string pageFileName) + { + Process proc = new Process(); + proc.StartInfo.FileName = phpCompilerPath; + proc.StartInfo.Arguments = "-d \"display_errors=1\" -d \"error_reporting=E_PARSE\" \"" + pageFileName + "\""; + proc.StartInfo.CreateNoWindow = true; + proc.StartInfo.UseShellExecute = false; + proc.StartInfo.RedirectStandardOutput = true; + proc.StartInfo.RedirectStandardError = true; + proc.Start(); + string res = proc.StandardOutput.ReadToEnd(); + proc.StandardOutput.Close(); + proc.Close(); + return res; + } + + private void Process(HttpListenerContext context) + { + string filename = context.Request.Url.AbsolutePath; + filename = filename.Substring(1); + + if (string.IsNullOrEmpty(filename)) + { + foreach (string indexFile in _indexFiles) + { + if (File.Exists(Path.Combine(_rootDirectory, indexFile))) + { + filename = indexFile; + break; + } + } + } + + filename = Path.Combine(_rootDirectory, filename); + + if (File.Exists(filename)) + { + try + { + var ext = new FileInfo(filename); + + if (ext.Extension == ".php") + { + string output = ProcessPhpPage(Directories.ConfigDirData + "\\php\\php.exe", filename); + byte[] input = ASCIIEncoding.UTF8.GetBytes(output); + //Adding permanent http response headers + string mime; + context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream"; + context.Response.ContentLength64 = input.Length; + context.Response.AddHeader("Date", DateTime.Now.ToString("r")); + context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); + context.Response.OutputStream.Write(input, 0, input.Length); + context.Response.StatusCode = (int)HttpStatusCode.OK; + context.Response.OutputStream.Flush(); + } + else + { + Stream input = new FileStream(filename, FileMode.Open); + //Adding permanent http response headers + string mime; + context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream"; + context.Response.ContentLength64 = input.Length; + context.Response.AddHeader("Date", DateTime.Now.ToString("r")); + context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); + + byte[] buffer = new byte[1024 * 16]; + int nbytes; + while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0) + context.Response.OutputStream.Write(buffer, 0, nbytes); + input.Close(); + + context.Response.StatusCode = (int)HttpStatusCode.OK; + context.Response.OutputStream.Flush(); + } + } + catch (Exception) + { + context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; + } + + } + + context.Response.OutputStream.Close(); + } + + private void Initialize(string path, int port) + { + this._rootDirectory = path; + this._port = port; + _serverThread = new Thread(this.Listen); + _serverThread.Start(); + GlobalVars.IsWebServerOn = true; + } +} +#endregion + +#region Roblox XML Localizer +public static class RobloxXMLLocalizer +{ + public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, string name = "", string meshname = "") + { + DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname); + } + + public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "") + { + DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname); + } + + public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "") + { + string oldfile = File.ReadAllText(filepath); + string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile)); + XDocument doc = XDocument.Parse(fixedfile); + + try + { + var v = from nodes in doc.Descendants("Item") + where nodes.Attribute("class").Value == itemClassValue + select nodes; + + foreach (var item in v) + { + var v2 = from nodes in item.Descendants("Content") + where nodes.Attribute("name").Value == itemIdValue + select nodes; + + foreach (var item2 in v2) + { + var v3 = from nodes in item2.Descendants("url") + select nodes; + + foreach (var item3 in v3) + { + if (!item3.Value.Contains("rbxassetid")) + { + if (!item3.Value.Contains("rbxasset")) + { + if (string.IsNullOrWhiteSpace(meshname)) + { + string url = item3.Value; + string urlFixed = url.Replace("&", "&").Replace("amp;", "&"); + string peram = "id="; + + if (string.IsNullOrWhiteSpace(name)) + { + if (urlFixed.Contains(peram)) + { + string IDVal = urlFixed.After(peram); + DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal); + item3.Value = inGameDir + IDVal + fileext; + } + } + else + { + DownloadFilesFromNode(urlFixed, outputPath, fileext, name); + item3.Value = inGameDir + name + fileext; + } + } + else + { + item3.Value = inGameDir + meshname; + } + } + } + else + { + if (string.IsNullOrWhiteSpace(meshname)) + { + string url = item3.Value; + string rbxassetid = "rbxassetid://"; + string urlFixed = "https://www.roblox.com/asset/?id=" + url.After(rbxassetid); + string peram = "id="; + + if (string.IsNullOrWhiteSpace(name)) + { + if (urlFixed.Contains(peram)) + { + string IDVal = urlFixed.After(peram); + DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal); + item3.Value = inGameDir + IDVal + fileext; + } + } + else + { + DownloadFilesFromNode(urlFixed, outputPath, fileext, name); + item3.Value = inGameDir + name + fileext; + } + } + else + { + item3.Value = inGameDir + meshname; + } + } + } + } + } + + } + catch (Exception ex) + { + MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + finally + { + doc.Save(filepath); + } + } + + private static void DownloadFilesFromNode(string url, string path, string fileext, string id) + { + if (!string.IsNullOrWhiteSpace(id)) + { + Downloader download = new Downloader(url, id); + + try + { + download.InitDownload(path, fileext); + } + catch (Exception ex) + { + MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private static string RemoveInvalidXmlChars(string content) + { + return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray()); + } + + private static string ReplaceHexadecimalSymbols(string txt) + { + string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]"; + return Regex.Replace(txt, r, "", RegexOptions.Compiled); + } +} +#endregion + +#endregion + +#endregion \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs b/NovetusLauncher/NovetusFuncs/NovetusLauncherFuncs.cs similarity index 76% rename from NovetusLauncher/NovetusFuncs/LauncherFuncs.cs rename to NovetusLauncher/NovetusFuncs/NovetusLauncherFuncs.cs index ac3f123..9a08002 100644 --- a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/NovetusLauncherFuncs.cs @@ -1,18 +1,13 @@ -/* - * Created by SharpDevelop. - * User: BITL - * Date: 6/13/2017 - * Time: 10:24 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ +#region Usings using System; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Reflection; +#endregion +#region Launcher State public enum LauncherState { InLauncher = 0, @@ -23,23 +18,9 @@ public enum LauncherState InEasterEggGame = 5, LoadingURI = 6 } +#endregion -public enum QualityLevel -{ - VeryLow = 1, - Low = 2, - Medium = 3, - High = 4, - Ultra = 5 -} - -public enum GraphicsMode -{ - None = 0, - OpenGL = 1, - DirectX = 2 -} - +#region Launcher Functions public class LauncherFuncs { public LauncherFuncs() @@ -54,7 +35,7 @@ public class LauncherFuncs { if (cmd) { - var versionInfo = FileVersionInfo.GetVersionInfo(GlobalVars.RootPathLauncher + "\\Novetus.exe"); + var versionInfo = FileVersionInfo.GetVersionInfo(Directories.RootPathLauncher + "\\Novetus.exe"); GlobalVars.Version = lines[6].Replace("%version%", lines[0]) .Replace("%build%", versionInfo.ProductBuildPart.ToString()) .Replace("%revision%", versionInfo.FilePrivatePart.ToString()) @@ -68,7 +49,7 @@ public class LauncherFuncs .Replace("%snapshot-revision%", lines[7]); } - string changelog = GlobalVars.BasePath + "\\changelog.txt"; + string changelog = Directories.BasePath + "\\changelog.txt"; if (File.Exists(changelog)) { string[] changelogedit = File.ReadAllLines(changelog); @@ -91,10 +72,10 @@ public class LauncherFuncs GlobalVars.DefaultMap = lines[2]; GlobalVars.RegisterClient1 = lines[3]; GlobalVars.RegisterClient2 = lines[4]; - GlobalVars.SelectedClient = GlobalVars.DefaultClient; - GlobalVars.Map = GlobalVars.DefaultMap; - GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap; - GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.Map = GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.DefaultMap; } } @@ -169,23 +150,23 @@ public class LauncherFuncs string section = "Config"; - ini.IniWriteValue(section, "CloseOnLaunch", GlobalVars.CloseOnLaunch.ToString()); - ini.IniWriteValue(section, "UserID", GlobalVars.UserID.ToString()); - ini.IniWriteValue(section, "PlayerName", GlobalVars.PlayerName.ToString()); - ini.IniWriteValue(section, "SelectedClient", GlobalVars.SelectedClient.ToString()); - ini.IniWriteValue(section, "Map", GlobalVars.Map.ToString()); - ini.IniWriteValue(section, "RobloxPort", GlobalVars.RobloxPort.ToString()); - ini.IniWriteValue(section, "PlayerLimit", GlobalVars.PlayerLimit.ToString()); - ini.IniWriteValue(section, "UPnP", GlobalVars.UPnP.ToString()); - ini.IniWriteValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString()); - ini.IniWriteValue(section, "PlayerTripcode", SecurityFuncs.Base64Encode(GlobalVars.PlayerTripcode.ToString())); - ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString()); - ini.IniWriteValue(section, "MapPath", GlobalVars.MapPath.ToString()); - ini.IniWriteValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString()); - ini.IniWriteValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.GraphicsMode).ToString()); - ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString()); - ini.IniWriteValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.QualityLevel).ToString()); - ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString()); + ini.IniWriteValue(section, "CloseOnLaunch", GlobalVars.UserConfiguration.CloseOnLaunch.ToString()); + ini.IniWriteValue(section, "UserID", GlobalVars.UserConfiguration.UserID.ToString()); + ini.IniWriteValue(section, "PlayerName", GlobalVars.UserConfiguration.PlayerName.ToString()); + ini.IniWriteValue(section, "SelectedClient", GlobalVars.UserConfiguration.SelectedClient.ToString()); + ini.IniWriteValue(section, "Map", GlobalVars.UserConfiguration.Map.ToString()); + ini.IniWriteValue(section, "RobloxPort", GlobalVars.UserConfiguration.RobloxPort.ToString()); + ini.IniWriteValue(section, "PlayerLimit", GlobalVars.UserConfiguration.PlayerLimit.ToString()); + ini.IniWriteValue(section, "UPnP", GlobalVars.UserConfiguration.UPnP.ToString()); + ini.IniWriteValue(section, "ItemMakerDisableHelpMessage", GlobalVars.UserConfiguration.DisabledItemMakerHelp.ToString()); + ini.IniWriteValue(section, "PlayerTripcode", SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.PlayerTripcode.ToString())); + ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString()); + ini.IniWriteValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString()); + ini.IniWriteValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString()); + ini.IniWriteValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); + ini.IniWriteValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString()); + ini.IniWriteValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); + ini.IniWriteValue(section, "OldLayout", GlobalVars.UserConfiguration.OldLayout.ToString()); } else { @@ -199,82 +180,82 @@ public class LauncherFuncs string section = "Config"; - closeonlaunch = ini.IniReadValue(section, "CloseOnLaunch", GlobalVars.CloseOnLaunch.ToString()); - userid = ini.IniReadValue(section, "UserID", GlobalVars.UserID.ToString()); - name = ini.IniReadValue(section, "PlayerName", GlobalVars.PlayerName.ToString()); - selectedclient = ini.IniReadValue(section, "SelectedClient", GlobalVars.SelectedClient.ToString()); - map = ini.IniReadValue(section, "Map", GlobalVars.Map.ToString()); - port = ini.IniReadValue(section, "RobloxPort", GlobalVars.RobloxPort.ToString()); - limit = ini.IniReadValue(section, "PlayerLimit", GlobalVars.PlayerLimit.ToString()); - upnp = ini.IniReadValue(section, "UPnP", GlobalVars.UPnP.ToString()); - disablehelpmessage = ini.IniReadValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString()); + closeonlaunch = ini.IniReadValue(section, "CloseOnLaunch", GlobalVars.UserConfiguration.CloseOnLaunch.ToString()); + userid = ini.IniReadValue(section, "UserID", GlobalVars.UserConfiguration.UserID.ToString()); + name = ini.IniReadValue(section, "PlayerName", GlobalVars.UserConfiguration.PlayerName.ToString()); + selectedclient = ini.IniReadValue(section, "SelectedClient", GlobalVars.UserConfiguration.SelectedClient.ToString()); + map = ini.IniReadValue(section, "Map", GlobalVars.UserConfiguration.Map.ToString()); + port = ini.IniReadValue(section, "RobloxPort", GlobalVars.UserConfiguration.RobloxPort.ToString()); + limit = ini.IniReadValue(section, "PlayerLimit", GlobalVars.UserConfiguration.PlayerLimit.ToString()); + upnp = ini.IniReadValue(section, "UPnP", GlobalVars.UserConfiguration.UPnP.ToString()); + disablehelpmessage = ini.IniReadValue(section, "ItemMakerDisableHelpMessage", GlobalVars.UserConfiguration.DisabledItemMakerHelp.ToString()); tripcode = ini.IniReadValue(section, "PlayerTripcode", GenerateAndReturnTripcode()); - discord = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString()); - mappath = ini.IniReadValue(section, "MapPath", GlobalVars.MapPath.ToString()); - mapsnip = ini.IniReadValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString()); - graphics = ini.IniReadValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.GraphicsMode).ToString()); - reshade = ini.IniReadValue(section, "ReShade", GlobalVars.ReShade.ToString()); - qualitylevel = ini.IniReadValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.QualityLevel).ToString()); - oldlayout = ini.IniReadValue(section, "OldLayout", GlobalVars.OldLayout.ToString()); + discord = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString()); + mappath = ini.IniReadValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString()); + mapsnip = ini.IniReadValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString()); + graphics = ini.IniReadValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); + reshade = ini.IniReadValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString()); + qualitylevel = ini.IniReadValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); + oldlayout = ini.IniReadValue(section, "OldLayout", GlobalVars.UserConfiguration.OldLayout.ToString()); try { bool bline1 = Convert.ToBoolean(closeonlaunch); - GlobalVars.CloseOnLaunch = bline1; + GlobalVars.UserConfiguration.CloseOnLaunch = bline1; if (userid.Equals("0")) { GeneratePlayerID(); - Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); } else { int iline2 = Convert.ToInt32(userid); - GlobalVars.UserID = iline2; + GlobalVars.UserConfiguration.UserID = iline2; } - GlobalVars.PlayerName = name; + GlobalVars.UserConfiguration.PlayerName = name; - GlobalVars.SelectedClient = selectedclient; + GlobalVars.UserConfiguration.SelectedClient = selectedclient; - GlobalVars.Map = map; + GlobalVars.UserConfiguration.Map = map; int iline6 = Convert.ToInt32(port); - GlobalVars.RobloxPort = iline6; + GlobalVars.UserConfiguration.RobloxPort = iline6; int iline7 = Convert.ToInt32(limit); - GlobalVars.PlayerLimit = iline7; + GlobalVars.UserConfiguration.PlayerLimit = iline7; bool bline10 = Convert.ToBoolean(upnp); - GlobalVars.UPnP = bline10; + GlobalVars.UserConfiguration.UPnP = bline10; bool bline11 = Convert.ToBoolean(disablehelpmessage); - GlobalVars.DisabledHelp = bline11; + GlobalVars.UserConfiguration.DisabledItemMakerHelp = bline11; if (string.IsNullOrWhiteSpace(SecurityFuncs.Base64Decode(tripcode))) { GenerateTripcode(); - Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); } else { string sdecrypt12 = SecurityFuncs.Base64Decode(tripcode); - GlobalVars.PlayerTripcode = sdecrypt12; + GlobalVars.UserConfiguration.PlayerTripcode = sdecrypt12; } bool bline13 = Convert.ToBoolean(discord); - GlobalVars.DiscordPresence = bline13; + GlobalVars.UserConfiguration.DiscordPresence = bline13; - GlobalVars.MapPath = mappath; - GlobalVars.MapPathSnip = mapsnip; + GlobalVars.UserConfiguration.MapPath = mappath; + GlobalVars.UserConfiguration.MapPathSnip = mapsnip; int iline16 = Convert.ToInt32(graphics); - GlobalVars.GraphicsMode = GetGraphicsModeForInt(iline16); + GlobalVars.UserConfiguration.GraphicsMode = GetGraphicsModeForInt(iline16); bool bline17 = Convert.ToBoolean(reshade); - GlobalVars.ReShade = bline17; + GlobalVars.UserConfiguration.ReShade = bline17; int iline20 = Convert.ToInt32(qualitylevel); - GlobalVars.QualityLevel = GetQualityLevelForInt(iline20); + GlobalVars.UserConfiguration.QualityLevel = GetQualityLevelForInt(iline20); bool bline21 = Convert.ToBoolean(oldlayout); - GlobalVars.OldLayout = bline21; + GlobalVars.UserConfiguration.OldLayout = bline21; } catch (Exception) { @@ -282,16 +263,16 @@ public class LauncherFuncs } } - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); } else { - Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write); + Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write); } - ReShade(GlobalVars.ConfigDir, "ReShade.ini", write); + ReShade(Directories.ConfigDir, "ReShade.ini", write); } public static void Customization(string cfgpath, bool write) @@ -568,7 +549,7 @@ public class LauncherFuncs if (!File.Exists(fullpath)) { - File.Copy(GlobalVars.ConfigDir + "\\ReShade_default.ini", fullpath, true); + File.Copy(Directories.ConfigDir + "\\ReShade_default.ini", fullpath, true); ReShadeValues(fullpath, write, true); } else @@ -576,7 +557,7 @@ public class LauncherFuncs ReShadeValues(fullpath, write, true); } - string clientdir = GlobalVars.ClientDir; + string clientdir = Directories.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) @@ -595,11 +576,11 @@ public class LauncherFuncs string fulldllpath = dir.FullName + @"\opengl32.dll"; - if (GlobalVars.ReShade) + if (GlobalVars.UserConfiguration.ReShade) { if (!File.Exists(fulldllpath)) { - File.Copy(GlobalVars.ConfigDirData + "\\opengl32.dll", fulldllpath, true); + File.Copy(Directories.ConfigDirData + "\\opengl32.dll", fulldllpath, true); } } else @@ -614,24 +595,22 @@ public class LauncherFuncs public static void ResetConfigValues() { - GlobalVars.SelectedClient = GlobalVars.DefaultClient; - GlobalVars.Map = GlobalVars.DefaultMap; - GlobalVars.CloseOnLaunch = false; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.Map = GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.CloseOnLaunch = false; GeneratePlayerID(); - GlobalVars.PlayerName = "Player"; - GlobalVars.SelectedClient = GlobalVars.DefaultClient; - GlobalVars.RobloxPort = 53640; - GlobalVars.PlayerLimit = 12; - GlobalVars.UPnP = false; - //GlobalVars.UDP = true; - GlobalVars.DisabledHelp = false; - GlobalVars.DiscordPresence = true; - GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap; - GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap; - GlobalVars.GraphicsMode = GraphicsMode.OpenGL; - GlobalVars.ReShade = false; - GlobalVars.QualityLevel = QualityLevel.Ultra; - GlobalVars.OldLayout = false; + GlobalVars.UserConfiguration.PlayerName = "Player"; + GlobalVars.UserConfiguration.RobloxPort = 53640; + GlobalVars.UserConfiguration.PlayerLimit = 12; + GlobalVars.UserConfiguration.UPnP = false; + GlobalVars.UserConfiguration.DisabledItemMakerHelp = false; + GlobalVars.UserConfiguration.DiscordPresence = true; + GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.DefaultMap; + GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.ReShade = false; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; + GlobalVars.UserConfiguration.OldLayout = false; ResetCustomizationValues(); } @@ -755,18 +734,18 @@ public class LauncherFuncs } //2147483647 is max id. - GlobalVars.UserID = randomID; + GlobalVars.UserConfiguration.UserID = randomID; } public static void GenerateTripcode() { - GlobalVars.PlayerTripcode = SecurityFuncs.RandomString(); + GlobalVars.UserConfiguration.PlayerTripcode = SecurityFuncs.RandomString(); } public static string GenerateAndReturnTripcode() { GenerateTripcode(); - return GlobalVars.PlayerTripcode; + return GlobalVars.UserConfiguration.PlayerTripcode; } public static Image LoadImage(string fileFullName) @@ -790,7 +769,7 @@ public class LauncherFuncs public static void UpdateRichPresence(LauncherState state, string mapname, bool initial = false) { - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { if (initial) { @@ -805,51 +784,51 @@ public class LauncherFuncs case LauncherState.InLauncher: GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher; GlobalVars.presence.state = "In Launcher"; - GlobalVars.presence.details = "Selected " + GlobalVars.SelectedClient; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.details = "Selected " + GlobalVars.UserConfiguration.SelectedClient; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; GlobalVars.presence.smallImageText = "In Launcher"; break; case LauncherState.InMPGame: GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.details = ValidMapname; - GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Multiplayer Game"; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; - GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Multiplayer Game"; + GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; break; case LauncherState.InSoloGame: GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.details = ValidMapname; - GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Solo Game"; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; - GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Solo Game"; + GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Solo Game"; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Solo Game"; break; case LauncherState.InStudio: GlobalVars.presence.smallImageKey = GlobalVars.image_instudio; GlobalVars.presence.details = ValidMapname; - GlobalVars.presence.state = "In " + GlobalVars.SelectedClient + " Studio"; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; - GlobalVars.presence.smallImageText = "In " + GlobalVars.SelectedClient + " Studio"; + GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Studio"; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Studio"; break; case LauncherState.InCustomization: GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization; - GlobalVars.presence.details = "Customizing " + GlobalVars.PlayerName; + GlobalVars.presence.details = "Customizing " + GlobalVars.UserConfiguration.PlayerName; GlobalVars.presence.state = "In Character Customization"; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; GlobalVars.presence.smallImageText = "In Character Customization"; break; case LauncherState.InEasterEggGame: GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.details = ValidMapname; GlobalVars.presence.state = "Reading a message."; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; GlobalVars.presence.smallImageText = "Reading a message."; break; case LauncherState.LoadingURI: GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.details = ValidMapname; - GlobalVars.presence.state = "Joining a " + GlobalVars.SelectedClient + " Multiplayer Game"; - GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | Novetus " + GlobalVars.Version; - GlobalVars.presence.smallImageText = "Joining a " + GlobalVars.SelectedClient + " Multiplayer Game"; + GlobalVars.presence.state = "Joining a " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; + GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.Version; + GlobalVars.presence.smallImageText = "Joining a " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; break; default: break; @@ -865,7 +844,7 @@ public class LauncherFuncs if (!GlobalVars.SelectedClientInfo.NoGraphicsOptions) { - switch (GlobalVars.GraphicsMode) + switch (GlobalVars.UserConfiguration.GraphicsMode) { case GraphicsMode.OpenGL: result += "xpcall( function() settings().Rendering.graphicsMode = 2 end, function( err ) settings().Rendering.graphicsMode = 4 end );"; @@ -888,7 +867,7 @@ public class LauncherFuncs int Shadows_2008 = 1; bool Shadows_2007 = true; - switch (GlobalVars.QualityLevel) + switch (GlobalVars.UserConfiguration.QualityLevel) { case QualityLevel.VeryLow: MeshDetail = 50; @@ -964,7 +943,7 @@ public class LauncherFuncs } else { - luafile = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } return luafile; @@ -975,28 +954,28 @@ public class LauncherFuncs string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode) { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { switch (type) { case ScriptType.Client: - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_client.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; break; case ScriptType.Server: - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_server.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; break; case ScriptType.Studio: - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_studio.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe"; break; case ScriptType.Solo: case ScriptType.EasterEgg: - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_solo.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe"; break; case ScriptType.None: default: - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; break; } } @@ -1004,3 +983,93 @@ public class LauncherFuncs return rbxexe; } } +#endregion + +#region Splash Reader +public static class SplashReader +{ + private static string RandomSplash() + { + string[] splashes = File.ReadAllLines(Directories.ConfigDir + "\\splashes.txt"); + string splash = ""; + + try + { + splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)]; + } + catch (Exception) + { + try + { + splash = splashes[0]; + } + catch (Exception) + { + splash = "missingno"; + return splash; + } + } + + CryptoRandom random = new CryptoRandom(); + + string formattedsplash = splash + .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) + .Replace("%nextversion%", (Convert.ToDouble(GlobalVars.Branch) + 0.1).ToString()) + .Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, 32))); + + return formattedsplash; + } + + public static string GetSplash() + { + DateTime today = DateTime.Now; + string splash = ""; + + switch (today) + { + case DateTime christmaseve when christmaseve.Month.Equals(12) && christmaseve.Day.Equals(24): + case DateTime christmasday when christmasday.Month.Equals(12) && christmasday.Day.Equals(25): + splash = "Merry Christmas!"; + break; + case DateTime newyearseve when newyearseve.Month.Equals(12) && newyearseve.Day.Equals(31): + case DateTime newyearsday when newyearsday.Month.Equals(1) && newyearsday.Day.Equals(1): + splash = "Happy New Year!"; + break; + case DateTime halloween when halloween.Month.Equals(10) && halloween.Day.Equals(31): + splash = "Happy Halloween!"; + break; + case DateTime bitlbirthday when bitlbirthday.Month.Equals(6) && bitlbirthday.Day.Equals(10): + splash = "Happy Birthday, Bitl!"; + break; + case DateTime robloxbirthday when robloxbirthday.Month.Equals(8) && robloxbirthday.Day.Equals(27): + splash = "Happy Birthday, ROBLOX!"; + break; + case DateTime novetusbirthday when novetusbirthday.Month.Equals(10) && novetusbirthday.Day.Equals(27): + splash = "Happy Birthday, Novetus!"; + break; + case DateTime leiferikson when leiferikson.Month.Equals(10) && leiferikson.Day.Equals(9): + splash = "Happy Leif Erikson Day! HINGA DINGA DURGEN!"; + break; + case DateTime smokeweedeveryday when smokeweedeveryday.Month.Equals(4) && smokeweedeveryday.Day.Equals(20): + CryptoRandom random = new CryptoRandom(); + if (random.Next(0, 1) == 1) + { + splash = "smoke weed every day"; + } + else + { + splash = "4/20 lol"; + } + break; + case DateTime erikismyhero when erikismyhero.Month.Equals(2) && erikismyhero.Day.Equals(11): + splash = "RIP Erik Cassel"; + break; + default: + splash = RandomSplash(); + break; + } + + return splash; + } +} +#endregion diff --git a/NovetusLauncher/NovetusFuncs/Downloader.cs b/NovetusLauncher/NovetusFuncs/NovetusLoaderFuncs.cs similarity index 53% rename from NovetusLauncher/NovetusFuncs/Downloader.cs rename to NovetusLauncher/NovetusFuncs/NovetusLoaderFuncs.cs index 5183213..0b46376 100644 --- a/NovetusLauncher/NovetusFuncs/Downloader.cs +++ b/NovetusLauncher/NovetusFuncs/NovetusLoaderFuncs.cs @@ -1,8 +1,14 @@ -using System; -using System.Net; -using System.Windows.Forms; +#region Usings +using System; using System.IO; +using System.Windows.Forms; +using System.Linq; +using System.Text; +using Ionic.Zip; +using System.Net; +#endregion +#region Downloader class Downloader { private readonly string fileURL; @@ -47,7 +53,7 @@ class Downloader int read = DownloadFile(fileURL, fullpath); downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { downloadOutcome = "Error when downloading file: " + ex.Message; } @@ -72,7 +78,7 @@ class Downloader int read = DownloadFile(fileURL, saveFileDialog1.FileName); downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { downloadOutcome = "Error when downloading file: " + ex.Message; } @@ -81,9 +87,9 @@ class Downloader private static int DownloadFile(string remoteFilename, string localFilename) { - //credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm) - //and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408) - + //credit to Tom Archer (https://www.codeguru.com/columns/dotnettips/article.php/c7005/Downloading-Files-with-the-WebRequest-and-WebResponse-Classes.htm) + //and Brokenglass (https://stackoverflow.com/questions/4567313/uncompressing-gzip-response-from-webclient/4567408#4567408) + // Function will return the number of bytes processed // to the caller. Initialize to 0 here. int bytesProcessed = 0; @@ -142,7 +148,7 @@ class Downloader } } } - catch (Exception e) when (!Env.Debugging) + catch (Exception e) { downloadOutcomeException = " Exception detected: " + e.Message; } @@ -160,3 +166,140 @@ class Downloader return bytesProcessed; } } +#endregion + +#region Addon Loader +public class AddonLoader +{ + private readonly OpenFileDialog openFileDialog1; + private string installOutcome = ""; + private int fileListDisplay = 0; + + public AddonLoader() + { + openFileDialog1 = new OpenFileDialog() + { + FileName = "Select an addon .zip file", + Filter = "Compressed zip files (*.zip)|*.zip", + Title = "Open addon .zip" + }; + } + + public void setInstallOutcome(string text) + { + installOutcome = text; + } + + public string getInstallOutcome() + { + return installOutcome; + } + + public void setFileListDisplay(int number) + { + fileListDisplay = number; + } + + public void LoadAddon() + { + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + try + { + int filecount = 0; + StringBuilder filelistbuilder = new StringBuilder(); + + using (Stream str = openFileDialog1.OpenFile()) + { + using (var zipFile = ZipFile.Read(str)) + { + ZipEntry[] entries = zipFile.Entries.ToArray(); + + foreach (ZipEntry entry in entries) + { + filelistbuilder.Append(entry.FileName + " ("+ entry.UncompressedSize +")"); + filelistbuilder.Append(Environment.NewLine); + } + + zipFile.ExtractAll(Directories.BasePath, ExtractExistingFileAction.OverwriteSilently); + } + } + + string filelist = filelistbuilder.ToString(); + + if (filecount > fileListDisplay) + { + installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!"; + } + else + { + installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist; + } + } + catch (Exception ex) + { + installOutcome = "Error when installing addon: " + ex.Message; + } + } + } +} +#endregion + +#region Icon Loader +public class IconLoader +{ + private OpenFileDialog openFileDialog1; + private string installOutcome = ""; + + public IconLoader() + { + openFileDialog1 = new OpenFileDialog() + { + FileName = "Select an icon .png file", + Filter = "Portable Network Graphics image (*.png)|*.png", + Title = "Open icon .png" + }; + } + + public void setInstallOutcome(string text) + { + installOutcome = text; + } + + public string getInstallOutcome() + { + return installOutcome; + } + + public void LoadImage() + { + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + try + { + using (Stream str = openFileDialog1.OpenFile()) + { + using (Stream output = new FileStream(Directories.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName + ".png", FileMode.Create)) + { + byte[] buffer = new byte[32 * 1024]; + int read; + + while ((read = str.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer, 0, read); + } + } + + str.Close(); + } + + installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!"; + } + catch (Exception ex) + { + installOutcome = "Error when installing icon: " + ex.Message; + } + } + } +} +#endregion \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/ClientScript.cs b/NovetusLauncher/NovetusFuncs/NovetusScriptFuncs.cs similarity index 51% rename from NovetusLauncher/NovetusFuncs/ClientScript.cs rename to NovetusLauncher/NovetusFuncs/NovetusScriptFuncs.cs index 83ec9f3..32b4b49 100644 --- a/NovetusLauncher/NovetusFuncs/ClientScript.cs +++ b/NovetusLauncher/NovetusFuncs/NovetusScriptFuncs.cs @@ -1,16 +1,109 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:02 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - +#region Usings using System; +using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Text.RegularExpressions; +#endregion +#region Script Type +public enum ScriptType +{ + Client = 0, + Server = 1, + Solo = 2, + Studio = 3, + EasterEgg = 4, + None = 5 +} +#endregion + +#region Script Generator +public class ScriptGenerator +{ + public static string GetScriptFuncForType(ScriptType type) + { + string rbxexe = ""; + if (GlobalVars.SelectedClientInfo.LegacyMode == true) + { + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + } + else + { + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; + } + + string md5dir = SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location); + string md5script = SecurityFuncs.CalculateMD5(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"); + string md5exe = SecurityFuncs.CalculateMD5(rbxexe); + string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; + + switch (type) + { + case ScriptType.Client: + return "_G.CSConnect(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + + GlobalVars.IP + "'," + + GlobalVars.UserConfiguration.RobloxPort + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + + GlobalVars.loadtext + "," + + md5s + ",'" + + GlobalVars.UserConfiguration.PlayerTripcode + "')"; + case ScriptType.Server: + return "_G.CSServer(" + + GlobalVars.UserConfiguration.RobloxPort + "," + + GlobalVars.UserConfiguration.PlayerLimit + "," + + md5s + ")"; + case ScriptType.Solo: + case ScriptType.EasterEgg: + return "_G.CSSolo(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + + GlobalVars.sololoadtext + ")"; + case ScriptType.Studio: + return "_G.CSStudio()"; + default: + return ""; + } + } + + public static string GetNameForType(ScriptType type) + { + switch (type) + { + case ScriptType.Client: + return "Client"; + case ScriptType.Server: + return "Server"; + case ScriptType.Solo: + return "Play Solo"; + case ScriptType.Studio: + return "Studio"; + case ScriptType.EasterEgg: + return "A message from Bitl"; + default: + return ""; + } + } + public static void GenerateScriptForClient(ScriptType type) + { + string code = GlobalVars.MultiLine( + "--Load Script", + //scriptcontents, + LauncherFuncs.ChangeGameSettings(), + "dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')", + GetScriptFuncForType(type), + !string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "')" : "" + ); + + List list = new List(Regex.Split(code, Environment.NewLine)); + string[] convertedList = list.ToArray(); + File.WriteAllLines(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua", convertedList); + } +} +#endregion + +#region ClientScript Parser public class ClientScript { public static string GetArgsFromTag(string code, string tag, string endtag) @@ -53,18 +146,18 @@ public class ClientScript case ScriptType.Client: return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(" - + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + GlobalVars.IP + "'," - + GlobalVars.RobloxPort + ",'" - + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + GlobalVars.UserConfiguration.RobloxPort + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + GlobalVars.loadtext + "," + md5s + ",'" - + GlobalVars.PlayerTripcode + "')"; + + GlobalVars.UserConfiguration.PlayerTripcode + "')"; case ScriptType.Server: return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSServer(" - + GlobalVars.RobloxPort + "," - + GlobalVars.PlayerLimit + "," + + GlobalVars.UserConfiguration.RobloxPort + "," + + GlobalVars.UserConfiguration.PlayerLimit + "," + md5s + "); " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : ""); @@ -72,8 +165,8 @@ public class ClientScript case ScriptType.EasterEgg: return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(" - + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" - + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + GlobalVars.sololoadtext + ")"; case ScriptType.Studio: return LauncherFuncs.ChangeGameSettings() @@ -109,7 +202,7 @@ public class ClientScript try { string result = source.Substring(0, source.IndexOf(seperator)); - if (File.Exists(GlobalVars.MapsDir + @"\\" + result + @"\\" + source)) { + if (File.Exists(Directories.MapsDir + @"\\" + result + @"\\" + source)) { return result + @"\\" + source; } else { return source; @@ -138,18 +231,18 @@ public class ClientScript } string md5dir = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : ""; - string md5script = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua") : ""; + string md5script = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua") : ""; string md5exe = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(rbxexe) : ""; string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; string compiled = extractedCode.Replace("%mapfile%", mapfile) .Replace("%luafile%", luafile) .Replace("%charapp%", GlobalVars.UserCustomization.CharacterID) .Replace("%ip%", GlobalVars.IP) - .Replace("%port%", GlobalVars.RobloxPort.ToString()) - .Replace("%name%", GlobalVars.PlayerName) + .Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString()) + .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) .Replace("%icone%", ConvertIconStringToInt().ToString()) .Replace("%icon%", GlobalVars.UserCustomization.Icon) - .Replace("%id%", GlobalVars.UserID.ToString()) + .Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString()) .Replace("%face%", GlobalVars.UserCustomization.Face) .Replace("%head%", GlobalVars.UserCustomization.Head) .Replace("%tshirt%", GlobalVars.UserCustomization.TShirt) @@ -158,14 +251,14 @@ public class ClientScript .Replace("%hat1%", GlobalVars.UserCustomization.Hat1) .Replace("%hat2%", GlobalVars.UserCustomization.Hat2) .Replace("%hat3%", GlobalVars.UserCustomization.Hat3) - .Replace("%faced%", GlobalVars.faceGameDir + GlobalVars.UserCustomization.Face) - .Replace("%headd%", GlobalVars.headGameDir + GlobalVars.UserCustomization.Head) - .Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalVars.tshirtGameDir + GlobalVars.UserCustomization.TShirt) - .Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalVars.shirtGameDir + GlobalVars.UserCustomization.Shirt) - .Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalVars.pantsGameDir + GlobalVars.UserCustomization.Pants) - .Replace("%hat1d%", GlobalVars.hatGameDir + GlobalVars.UserCustomization.Hat1) - .Replace("%hat2d%", GlobalVars.hatGameDir + GlobalVars.UserCustomization.Hat2) - .Replace("%hat3d%", GlobalVars.hatGameDir + GlobalVars.UserCustomization.Hat3) + .Replace("%faced%", Directories.faceGameDir + GlobalVars.UserCustomization.Face) + .Replace("%headd%", Directories.headGameDir + GlobalVars.UserCustomization.Head) + .Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : Directories.tshirtGameDir + GlobalVars.UserCustomization.TShirt) + .Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : Directories.shirtGameDir + GlobalVars.UserCustomization.Shirt) + .Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : Directories.pantsGameDir + GlobalVars.UserCustomization.Pants) + .Replace("%hat1d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat1) + .Replace("%hat2d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat2) + .Replace("%hat3d%", Directories.hatGameDir + GlobalVars.UserCustomization.Hat3) .Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString()) .Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString()) .Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString()) @@ -177,25 +270,26 @@ public class ClientScript .Replace("%md5exe%", GlobalVars.SelectedClientInfo.ScriptMD5) .Replace("%md5scriptd%", md5script) .Replace("%md5exed%", md5exe) - .Replace("%limit%", GlobalVars.PlayerLimit.ToString()) + .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString()) .Replace("%extra%", GlobalVars.UserCustomization.Extra) .Replace("%hat4%", GlobalVars.UserCustomization.Extra) - .Replace("%extrad%", GlobalVars.extraGameDir + GlobalVars.UserCustomization.Extra) - .Replace("%hat4d%", GlobalVars.hatGameDir + GlobalVars.UserCustomization.Extra) + .Replace("%extrad%", Directories.extraGameDir + GlobalVars.UserCustomization.Extra) + .Replace("%hat4d%", Directories.hatGameDir + GlobalVars.UserCustomization.Extra) .Replace("%args%", GetRawArgsFromTag(tag, md5s, luafile)) - .Replace("%facews%", GlobalVars.WebServer_FaceDir + GlobalVars.UserCustomization.Face) - .Replace("%headws%", GlobalVars.WebServer_HeadDir + GlobalVars.UserCustomization.Head) - .Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalVars.WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt) - .Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalVars.WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt) - .Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalVars.WebServer_PantsDir + GlobalVars.UserCustomization.Pants) - .Replace("%hat1ws%", GlobalVars.WebServer_HatDir + GlobalVars.UserCustomization.Hat1) - .Replace("%hat2ws%", GlobalVars.WebServer_HatDir + GlobalVars.UserCustomization.Hat2) - .Replace("%hat3ws%", GlobalVars.WebServer_HatDir + GlobalVars.UserCustomization.Hat3) - .Replace("%extraws%", GlobalVars.WebServer_ExtraDir + GlobalVars.UserCustomization.Extra) - .Replace("%hat4ws%", GlobalVars.WebServer_HatDir + GlobalVars.UserCustomization.Extra) - .Replace("%mapfiled%", GlobalVars.BaseGameDir + GlobalVars.MapPathSnip.Replace(@"\\", @"\")) - .Replace("%tripcode%", GlobalVars.PlayerTripcode) + .Replace("%facews%", Directories.WebServer_FaceDir + GlobalVars.UserCustomization.Face) + .Replace("%headws%", Directories.WebServer_HeadDir + GlobalVars.UserCustomization.Head) + .Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : Directories.WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt) + .Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : Directories.WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt) + .Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : Directories.WebServer_PantsDir + GlobalVars.UserCustomization.Pants) + .Replace("%hat1ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat1) + .Replace("%hat2ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat2) + .Replace("%hat3ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Hat3) + .Replace("%extraws%", Directories.WebServer_ExtraDir + GlobalVars.UserCustomization.Extra) + .Replace("%hat4ws%", Directories.WebServer_HatDir + GlobalVars.UserCustomization.Extra) + .Replace("%mapfiled%", Directories.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\")) + .Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode) .Replace("%addonscriptpath%", GlobalVars.AddonScriptPath); return compiled; } -} \ No newline at end of file +} +#endregion \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs b/NovetusLauncher/NovetusFuncs/NovetusSecurityFuncs.cs similarity index 91% rename from NovetusLauncher/NovetusFuncs/SecurityFuncs.cs rename to NovetusLauncher/NovetusFuncs/NovetusSecurityFuncs.cs index 8f32db9..0786fa0 100644 --- a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/NovetusSecurityFuncs.cs @@ -1,12 +1,4 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 6:59 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - +#region Usings using System; using System.IO; using System.Diagnostics; @@ -20,10 +12,9 @@ using System.Linq; using System.ComponentModel; using System.Net; using System.Threading.Tasks; +#endregion -/// -/// Description of SecurityFuncs. -/// +#region Security Functions public class SecurityFuncs { [DllImport("user32.dll")] @@ -100,9 +91,9 @@ public class SecurityFuncs if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = GlobalVars.BasePath + "\\clients\\" + client + "\\RobloxApp.exe"; + rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp.exe"; } else { - rbxexe = GlobalVars.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe"; + rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe"; } using (var md5 = MD5.Create()) { using (var stream = File.OpenRead(rbxexe)) { @@ -127,7 +118,7 @@ public class SecurityFuncs { if (GlobalVars.AdminMode != true) { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { - string rbxscript = GlobalVars.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"; + string rbxscript = Directories.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"; using (var md5 = MD5.Create()) { using (var stream = File.OpenRead(rbxscript)) { byte[] hash = md5.ComputeHash(stream); @@ -173,7 +164,7 @@ public class SecurityFuncs if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { int time = 500; BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, GlobalVars.SelectedClient, mapname); + worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, GlobalVars.UserConfiguration.SelectedClient, mapname); worker.RunWorkerAsync(); } } @@ -196,7 +187,7 @@ public class SecurityFuncs + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) - + " [" + GlobalVars.IP + ":" + GlobalVars.RobloxPort + "]" + + " [" + GlobalVars.IP + ":" + GlobalVars.UserConfiguration.RobloxPort + "]" + RandomStringTitle()); break; case ScriptType.Server: @@ -260,4 +251,5 @@ public class SecurityFuncs var task = Task.Factory.StartNew(() => GetExternalIPAddress()); return await task; } -} \ No newline at end of file +} +#endregion \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/NovetusSpecialClasses.cs b/NovetusLauncher/NovetusFuncs/NovetusSpecialClasses.cs deleted file mode 100644 index 7e74a5c..0000000 --- a/NovetusLauncher/NovetusFuncs/NovetusSpecialClasses.cs +++ /dev/null @@ -1,142 +0,0 @@ -public class AssetCacheDef -{ - public AssetCacheDef(string clas, string[] id, string[] ext, - string[] dir, string[] gamedir) - { - Class = clas; - Id = id; - Ext = ext; - Dir = dir; - GameDir = gamedir; - } - - public string Class { get; set; } - public string[] Id { get; set; } - public string[] Ext { get; set; } - public string[] Dir { get; set; } - public string[] GameDir { get; set; } -} - -public class ClientInfo -{ - public ClientInfo() - { - UsesPlayerName = false; - UsesID = true; - Description = ""; - Warning = ""; - LegacyMode = false; - ClientMD5 = ""; - ScriptMD5 = ""; - Fix2007 = false; - AlreadyHasSecurity = false; - NoGraphicsOptions = false; - CommandLineArgs = ""; - } - - public bool UsesPlayerName { get; set; } - public bool UsesID { get; set; } - public string Description { get; set; } - public string Warning { get; set; } - public bool LegacyMode { get; set; } - public string ClientMD5 { get; set; } - public string ScriptMD5 { get; set; } - public bool Fix2007 { get; set; } - public bool AlreadyHasSecurity { get; set; } - public bool NoGraphicsOptions { get; set; } - public string CommandLineArgs { get; set; } -} - -/* - * Finish classes for: - * - * config - * info - * reshade - * - * change field names for all forms - * Rewrite client launching into one function. - */ -public class Config -{ - public Config() - { - - } - - -} - -public class CustomizationConfig -{ - public CustomizationConfig() - { - Hat1 = "NoHat.rbxm"; - Hat2 = "NoHat.rbxm"; - Hat3 = "NoHat.rbxm"; - Face = "DefaultFace.rbxm"; - Head = "DefaultHead.rbxm"; - TShirt = "NoTShirt.rbxm"; - Shirt = "NoShirt.rbxm"; - Pants = "NoPants.rbxm"; - Icon = "NBC"; - Extra = "NoExtra.rbxm"; - HeadColorID = 24; - TorsoColorID = 23; - LeftArmColorID = 24; - RightArmColorID = 24; - LeftLegColorID = 119; - RightLegColorID = 119; - HeadColorString = "Color [A=255, R=245, G=205, B=47]"; - TorsoColorString = "Color [A=255, R=13, G=105, B=172]"; - LeftArmColorString = "Color [A=255, R=245, G=205, B=47]"; - RightArmColorString = "Color [A=255, R=245, G=205, B=47]"; - LeftLegColorString = "Color [A=255, R=164, G=189, B=71]"; - RightLegColorString = "Color [A=255, R=164, G=189, B=71]"; - ExtraSelectionIsHat = false; - ShowHatsInExtra = false; - CharacterID = ""; - } - - public string Hat1 { get; set; } - public string Hat2 { get; set; } - public string Hat3 { get; set; } - public string Face { get; set; } - public string Head { get; set; } - public string TShirt { get; set; } - public string Shirt { get; set; } - public string Pants { get; set; } - public string Icon { get; set; } - public string Extra { get; set; } - public int HeadColorID { get; set; } - public int TorsoColorID { get; set; } - public int LeftArmColorID { get; set; } - public int RightArmColorID { get; set; } - public int LeftLegColorID { get; set; } - public int RightLegColorID { get; set; } - public string HeadColorString { get; set; } - public string TorsoColorString { get; set; } - public string LeftArmColorString { get; set; } - public string RightArmColorString { get; set; } - public string LeftLegColorString { get; set; } - public string RightLegColorString { get; set; } - public bool ExtraSelectionIsHat { get; set; } - public bool ShowHatsInExtra { get; set; } - public string CharacterID { get; set; } -} - -public class ProgramInfo -{ - public ProgramInfo() - { - - } -} - -public class ReShadeConfig -{ - public ReShadeConfig() - { - - } -} diff --git a/NovetusLauncher/NovetusFuncs/PartColors.cs b/NovetusLauncher/NovetusFuncs/PartColors.cs deleted file mode 100644 index abf2198..0000000 --- a/NovetusLauncher/NovetusFuncs/PartColors.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Text; - -namespace NovetusFuncs -{ - public class PartColors - { - public int ColorID { get; set; } - public Color ButtonColor { get; set; } - } -} diff --git a/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs b/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs deleted file mode 100644 index ba6e9ba..0000000 --- a/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Xml; -using System.Xml.Linq; - -public enum DLType -{ - //RBXL and RBXM - RBXL, - RBXM, - //Items - Hat, - Head, - Face, - TShirt, - Shirt, - Pants -} - -public static class RobloxXMLLocalizer -{ - public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, string name = "", string meshname = "") - { - DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname); - } - - public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "") - { - DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname); - } - - public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "") - { - string oldfile = File.ReadAllText(filepath); - string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile)); - XDocument doc = XDocument.Parse(fixedfile); - - if (Env.Debugging) - { - MessageBox.Show(itemClassValue + ", " + itemIdValue); - } - - try - { - var v = from nodes in doc.Descendants("Item") - where nodes.Attribute("class").Value == itemClassValue - select nodes; - - foreach (var item in v) - { - var v2 = from nodes in item.Descendants("Content") - where nodes.Attribute("name").Value == itemIdValue - select nodes; - - foreach (var item2 in v2) - { - var v3 = from nodes in item2.Descendants("url") - select nodes; - - foreach (var item3 in v3) - { - if (!item3.Value.Contains("rbxassetid")) - { - if (!item3.Value.Contains("rbxasset")) - { - if (string.IsNullOrWhiteSpace(meshname)) - { - string url = item3.Value; - string urlFixed = url.Replace("&", "&").Replace("amp;", "&"); - string peram = "id="; - - if (string.IsNullOrWhiteSpace(name)) - { - if (urlFixed.Contains(peram)) - { - string IDVal = urlFixed.After(peram); - DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal); - item3.Value = inGameDir + IDVal + fileext; - } - } - else - { - DownloadFilesFromNode(urlFixed, outputPath, fileext, name); - item3.Value = inGameDir + name + fileext; - } - } - else - { - item3.Value = inGameDir + meshname; - } - } - } - else - { - if (string.IsNullOrWhiteSpace(meshname)) - { - string url = item3.Value; - string rbxassetid = "rbxassetid://"; - string urlFixed = "https://www.roblox.com/asset/?id=" + url.After(rbxassetid); - string peram = "id="; - - if (string.IsNullOrWhiteSpace(name)) - { - if (urlFixed.Contains(peram)) - { - string IDVal = urlFixed.After(peram); - DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal); - item3.Value = inGameDir + IDVal + fileext; - } - } - else - { - DownloadFilesFromNode(urlFixed, outputPath, fileext, name); - item3.Value = inGameDir + name + fileext; - } - } - else - { - item3.Value = inGameDir + meshname; - } - } - } - } - } - - } - catch (Exception ex) when (!Env.Debugging) - { - MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - finally - { - doc.Save(filepath); - } - } - - private static void DownloadFilesFromNode(string url, string path, string fileext, string id) - { - if (!string.IsNullOrWhiteSpace(id)) - { - Downloader download = new Downloader(url, id); - - try - { - download.InitDownload(path, fileext); - } - catch (Exception ex) when (!Env.Debugging) - { - MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - - private static string RemoveInvalidXmlChars(string content) - { - return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray()); - } - - private static string ReplaceHexadecimalSymbols(string txt) - { - string r = "[\x00-\x08\x0B\x0C\x0E-\x1F\x26]"; - return Regex.Replace(txt, r, "", RegexOptions.Compiled); - } -} diff --git a/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs b/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs deleted file mode 100644 index 094da9f..0000000 --- a/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:02 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -public enum ScriptType -{ - Client = 0, - Server = 1, - Solo = 2, - Studio = 3, - EasterEgg = 4, - None = 5 -} - -public class ScriptGenerator -{ - public static string GetScriptFuncForType(ScriptType type) - { - string rbxexe = ""; - if (GlobalVars.SelectedClientInfo.LegacyMode == true) - { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; - } - else - { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_client.exe"; - } - - string md5dir = SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location); - string md5script = SecurityFuncs.CalculateMD5(GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"); - string md5exe = SecurityFuncs.CalculateMD5(rbxexe); - string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; - - switch (type) - { - case ScriptType.Client: - return "_G.CSConnect(" - + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" - + GlobalVars.IP + "'," - + GlobalVars.RobloxPort + ",'" - + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," - + GlobalVars.loadtext + "," - + md5s + ",'" - + GlobalVars.PlayerTripcode + "')"; - case ScriptType.Server: - return "_G.CSServer(" - + GlobalVars.RobloxPort + "," - + GlobalVars.PlayerLimit + "," - + md5s + ")"; - case ScriptType.Solo: - case ScriptType.EasterEgg: - return "_G.CSSolo(" - + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" - + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," - + GlobalVars.sololoadtext + ")"; - case ScriptType.Studio: - return "_G.CSStudio()"; - default: - return ""; - } - } - - public static string GetNameForType(ScriptType type) - { - switch (type) - { - case ScriptType.Client: - return "Client"; - case ScriptType.Server: - return "Server"; - case ScriptType.Solo: - return "Play Solo"; - case ScriptType.Studio: - return "Studio"; - case ScriptType.EasterEgg: - return "A message from Bitl"; - default: - return ""; - } - } - public static void GenerateScriptForClient(ScriptType type) - { - string code = GlobalVars.MultiLine( - "--Load Script", - //scriptcontents, - LauncherFuncs.ChangeGameSettings(), - "dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')", - GetScriptFuncForType(type), - !string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "')" : "" - ); - - List list = new List(Regex.Split(code, Environment.NewLine)); - string[] convertedList = list.ToArray(); - File.WriteAllLines(GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua", convertedList); - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/SplashReader.cs b/NovetusLauncher/NovetusFuncs/SplashReader.cs deleted file mode 100644 index c667cbe..0000000 --- a/NovetusLauncher/NovetusFuncs/SplashReader.cs +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:04 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.IO; - -public static class SplashReader -{ - private static string RandomSplash() - { - string[] splashes = File.ReadAllLines(GlobalVars.ConfigDir + "\\splashes.txt"); - string splash = ""; - - try { - splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)]; - } catch (Exception) { - try { - splash = splashes[0]; - } catch (Exception) { - splash = "missingno"; - return splash; - } - } - - CryptoRandom random = new CryptoRandom(); - - string formattedsplash = splash - .Replace("%name%", GlobalVars.PlayerName) - .Replace("%nextversion%", (Convert.ToDouble(GlobalVars.Branch) + 0.1).ToString()) - .Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2,32))); - - return formattedsplash; - } - - public static string GetSplash() - { - DateTime today = DateTime.Now; - string splash = ""; - - switch (today) - { - case DateTime christmaseve when christmaseve.Month.Equals(12) && christmaseve.Day.Equals(24): - case DateTime christmasday when christmasday.Month.Equals(12) && christmasday.Day.Equals(25): - splash = "Merry Christmas!"; - break; - case DateTime newyearseve when newyearseve.Month.Equals(12) && newyearseve.Day.Equals(31): - case DateTime newyearsday when newyearsday.Month.Equals(1) && newyearsday.Day.Equals(1): - splash = "Happy New Year!"; - break; - case DateTime halloween when halloween.Month.Equals(10) && halloween.Day.Equals(31): - splash = "Happy Halloween!"; - break; - case DateTime bitlbirthday when bitlbirthday.Month.Equals(6) && bitlbirthday.Day.Equals(10): - splash = "Happy Birthday, Bitl!"; - break; - case DateTime robloxbirthday when robloxbirthday.Month.Equals(8) && robloxbirthday.Day.Equals(27): - splash = "Happy Birthday, ROBLOX!"; - break; - case DateTime novetusbirthday when novetusbirthday.Month.Equals(10) && novetusbirthday.Day.Equals(27): - splash = "Happy Birthday, Novetus!"; - break; - case DateTime leiferikson when leiferikson.Month.Equals(10) && leiferikson.Day.Equals(9): - splash = "Happy Leif Erikson Day! HINGA DINGA DURGEN!"; - break; - case DateTime smokeweedeveryday when smokeweedeveryday.Month.Equals(4) && smokeweedeveryday.Day.Equals(20): - CryptoRandom random = new CryptoRandom(); - if (random.Next(0, 1) == 1) - { - splash = "smoke weed every day"; - } - else - { - splash = "4/20 lol"; - } - break; - case DateTime erikismyhero when erikismyhero.Month.Equals(2) && erikismyhero.Day.Equals(11): - splash = "RIP Erik Cassel"; - break; - default: - splash = RandomSplash(); - break; - } - - return splash; - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/TextLineRemover.cs b/NovetusLauncher/NovetusFuncs/TextLineRemover.cs deleted file mode 100644 index 9b9c351..0000000 --- a/NovetusLauncher/NovetusFuncs/TextLineRemover.cs +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 6:59 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Collections.Generic; -using System.IO; - -public static class TextLineRemover -{ - public static void RemoveTextLines(IList linesToRemove, string filename, string tempFilename) - { - // Initial values - int lineNumber = 0; - int linesRemoved = 0; - DateTime startTime = DateTime.Now; - - // Read file - using (var sr = new StreamReader(filename)) { - // Write new file - using (var sw = new StreamWriter(tempFilename)) { - // Read lines - string line; - while ((line = sr.ReadLine()) != null) { - lineNumber++; - // Look for text to remove - if (!ContainsString(line, linesToRemove)) { - // Keep lines that does not match - sw.WriteLine(line); - } else { - // Ignore lines that DO match - linesRemoved++; - InvokeOnRemovedLine(new RemovedLineArgs { - RemovedLine = line, - RemovedLineNumber = lineNumber - }); - } - } - } - } - // Delete original file - File.Delete(filename); - - // ... and put the temp file in its place. - File.Move(tempFilename, filename); - - // Final calculations - DateTime endTime = DateTime.Now; - InvokeOnFinished(new FinishedArgs { - LinesRemoved = linesRemoved, - TotalLines = lineNumber, - TotalTime = endTime.Subtract(startTime) - }); - } - - private static bool ContainsString(string line, IEnumerable linesToRemove) - { - foreach (var lineToRemove in linesToRemove) { - if (line.Contains(lineToRemove)) - return true; - } - return false; - } - - public static event RemovedLine OnRemovedLine; - public static event Finished OnFinished; - - public static void InvokeOnFinished(FinishedArgs args) - { - Finished handler = OnFinished; - if (handler != null) - handler(null, args); - } - - public static void InvokeOnRemovedLine(RemovedLineArgs args) - { - RemovedLine handler = OnRemovedLine; - if (handler != null) - handler(null, args); - } -} - -public delegate void Finished(object sender, FinishedArgs args); - -public class FinishedArgs -{ - public int TotalLines { get; set; } - public int LinesRemoved { get; set; } - public TimeSpan TotalTime { get; set; } -} - -public delegate void RemovedLine(object sender, RemovedLineArgs args); - -public class RemovedLineArgs -{ - public string RemovedLine { get; set; } - public int RemovedLineNumber { get; set; } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs b/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs deleted file mode 100644 index 611d588..0000000 --- a/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:03 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using System.IO; -using System.Linq; - -public static class TreeNodeHelper -{ - public static void ListDirectory(TreeView treeView, string path, string filter = ".*") - { - treeView.Nodes.Clear(); - var rootDirectoryInfo = new DirectoryInfo(path); - treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo, filter)); - } - - public static TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo, string filter = ".*") - { - var directoryNode = new TreeNode(directoryInfo.Name); - foreach (var directory in directoryInfo.GetDirectories()) - directoryNode.Nodes.Add(CreateDirectoryNode(directory, filter)); - foreach (var file in directoryInfo.GetFiles("*"+filter)) - directoryNode.Nodes.Add(new TreeNode(file.Name)); - return directoryNode; - } - - //https://stackoverflow.com/questions/42295131/searching-a-treeview-for-a-specific-string - public static TreeNode SearchTreeView(string p_sSearchTerm, TreeNodeCollection p_Nodes) - { - foreach (TreeNode node in p_Nodes) { - if (node.Text == p_sSearchTerm) - return node; - - if (node.Nodes.Count > 0) { - TreeNode child = SearchTreeView(p_sSearchTerm, node.Nodes); - if (child != null) - { - return child; - } - } - } - - return null; - } - - public static string GetFolderNameFromPrefix(string source, string seperator = " -") - { - try { - string result = source.Substring(0, source.IndexOf(seperator)); - - if (Directory.Exists(GlobalVars.MapsDir + @"\\" + result)) { - return result + @"\\"; - } else { - return ""; - } - } catch (Exception) { - return ""; - } - } - - public static void CopyNodes(TreeNodeCollection oldcollection, TreeNodeCollection newcollection) - { - foreach (TreeNode node in oldcollection) { - newcollection.Add((TreeNode)node.Clone()); - } - } - - public static List GetAllNodes(this TreeView _self) - { - List result = new List(); - foreach (TreeNode child in _self.Nodes) { - result.AddRange(child.GetAllNodes()); - } - return result; - } - - public static List GetAllNodes(this TreeNode _self) - { - List result = new List(); - result.Add(_self); - foreach (TreeNode child in _self.Nodes) { - result.AddRange(child.GetAllNodes()); - } - return result; - } - - public static List Ancestors(this TreeNode node) - { - return AncestorsInternal(node).Reverse().ToList(); - } - public static List AncestorsAndSelf(this TreeNode node) - { - return AncestorsInternal(node, true).Reverse().ToList(); - } - private static IEnumerable AncestorsInternal(TreeNode node, bool self = false) - { - if (self) - yield return node; - while (node.Parent != null) - { - node = node.Parent; - yield return node; - } - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusFuncs/URI.cs b/NovetusLauncher/NovetusFuncs/URI.cs deleted file mode 100644 index ea0a2f8..0000000 --- a/NovetusLauncher/NovetusFuncs/URI.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.Win32; -using System; -using System.Windows.Forms; - -//code based off https://stackoverflow.com/questions/35626050/registering-custom-url-handler-in-c-sharp-on-windows-8 - -namespace NovetusFuncs -{ - public class URIReg - { - private static string _Protocol = ""; - private static string _ProtocolHandler = ""; - - private static readonly string _launch = string.Format( - "{0}{1}{0} {0}%1{0}", (char)34, Application.ExecutablePath); - - private static readonly Version _win8Version = new Version(6, 2, 9200, 0); - - private static readonly bool _isWin8 = - Environment.OSVersion.Platform == PlatformID.Win32NT && - Environment.OSVersion.Version >= _win8Version; - - public URIReg(string protocol, string protocolhandle) - { - _Protocol = protocol; - _ProtocolHandler = protocolhandle; - } - - public void Register() - { - if (_isWin8) RegisterWin8(); - else RegisterWin7(); - } - - private static void RegisterWin7() - { - var regKey = Registry.ClassesRoot.CreateSubKey(_Protocol); - - regKey.CreateSubKey("DefaultIcon") - .SetValue(null, string.Format("{0}{1},1{0}", (char)34, - Application.ExecutablePath)); - - regKey.SetValue(null, "URL:" + _Protocol + " Protocol"); - regKey.SetValue("URL Protocol", ""); - - regKey = regKey.CreateSubKey(@"shell\open\command"); - regKey.SetValue(null, _launch); - } - - private static void RegisterWin8() - { - RegisterWin7(); - - var regKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes") - .CreateSubKey(_ProtocolHandler); - - regKey.SetValue(null, _Protocol); - - regKey.CreateSubKey("DefaultIcon") - .SetValue(null, string.Format("{0}{1},1{0}", (char)34, - Application.ExecutablePath)); - - regKey.CreateSubKey(@"shell\open\command").SetValue(null, _launch); - - Registry.LocalMachine.CreateSubKey(string.Format( - @"SOFTWARE\{0}\{1}\Capabilities\ApplicationDescription\URLAssociations", - Application.CompanyName, Application.ProductName)) - .SetValue(_Protocol, _ProtocolHandler); - - Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications") - .SetValue(Application.ProductName, string.Format( - @"SOFTWARE\{0}\Capabilities", Application.ProductName)); - } - - public void Unregister() - { - if (!_isWin8) - { - Registry.ClassesRoot.DeleteSubKeyTree(_Protocol, false); - return; - } - - // extra work required. - Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes") - .DeleteSubKeyTree(_ProtocolHandler, false); - - Registry.LocalMachine.DeleteSubKeyTree(string.Format(@"SOFTWARE\{0}\{1}", - Application.CompanyName, Application.ProductName)); - - Registry.LocalMachine.CreateSubKey(@"SOFTWARE\RegisteredApplications") - .DeleteValue(Application.ProductName); - } - } -} diff --git a/NovetusLauncher/NovetusFuncs/WebServer.cs b/NovetusLauncher/NovetusFuncs/WebServer.cs deleted file mode 100644 index cba7f37..0000000 --- a/NovetusLauncher/NovetusFuncs/WebServer.cs +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Created by SharpDevelop. - * User: Bitl - * Date: 10/10/2019 - * Time: 7:05 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Diagnostics; -using System.Threading; -using System.Text; -using System.Net.Sockets; -using System.Net; - -//made by aksakalli -public class SimpleHTTPServer -{ - - private readonly string[] _indexFiles = { - "index.html", - "index.htm", - "index.php", - "default.html", - "default.htm", - "default.php" - }; - - private static IDictionary _mimeTypeMappings = new Dictionary(StringComparer.InvariantCultureIgnoreCase) { - { ".asf", "video/x-ms-asf" }, - { ".asx", "video/x-ms-asf" }, - { ".avi", "video/x-msvideo" }, - { ".bin", "application/octet-stream" }, - { ".cco", "application/x-cocoa" }, - { ".crt", "application/x-x509-ca-cert" }, - { ".css", "text/css" }, - { ".deb", "application/octet-stream" }, - { ".der", "application/x-x509-ca-cert" }, - { ".dll", "application/octet-stream" }, - { ".dmg", "application/octet-stream" }, - { ".ear", "application/java-archive" }, - { ".eot", "application/octet-stream" }, - { ".exe", "application/octet-stream" }, - { ".flv", "video/x-flv" }, - { ".gif", "image/gif" }, - { ".hqx", "application/mac-binhex40" }, - { ".htc", "text/x-component" }, - { ".htm", "text/html" }, - { ".html", "text/html" }, - { ".ico", "image/x-icon" }, - { ".img", "application/octet-stream" }, - { ".iso", "application/octet-stream" }, - { ".jar", "application/java-archive" }, - { ".jardiff", "application/x-java-archive-diff" }, - { ".jng", "image/x-jng" }, - { ".jnlp", "application/x-java-jnlp-file" }, - { ".jpeg", "image/jpeg" }, - { ".jpg", "image/jpeg" }, - { ".js", "application/x-javascript" }, - { ".mml", "text/mathml" }, - { ".mng", "video/x-mng" }, - { ".mov", "video/quicktime" }, - { ".mp3", "audio/mpeg" }, - { ".mpeg", "video/mpeg" }, - { ".mpg", "video/mpeg" }, - { ".msi", "application/octet-stream" }, - { ".msm", "application/octet-stream" }, - { ".msp", "application/octet-stream" }, - { ".pdb", "application/x-pilot" }, - { ".pdf", "application/pdf" }, - { ".pem", "application/x-x509-ca-cert" }, - { ".php", "text/html" }, - { ".pl", "application/x-perl" }, - { ".pm", "application/x-perl" }, - { ".png", "image/png" }, - { ".prc", "application/x-pilot" }, - { ".ra", "audio/x-realaudio" }, - { ".rar", "application/x-rar-compressed" }, - { ".rpm", "application/x-redhat-package-manager" }, - { ".rss", "text/xml" }, - { ".run", "application/x-makeself" }, - { ".sea", "application/x-sea" }, - { ".shtml", "text/html" }, - { ".sit", "application/x-stuffit" }, - { ".swf", "application/x-shockwave-flash" }, - { ".tcl", "application/x-tcl" }, - { ".tk", "application/x-tcl" }, - { ".txt", "text/plain" }, - { ".war", "application/java-archive" }, - { ".wbmp", "image/vnd.wap.wbmp" }, - { ".wmv", "video/x-ms-wmv" }, - { ".xml", "text/xml" }, - { ".xpi", "application/x-xpinstall" }, - { ".zip", "application/zip" }, - }; - private Thread _serverThread; - private string _rootDirectory; - private HttpListener _listener; - private int _port; - - public int Port { - get { return _port; } - private set { } - } - - /// - /// Construct server with given port. - /// - /// Directory path to serve. - /// Port of the server. - public SimpleHTTPServer(string path, int port) - { - this.Initialize(path, port); - } - - /// - /// Construct server with suitable port. - /// - /// Directory path to serve. - public SimpleHTTPServer(string path) - { - //get an empty port - TcpListener l = new TcpListener(IPAddress.Loopback, 0); - l.Start(); - int port = ((IPEndPoint)l.LocalEndpoint).Port; - l.Stop(); - this.Initialize(path, port); - } - - /// - /// Stop server and dispose all functions. - /// - public void Stop() - { - _serverThread.Abort(); - _listener.Stop(); - GlobalVars.IsWebServerOn = false; - } - - private void Listen() - { - _listener = new HttpListener(); - _listener.Prefixes.Add("http://*:" + _port.ToString() + "/"); - _listener.Start(); - while (true) { - try { - HttpListenerContext context = _listener.GetContext(); - Process(context); - } catch (Exception) { - - } - } - } - - private string ProcessPhpPage(string phpCompilerPath, string pageFileName) - { - Process proc = new Process(); - proc.StartInfo.FileName = phpCompilerPath; - proc.StartInfo.Arguments = "-d \"display_errors=1\" -d \"error_reporting=E_PARSE\" \"" + pageFileName + "\""; - proc.StartInfo.CreateNoWindow = true; - proc.StartInfo.UseShellExecute = false; - proc.StartInfo.RedirectStandardOutput = true; - proc.StartInfo.RedirectStandardError = true; - proc.Start(); - string res = proc.StandardOutput.ReadToEnd(); - proc.StandardOutput.Close(); - proc.Close(); - return res; - } - - private void Process(HttpListenerContext context) - { - string filename = context.Request.Url.AbsolutePath; - filename = filename.Substring(1); - - if (string.IsNullOrEmpty(filename)) { - foreach (string indexFile in _indexFiles) { - if (File.Exists(Path.Combine(_rootDirectory, indexFile))) { - filename = indexFile; - break; - } - } - } - - filename = Path.Combine(_rootDirectory, filename); - - if (File.Exists(filename)) { - try { - var ext = new FileInfo(filename); - - if (ext.Extension == ".php") { - string output = ProcessPhpPage(GlobalVars.ConfigDirData + "\\php\\php.exe", filename); - byte[] input = ASCIIEncoding.UTF8.GetBytes(output); - //Adding permanent http response headers - string mime; - context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream"; - context.Response.ContentLength64 = input.Length; - context.Response.AddHeader("Date", DateTime.Now.ToString("r")); - context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); - context.Response.OutputStream.Write(input, 0, input.Length); - context.Response.StatusCode = (int)HttpStatusCode.OK; - context.Response.OutputStream.Flush(); - } else { - Stream input = new FileStream(filename, FileMode.Open); - //Adding permanent http response headers - string mime; - context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream"; - context.Response.ContentLength64 = input.Length; - context.Response.AddHeader("Date", DateTime.Now.ToString("r")); - context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); - - byte[] buffer = new byte[1024 * 16]; - int nbytes; - while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0) - context.Response.OutputStream.Write(buffer, 0, nbytes); - input.Close(); - - context.Response.StatusCode = (int)HttpStatusCode.OK; - context.Response.OutputStream.Flush(); - } - } catch (Exception) { - context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; - } - - } - - context.Response.OutputStream.Close(); - } - - private void Initialize(string path, int port) - { - this._rootDirectory = path; - this._port = port; - _serverThread = new Thread(this.Listen); - _serverThread.Start(); - GlobalVars.IsWebServerOn = true; - } -} \ No newline at end of file diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs index f215d07..670904c 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs @@ -13,7 +13,6 @@ using System.IO; using System.Diagnostics; using System.ComponentModel; using System.Collections.Generic; -using NovetusFuncs; namespace NovetusLauncher { @@ -189,7 +188,7 @@ namespace NovetusLauncher } //discord - LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.UserConfiguration.Map); LauncherFuncs.ReloadLoadtextValue(); } @@ -224,12 +223,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } break; @@ -243,9 +242,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -264,33 +263,33 @@ namespace NovetusLauncher listBox1.Enabled = true; listBox2.Enabled = true; listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -310,9 +309,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.facedir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -325,12 +324,12 @@ namespace NovetusLauncher } listBox4.SelectedItem = GlobalVars.UserCustomization.Face; listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -351,9 +350,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.tshirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -366,12 +365,12 @@ namespace NovetusLauncher } listBox5.SelectedItem = GlobalVars.UserCustomization.TShirt; listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -381,7 +380,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; } break; @@ -398,9 +397,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.shirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -413,12 +412,12 @@ namespace NovetusLauncher } listBox6.SelectedItem = GlobalVars.UserCustomization.Shirt; listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -428,7 +427,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; } break; @@ -445,9 +444,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.pantsdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -460,12 +459,12 @@ namespace NovetusLauncher } listBox7.SelectedItem = GlobalVars.UserCustomization.Pants; listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -475,7 +474,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\NoPants.png"); pictureBox7.Image = icon1; } break; @@ -491,9 +490,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -506,12 +505,12 @@ namespace NovetusLauncher } listBox8.SelectedItem = GlobalVars.UserCustomization.Head; listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -531,9 +530,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox8.Items.Clear(); - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -548,9 +547,9 @@ namespace NovetusLauncher if (GlobalVars.UserCustomization.ShowHatsInExtra == true) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -573,11 +572,11 @@ namespace NovetusLauncher listBox9.Enabled = true; try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -586,13 +585,13 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -625,15 +624,15 @@ namespace NovetusLauncher void ListBox1SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -644,15 +643,15 @@ namespace NovetusLauncher void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -663,15 +662,15 @@ namespace NovetusLauncher void ListBox3SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -682,45 +681,45 @@ namespace NovetusLauncher void Button41Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { Random random = new Random(); int randomHat1 = random.Next(listBox1.Items.Count); listBox1.SelectedItem = listBox1.Items[randomHat1]; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; int randomHat2 = random.Next(listBox2.Items.Count); listBox2.SelectedItem = listBox1.Items[randomHat2]; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; int randomHat3 = random.Next(listBox3.Items.Count); listBox3.SelectedItem = listBox1.Items[randomHat3]; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -731,41 +730,41 @@ namespace NovetusLauncher void Button42Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { listBox1.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; listBox2.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; listBox3.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -778,15 +777,15 @@ namespace NovetusLauncher void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -797,18 +796,18 @@ namespace NovetusLauncher void Button45Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { Random random = new Random(); int randomFace1 = random.Next(listBox4.Items.Count); listBox4.SelectedItem = listBox4.Items[randomFace1]; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -819,16 +818,16 @@ namespace NovetusLauncher void Button44Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { listBox4.SelectedItem = "DefaultFace.rbxm"; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -841,19 +840,19 @@ namespace NovetusLauncher void ListBox5SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { string previtem = listBox5.SelectedItem.ToString(); textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox5.SelectedItem = previtem; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -864,7 +863,7 @@ namespace NovetusLauncher void Button47Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; @@ -872,12 +871,12 @@ namespace NovetusLauncher int randomTShirt1 = random.Next(listBox5.Items.Count); listBox5.SelectedItem = listBox5.Items[randomTShirt1]; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -888,18 +887,18 @@ namespace NovetusLauncher void Button46Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox5.SelectedItem = "NoTShirt.rbxm"; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -912,19 +911,19 @@ namespace NovetusLauncher void ListBox6SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { string previtem = listBox6.SelectedItem.ToString(); textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox6.SelectedItem = previtem; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -935,7 +934,7 @@ namespace NovetusLauncher void Button49Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; @@ -943,12 +942,12 @@ namespace NovetusLauncher int randomShirt1 = random.Next(listBox6.Items.Count); listBox6.SelectedItem = listBox6.Items[randomShirt1]; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -959,18 +958,18 @@ namespace NovetusLauncher void Button48Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox6.SelectedItem = "NoShirt.rbxm"; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -983,19 +982,19 @@ namespace NovetusLauncher void ListBox7SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { string previtem = listBox7.SelectedItem.ToString(); textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox7.SelectedItem = previtem; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1006,7 +1005,7 @@ namespace NovetusLauncher void Button51Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; @@ -1014,12 +1013,12 @@ namespace NovetusLauncher int randomPants1 = random.Next(listBox7.Items.Count); listBox7.SelectedItem = listBox7.Items[randomPants1]; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1030,18 +1029,18 @@ namespace NovetusLauncher void Button50Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox7.SelectedItem = "NoPants.rbxm"; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1054,15 +1053,15 @@ namespace NovetusLauncher void ListBox8SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1073,18 +1072,18 @@ namespace NovetusLauncher void Button57Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { Random random = new Random(); int randomHead1 = random.Next(listBox8.Items.Count); listBox8.SelectedItem = listBox8.Items[randomHead1]; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1095,16 +1094,16 @@ namespace NovetusLauncher void Button56Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { listBox8.SelectedItem = "DefaultHead.rbxm"; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1445,8 +1444,8 @@ namespace NovetusLauncher { LauncherFuncs.ReloadLoadtextValue(); string luafile = "rbxasset://scripts\\\\CSView.lua"; - string mapfile = GlobalVars.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; - string rbxexe = GlobalVars.BasePathLauncher + "\\preview\\3DView.exe"; + string mapfile = Directories.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; + string rbxexe = Directories.BasePathLauncher + "\\preview\\3DView.exe"; string quote = "\""; string args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CS3DView(0,'Player'," + GlobalVars.loadtext + ");" + quote; try @@ -1457,7 +1456,7 @@ namespace NovetusLauncher client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1497,34 +1496,34 @@ namespace NovetusLauncher void ListBox9SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1537,7 +1536,7 @@ namespace NovetusLauncher void Button59Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { Random random = new Random(); int randomItem1 = random.Next(listBox9.Items.Count); @@ -1545,29 +1544,29 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1580,35 +1579,35 @@ namespace NovetusLauncher void Button58Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { listBox9.SelectedItem = "NoExtra.rbxm"; try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1626,9 +1625,9 @@ namespace NovetusLauncher case true: GlobalVars.UserCustomization.ShowHatsInExtra = true; - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1650,9 +1649,9 @@ namespace NovetusLauncher GlobalVars.UserCustomization.ShowHatsInExtra = false; listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1669,12 +1668,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1683,15 +1682,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1723,12 +1722,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } } @@ -1785,7 +1784,7 @@ namespace NovetusLauncher private void button71_Click(object sender, EventArgs e) { - LauncherFuncs.Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); MessageBox.Show("Outfit Saved!"); } diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs index 90d21ad..85951fe 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs @@ -13,8 +13,6 @@ using System.IO; using System.Diagnostics; using System.ComponentModel; using System.Collections.Generic; -using NovetusFuncs; -using System.Linq.Expressions; namespace NovetusLauncher { @@ -187,7 +185,7 @@ namespace NovetusLauncher } //discord - LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.UserConfiguration.Map); LauncherFuncs.ReloadLoadtextValue(); } @@ -220,12 +218,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } break; @@ -238,9 +236,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -259,33 +257,33 @@ namespace NovetusLauncher listBox1.Enabled = true; listBox2.Enabled = true; listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -304,9 +302,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.facedir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -319,12 +317,12 @@ namespace NovetusLauncher } listBox4.SelectedItem = GlobalVars.UserCustomization.Face; listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -345,9 +343,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.tshirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -360,12 +358,12 @@ namespace NovetusLauncher } listBox5.SelectedItem = GlobalVars.UserCustomization.TShirt; listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -375,7 +373,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; } break; @@ -392,9 +390,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.shirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -407,12 +405,12 @@ namespace NovetusLauncher } listBox6.SelectedItem = GlobalVars.UserCustomization.Shirt; listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -422,7 +420,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; } break; @@ -439,9 +437,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.pantsdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -454,12 +452,12 @@ namespace NovetusLauncher } listBox7.SelectedItem = GlobalVars.UserCustomization.Pants; listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -469,7 +467,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\NoPants.png"); pictureBox7.Image = icon1; } break; @@ -484,9 +482,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -499,12 +497,12 @@ namespace NovetusLauncher } listBox8.SelectedItem = GlobalVars.UserCustomization.Head; listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -523,9 +521,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox8.Items.Clear(); - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -540,9 +538,9 @@ namespace NovetusLauncher if (GlobalVars.UserCustomization.ShowHatsInExtra == true) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -565,11 +563,11 @@ namespace NovetusLauncher listBox9.Enabled = true; try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -578,13 +576,13 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -617,15 +615,15 @@ namespace NovetusLauncher void ListBox1SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -636,15 +634,15 @@ namespace NovetusLauncher void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -655,15 +653,15 @@ namespace NovetusLauncher void ListBox3SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -674,45 +672,45 @@ namespace NovetusLauncher void Button41Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { Random random = new Random(); int randomHat1 = random.Next(listBox1.Items.Count); listBox1.SelectedItem = listBox1.Items[randomHat1]; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; int randomHat2 = random.Next(listBox2.Items.Count); listBox2.SelectedItem = listBox1.Items[randomHat2]; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; int randomHat3 = random.Next(listBox3.Items.Count); listBox3.SelectedItem = listBox1.Items[randomHat3]; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -723,41 +721,41 @@ namespace NovetusLauncher void Button42Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { listBox1.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; listBox2.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; listBox3.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -770,15 +768,15 @@ namespace NovetusLauncher void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -789,18 +787,18 @@ namespace NovetusLauncher void Button45Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { Random random = new Random(); int randomFace1 = random.Next(listBox4.Items.Count); listBox4.SelectedItem = listBox4.Items[randomFace1]; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -811,16 +809,16 @@ namespace NovetusLauncher void Button44Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.facedir)) + if (Directory.Exists(Directories.facedir)) { listBox4.SelectedItem = "DefaultFace.rbxm"; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -833,19 +831,19 @@ namespace NovetusLauncher void ListBox5SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { string previtem = listBox5.SelectedItem.ToString(); textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox5.SelectedItem = previtem; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -856,7 +854,7 @@ namespace NovetusLauncher void Button47Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; @@ -864,12 +862,12 @@ namespace NovetusLauncher int randomTShirt1 = random.Next(listBox5.Items.Count); listBox5.SelectedItem = listBox5.Items[randomTShirt1]; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -880,18 +878,18 @@ namespace NovetusLauncher void Button46Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.tshirtdir)) + if (Directory.Exists(Directories.tshirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox5.SelectedItem = "NoTShirt.rbxm"; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -904,19 +902,19 @@ namespace NovetusLauncher void ListBox6SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { string previtem = listBox6.SelectedItem.ToString(); textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox6.SelectedItem = previtem; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -927,7 +925,7 @@ namespace NovetusLauncher void Button49Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; @@ -935,12 +933,12 @@ namespace NovetusLauncher int randomShirt1 = random.Next(listBox6.Items.Count); listBox6.SelectedItem = listBox6.Items[randomShirt1]; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -951,18 +949,18 @@ namespace NovetusLauncher void Button48Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.shirtdir)) + if (Directory.Exists(Directories.shirtdir)) { textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox6.SelectedItem = "NoShirt.rbxm"; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -975,19 +973,19 @@ namespace NovetusLauncher void ListBox7SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { string previtem = listBox7.SelectedItem.ToString(); textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox7.SelectedItem = previtem; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -998,7 +996,7 @@ namespace NovetusLauncher void Button51Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; @@ -1006,12 +1004,12 @@ namespace NovetusLauncher int randomPants1 = random.Next(listBox7.Items.Count); listBox7.SelectedItem = listBox7.Items[randomPants1]; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1022,18 +1020,18 @@ namespace NovetusLauncher void Button50Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.pantsdir)) + if (Directory.Exists(Directories.pantsdir)) { textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox7.SelectedItem = "NoPants.rbxm"; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1046,15 +1044,15 @@ namespace NovetusLauncher void ListBox8SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1065,18 +1063,18 @@ namespace NovetusLauncher void Button57Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { Random random = new Random(); int randomHead1 = random.Next(listBox8.Items.Count); listBox8.SelectedItem = listBox8.Items[randomHead1]; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1087,16 +1085,16 @@ namespace NovetusLauncher void Button56Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.headdir)) + if (Directory.Exists(Directories.headdir)) { listBox8.SelectedItem = "DefaultHead.rbxm"; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1437,8 +1435,8 @@ namespace NovetusLauncher { LauncherFuncs.ReloadLoadtextValue(); string luafile = "rbxasset://scripts\\\\CSView.lua"; - string mapfile = GlobalVars.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; - string rbxexe = GlobalVars.BasePathLauncher + "\\preview\\3DView.exe"; + string mapfile = Directories.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; + string rbxexe = Directories.BasePathLauncher + "\\preview\\3DView.exe"; string quote = "\""; string args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CS3DView(0,'Player'," + GlobalVars.loadtext + ");" + quote; try @@ -1449,7 +1447,7 @@ namespace NovetusLauncher client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1486,37 +1484,37 @@ namespace NovetusLauncher } //extra - + void ListBox9SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1529,7 +1527,7 @@ namespace NovetusLauncher void Button59Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { Random random = new Random(); int randomItem1 = random.Next(listBox9.Items.Count); @@ -1537,29 +1535,29 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1572,35 +1570,35 @@ namespace NovetusLauncher void Button58Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { listBox9.SelectedItem = "NoExtra.rbxm"; try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.UserCustomization.Extra; } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1618,9 +1616,9 @@ namespace NovetusLauncher case true: GlobalVars.UserCustomization.ShowHatsInExtra = true; - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1642,9 +1640,9 @@ namespace NovetusLauncher GlobalVars.UserCustomization.ShowHatsInExtra = false; listBox9.Items.Clear(); - if (Directory.Exists(GlobalVars.extradir)) + if (Directory.Exists(Directories.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1661,12 +1659,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1675,15 +1673,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(GlobalVars.hatdir)) + if (Directory.Exists(Directories.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1715,12 +1713,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } } @@ -1777,7 +1775,7 @@ namespace NovetusLauncher private void button71_Click(object sender, EventArgs e) { - LauncherFuncs.Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); MessageBox.Show("Outfit Saved!"); } diff --git a/NovetusLauncher/NovetusLauncher/LocalVars.cs b/NovetusLauncher/NovetusLauncher/LocalVars.cs index 7092c0c..086314d 100644 --- a/NovetusLauncher/NovetusLauncher/LocalVars.cs +++ b/NovetusLauncher/NovetusLauncher/LocalVars.cs @@ -2,9 +2,46 @@ namespace NovetusLauncher { + #region Classes + + #region LocalVars class LocalVars { public static int Clicks = 0; public static string prevsplash = ""; + public static int DefaultRobloxPort = 53640; + public static bool LocalPlayMode = false; } + #endregion + + #region Roblox Type Definitions + public class RobloxTypeDefs + { + public static AssetCacheDef Fonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { Directories.AssetCacheDirFonts, Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheFontsGameDir, Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Sky { get { return new AssetCacheDef("Sky", new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirSky }, new string[] { Directories.AssetCacheSkyGameDir }); } } + public static AssetCacheDef Decal { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Texture { get { return new AssetCacheDef("Texture", new string[] { "Texture" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef HopperBin { get { return new AssetCacheDef("HopperBin", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Tool { get { return new AssetCacheDef("Tool", new string[] { "TextureId" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Sound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { Directories.AssetCacheDirSounds }, new string[] { Directories.AssetCacheSoundsGameDir }); } } + public static AssetCacheDef ImageLabel { get { return new AssetCacheDef("ImageLabel", new string[] { "Image" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Shirt { get { return new AssetCacheDef("Shirt", new string[] { "ShirtTemplate" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef ShirtGraphic { get { return new AssetCacheDef("ShirtGraphic", new string[] { "Graphic" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Pants { get { return new AssetCacheDef("Pants", new string[] { "PantsTemplate" }, new string[] { ".png" }, new string[] { Directories.AssetCacheDirTextures }, new string[] { Directories.AssetCacheTexturesGameDir }); } } + public static AssetCacheDef Script { get { return new AssetCacheDef("Script", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { Directories.AssetCacheDirScripts }, new string[] { Directories.AssetCacheScriptsGameDir }); } } + public static AssetCacheDef LocalScript { get { return new AssetCacheDef("LocalScript", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { Directories.AssetCacheDirScripts }, new string[] { Directories.AssetCacheScriptsGameDir }); } } + //item defs below + public static AssetCacheDef ItemHatFonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { Directories.hatdirFonts, Directories.hatdirTextures }, new string[] { Directories.hatGameDirFonts, Directories.hatGameDirTextures }); } } + public static AssetCacheDef ItemHatSound { get { return new AssetCacheDef("Sound", new string[] { "SoundId" }, new string[] { ".wav" }, new string[] { Directories.hatdirSounds }, new string[] { Directories.hatGameDirSounds }); } } + public static AssetCacheDef ItemHatScript { get { return new AssetCacheDef("Script", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { Directories.hatdirScripts }, new string[] { Directories.hatGameDirScripts }); } } + public static AssetCacheDef ItemHatLocalScript { get { return new AssetCacheDef("LocalScript", new string[] { "LinkedSource" }, new string[] { ".lua" }, new string[] { Directories.hatdirScripts }, new string[] { Directories.hatGameDirScripts }); } } + public static AssetCacheDef ItemHeadFonts { get { return new AssetCacheDef("SpecialMesh", new string[] { "MeshId", "TextureId" }, new string[] { ".mesh", ".png" }, new string[] { Directories.headdirFonts, Directories.headdirTextures }, new string[] { Directories.headGameDirFonts, Directories.headGameDirTextures }); } } + public static AssetCacheDef ItemFaceTexture { get { return new AssetCacheDef("Decal", new string[] { "Texture" }, new string[] { ".png" }, new string[] { Directories.facedirTextures }, new string[] { Directories.faceGameDirTextures }); } } + public static AssetCacheDef ItemShirtTexture { get { return new AssetCacheDef("Shirt", new string[] { "ShirtTemplate" }, new string[] { ".png" }, new string[] { Directories.shirtdirTextures }, new string[] { Directories.shirtGameDirTextures }); } } + public static AssetCacheDef ItemTShirtTexture { get { return new AssetCacheDef("ShirtGraphic", new string[] { "Graphic" }, new string[] { ".png" }, new string[] { Directories.tshirtdirTextures }, new string[] { Directories.tshirtGameDirTextures }); } } + public static AssetCacheDef ItemPantsTexture { get { return new AssetCacheDef("Pants", new string[] { "PantsTemplate" }, new string[] { ".png" }, new string[] { Directories.pantsdirTextures }, new string[] { Directories.pantsGameDirTextures }); } } + } + #endregion + + #endregion } diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs index 5e3ac9c..6124173 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs @@ -45,14 +45,14 @@ namespace NovetusLauncher #region UPnP public void InitUPnP() { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); } @@ -61,14 +61,14 @@ namespace NovetusLauncher public void StartUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); } @@ -77,14 +77,14 @@ namespace NovetusLauncher public void StopUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); } @@ -97,12 +97,12 @@ namespace NovetusLauncher { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3); - StartUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StartUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); } @@ -114,12 +114,12 @@ namespace NovetusLauncher { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3); - StopUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StopUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); } @@ -156,7 +156,7 @@ namespace NovetusLauncher void StartDiscord() { - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { handlers = new DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; @@ -180,10 +180,10 @@ namespace NovetusLauncher { try { - GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.ServerDir, GlobalVars.WebServer_Port); + GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); label17.Visible = false; @@ -205,7 +205,7 @@ namespace NovetusLauncher ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); GlobalVars.WebServer.Stop(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); } @@ -234,22 +234,22 @@ namespace NovetusLauncher textBox3.Text = ""; string[] lines1 = { SecurityFuncs.Base64Encode(IP), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); string[] lines2 = { SecurityFuncs.Base64Encode("localhost"), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); string[] text = { - "Client: " + GlobalVars.SelectedClient, + "Client: " + GlobalVars.UserConfiguration.SelectedClient, "IP: " + IP, - "Port: " + GlobalVars.RobloxPort.ToString(), - "Map: " + GlobalVars.Map, - "Players: " + GlobalVars.PlayerLimit, + "Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(), + "Map: " + GlobalVars.UserConfiguration.Map, + "Players: " + GlobalVars.UserConfiguration.PlayerLimit, "Version: Novetus " + GlobalVars.Version, "Online URI Link:", URI, @@ -273,10 +273,10 @@ namespace NovetusLauncher textBox3.ScrollToCaret(); break; case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: - string mapdir = GlobalVars.MapsDir; + string mapdir = Directories.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); textBox3.Text = ""; listBox2.Items.Clear(); @@ -284,14 +284,14 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: - string clientdir = GlobalVars.ClientDir; + string clientdir = Directories.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) { listBox2.Items.Add(dir.Name); } - listBox2.SelectedItem = GlobalVars.SelectedClient; + listBox2.SelectedItem = GlobalVars.UserConfiguration.SelectedClient; treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); textBox4.Text = ""; @@ -300,8 +300,8 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox3.Items.AddRange(lines_server); listBox4.Items.AddRange(lines_ports); treeView1.Nodes.Clear(); @@ -324,7 +324,7 @@ namespace NovetusLauncher void Button1Click(object sender, EventArgs e) { - if (GlobalVars.LocalPlayMode == true) + if (LocalVars.LocalPlayMode == true) { GeneratePlayerID(); GenerateTripcode(); @@ -336,7 +336,7 @@ namespace NovetusLauncher StartClient(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -347,7 +347,7 @@ namespace NovetusLauncher WriteConfigValues(); StartServer(false); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -361,7 +361,7 @@ namespace NovetusLauncher WriteConfigValues(); StartStudio(false); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -372,7 +372,7 @@ namespace NovetusLauncher WriteConfigValues(); StartServer(true); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -383,7 +383,7 @@ namespace NovetusLauncher WriteConfigValues(); StartSolo(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -397,7 +397,7 @@ namespace NovetusLauncher WriteConfigValues(); StartStudio(true); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -407,69 +407,69 @@ namespace NovetusLauncher { Text = "Novetus " + GlobalVars.Version; ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4); - ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4); - if (File.Exists(GlobalVars.RootPath + "\\changelog.txt")) + ConsolePrint("Novetus path: " + Directories.BasePath, 4); + if (File.Exists(Directories.RootPath + "\\changelog.txt")) { - richTextBox2.Text = File.ReadAllText(GlobalVars.RootPath + "\\changelog.txt"); + richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt"); } else { - ConsolePrint("ERROR - " + GlobalVars.RootPath + "\\changelog.txt not found.", 2); + ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2); } - if (File.Exists(GlobalVars.RootPath + "\\credits.txt")) + if (File.Exists(Directories.RootPath + "\\credits.txt")) { - richTextBox3.Text = File.ReadAllText(GlobalVars.RootPath + "\\credits.txt"); + richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt"); } else { - ConsolePrint("ERROR - " + GlobalVars.RootPath + "\\credits.txt not found.", 2); + ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2); } - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); WriteCustomizationValues(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\servers.txt")) + if (!File.Exists(Directories.ConfigDir + "\\servers.txt")) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); - File.Create(GlobalVars.ConfigDir + "\\servers.txt").Dispose(); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); + File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\ports.txt")) + if (!File.Exists(Directories.ConfigDir + "\\ports.txt")) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); - File.Create(GlobalVars.ConfigDir + "\\ports.txt").Dispose(); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); + File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(GlobalVars.AssetCacheDirFonts)) + if (!Directory.Exists(Directories.AssetCacheDirFonts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirFonts); + Directory.CreateDirectory(Directories.AssetCacheDirFonts); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSky)) + if (!Directory.Exists(Directories.AssetCacheDirSky)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSky); + Directory.CreateDirectory(Directories.AssetCacheDirSky); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSounds)) + if (!Directory.Exists(Directories.AssetCacheDirSounds)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSounds); + Directory.CreateDirectory(Directories.AssetCacheDirSounds); } - if (!Directory.Exists(GlobalVars.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(GlobalVars.AssetCacheDirScripts)) + if (!Directory.Exists(Directories.AssetCacheDirScripts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirScripts); + Directory.CreateDirectory(Directories.AssetCacheDirScripts); } label8.Text = Application.ProductVersion; @@ -487,11 +487,11 @@ namespace NovetusLauncher void MainFormClose(object sender, CancelEventArgs e) { - if (GlobalVars.LocalPlayMode != true) + if (LocalVars.LocalPlayMode != true) { WriteConfigValues(); } - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { DiscordRpc.Shutdown(); } @@ -503,27 +503,27 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); - checkBox1.Checked = GlobalVars.CloseOnLaunch; - textBox5.Text = GlobalVars.UserID.ToString(); - label18.Text = GlobalVars.PlayerTripcode.ToString(); - numericUpDown3.Value = Convert.ToDecimal(GlobalVars.PlayerLimit); - textBox2.Text = GlobalVars.PlayerName; - label26.Text = GlobalVars.SelectedClient; - label28.Text = GlobalVars.Map; - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; + textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString(); + label18.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); + numericUpDown3.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit); + textBox2.Text = GlobalVars.UserConfiguration.PlayerName; + label26.Text = GlobalVars.UserConfiguration.SelectedClient; + label28.Text = GlobalVars.UserConfiguration.Map; + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); label37.Text = GlobalVars.IP; - label38.Text = GlobalVars.RobloxPort.ToString(); - checkBox2.Checked = GlobalVars.DiscordPresence; - checkBox5.Checked = GlobalVars.ReShade; + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); + checkBox2.Checked = GlobalVars.UserConfiguration.DiscordPresence; + checkBox5.Checked = GlobalVars.UserConfiguration.ReShade; checkBox6.Checked = GlobalVars.ReShadeFPSDisplay; checkBox7.Checked = GlobalVars.ReShadePerformanceMode; - switch (GlobalVars.GraphicsMode) + switch (GlobalVars.UserConfiguration.GraphicsMode) { case GraphicsMode.DirectX: comboBox1.SelectedIndex = 1; @@ -534,7 +534,7 @@ namespace NovetusLauncher break; } - switch (GlobalVars.QualityLevel) + switch (GlobalVars.UserConfiguration.QualityLevel) { case QualityLevel.VeryLow: comboBox2.SelectedIndex = 0; @@ -555,30 +555,30 @@ namespace NovetusLauncher } ConsolePrint("Config loaded.", 3); - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); } void WriteConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } void WriteCustomizationValues() { - LauncherFuncs.Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); ConsolePrint("Config Saved.", 3); } void ReadClientValues(string ClientName) { - string clientpath = GlobalVars.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); - GlobalVars.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; ReadClientValues(ClientName); } else @@ -609,7 +609,7 @@ namespace NovetusLauncher textBox5.Enabled = false; button4.Enabled = false; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; break; } @@ -624,34 +624,34 @@ namespace NovetusLauncher } textBox6.Text = GlobalVars.SelectedClientInfo.Description; - label26.Text = GlobalVars.SelectedClient; - ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); + label26.Text = GlobalVars.UserConfiguration.SelectedClient; + ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3); } } void GeneratePlayerID() { LauncherFuncs.GeneratePlayerID(); - textBox5.Text = Convert.ToString(GlobalVars.UserID); + textBox5.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID); } void GenerateTripcode() { LauncherFuncs.GenerateTripcode(); - label18.Text = GlobalVars.PlayerTripcode; + label18.Text = GlobalVars.UserConfiguration.PlayerTripcode; } void TextBox1TextChanged(object sender, EventArgs e) { GlobalVars.IP = textBox1.Text; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; label37.Text = GlobalVars.IP; } void CheckBox1CheckedChanged(object sender, EventArgs e) { - GlobalVars.CloseOnLaunch = checkBox1.Checked; + GlobalVars.UserConfiguration.CloseOnLaunch = checkBox1.Checked; } void Button4Click(object sender, EventArgs e) @@ -667,19 +667,19 @@ namespace NovetusLauncher void TextBox2TextChanged(object sender, EventArgs e) { - GlobalVars.PlayerName = textBox2.Text; + GlobalVars.UserConfiguration.PlayerName = textBox2.Text; } void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - GlobalVars.SelectedClient = listBox2.SelectedItem.ToString(); - ReadClientValues(GlobalVars.SelectedClient); + GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString(); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); } void CheckBox3CheckedChanged(object sender, EventArgs e) { - GlobalVars.LocalPlayMode = checkBox3.Checked; + LocalVars.LocalPlayMode = checkBox3.Checked; } void TextBox5TextChanged(object sender, EventArgs e) @@ -689,16 +689,16 @@ namespace NovetusLauncher { if (textBox5.Text.Equals("")) { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } else { - GlobalVars.UserID = Convert.ToInt32(textBox5.Text); + GlobalVars.UserConfiguration.UserID = Convert.ToInt32(textBox5.Text); } } else { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } } @@ -719,34 +719,34 @@ namespace NovetusLauncher GlobalVars.IP = listBox3.SelectedItem.ToString(); textBox1.Text = GlobalVars.IP; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; label37.Text = GlobalVars.IP; } void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(listBox4.SelectedItem.ToString()); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(listBox4.SelectedItem.ToString()); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); } void Button10Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); } void Button11Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button12Click(object sender, EventArgs e) { if (listBox3.SelectedIndex >= 0) { - TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.ConfigDir + "\\servers.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp"); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } } @@ -755,42 +755,42 @@ namespace NovetusLauncher { if (listBox4.SelectedIndex >= 0) { - TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.ConfigDir + "\\ports.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp"); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } } void Button14Click(object sender, EventArgs e) { - File.Create(GlobalVars.ConfigDir + "\\servers.txt").Dispose(); + File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button15Click(object sender, EventArgs e) { - File.Create(GlobalVars.ConfigDir + "\\ports.txt").Dispose(); + File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } void Button16Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button17Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } @@ -895,9 +895,9 @@ namespace NovetusLauncher { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { - if (SecurityFuncs.checkClientMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { - if (SecurityFuncs.checkScriptMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { OpenClient(rbxexe,args); } @@ -923,7 +923,7 @@ namespace NovetusLauncher OpenClient(rbxexe,args); } } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -936,18 +936,18 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.UserConfiguration.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.UserConfiguration.Map); } void ClientExited(object sender, EventArgs e) { LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -955,7 +955,7 @@ namespace NovetusLauncher void ServerExited(object sender, EventArgs e) { - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -965,7 +965,7 @@ namespace NovetusLauncher { LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); label12.Text = LocalVars.prevsplash; - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -975,7 +975,7 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Solo); - string mapfile = GlobalVars.MapPath; + string mapfile = GlobalVars.UserConfiguration.MapPath; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1001,14 +1001,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.UserConfiguration.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.UserConfiguration.Map); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1019,7 +1019,7 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Server); - string mapfile = GlobalVars.MapPath; + string mapfile = GlobalVars.UserConfiguration.MapPath; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1053,13 +1053,13 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.UserConfiguration.Map); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1070,8 +1070,8 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Studio); - string mapfile = (nomap ? "" : GlobalVars.MapPath); - string mapname = (nomap ? "" : GlobalVars.Map); + string mapfile = (nomap ? "" : GlobalVars.UserConfiguration.MapPath); + string mapname = (nomap ? "" : GlobalVars.UserConfiguration.Map); string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1097,14 +1097,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; SecurityFuncs.RenameWindow(client, ScriptType.Studio, mapname); LauncherFuncs.UpdateRichPresence(LauncherState.InStudio, mapname); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1116,7 +1116,7 @@ namespace NovetusLauncher label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); - string mapfile = GlobalVars.ConfigDirData + "\\Appreciation.rbxl"; + string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1142,14 +1142,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Start(); client.Exited += new EventHandler(EasterEggExited); client.PriorityClass = ProcessPriorityClass.RealTime; SecurityFuncs.RenameWindow(client, ScriptType.EasterEgg, ""); LauncherFuncs.UpdateRichPresence(LauncherState.InEasterEggGame, ""); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Easter Egg. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Easter Egg. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1220,7 +1220,7 @@ namespace NovetusLauncher StopWebServer(); StartWebServer(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); } @@ -1273,7 +1273,7 @@ namespace NovetusLauncher { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = GlobalVars.ClientDir + @"\\" + GlobalVars.RegisterClient1 + @"\\RobloxApp_studio.exe"; + startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.RegisterClient1 + @"\\RobloxApp_studio.exe"; startInfo.Arguments = "/regserver"; startInfo.Verb = "runas"; process.StartInfo = startInfo; @@ -1281,7 +1281,7 @@ namespace NovetusLauncher Process process2 = new Process(); ProcessStartInfo startInfo2 = new ProcessStartInfo(); - startInfo2.FileName = GlobalVars.ClientDir + @"\\" + GlobalVars.RegisterClient2 + @"\\RobloxApp_studio.exe"; + startInfo2.FileName = Directories.ClientDir + @"\\" + GlobalVars.RegisterClient2 + @"\\RobloxApp_studio.exe"; startInfo2.Arguments = "/regserver"; startInfo2.Verb = "runas"; process2.StartInfo = startInfo2; @@ -1290,7 +1290,7 @@ namespace NovetusLauncher ConsolePrint("UserAgent Library successfully installed and registered!", 3); MessageBox.Show("UserAgent Library successfully installed and registered!", "Novetus - Register UserAgent Library", MessageBoxButtons.OK, MessageBoxIcon.Information); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to register. (" + ex.Message + ")", 2); MessageBox.Show("Failed to register. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1305,54 +1305,54 @@ namespace NovetusLauncher void NumericUpDown1ValueChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown1.Value); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown1.Value); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); } void NumericUpDown2ValueChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown2.Value); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown2.Value); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); } void NumericUpDown3ValueChanged(object sender, EventArgs e) { - GlobalVars.PlayerLimit = Convert.ToInt32(numericUpDown3.Value); + GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(numericUpDown3.Value); } void Button7Click(object sender, EventArgs e) { - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - GlobalVars.RobloxPort = GlobalVars.DefaultRobloxPort; + numericUpDown1.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + numericUpDown2.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + GlobalVars.UserConfiguration.RobloxPort = LocalVars.DefaultRobloxPort; } void Button23Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button22Click(object sender, EventArgs e) { - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - GlobalVars.RobloxPort = GlobalVars.DefaultRobloxPort; + numericUpDown1.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + numericUpDown2.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + GlobalVars.UserConfiguration.RobloxPort = LocalVars.DefaultRobloxPort; } void TreeView1AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Nodes.Count == 0) { - GlobalVars.Map = treeView1.SelectedNode.Text.ToString(); - GlobalVars.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); - GlobalVars.MapPath = GlobalVars.BasePath + @"\\" + GlobalVars.MapPathSnip; - label28.Text = GlobalVars.Map; + GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString(); + GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); + GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; + label28.Text = GlobalVars.UserConfiguration.Map; - if (File.Exists(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1363,12 +1363,12 @@ namespace NovetusLauncher void Button6Click(object sender, EventArgs e) { - Process.Start("explorer.exe", GlobalVars.MapsDir.Replace(@"\\",@"\")); + Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\")); } void CheckBox4CheckedChanged(object sender, EventArgs e) { - GlobalVars.UPnP = checkBox4.Checked; + GlobalVars.UserConfiguration.UPnP = checkBox4.Checked; } void CheckBox4Click(object sender, EventArgs e) @@ -1380,14 +1380,14 @@ namespace NovetusLauncher { treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); - string mapdir = GlobalVars.MapsDir; + string mapdir = Directories.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - if (File.Exists(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1423,9 +1423,9 @@ namespace NovetusLauncher private void button26_Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.AssetCacheDir)) + if (Directory.Exists(Directories.AssetCacheDir)) { - Directory.Delete(GlobalVars.AssetCacheDir, true); + Directory.Delete(Directories.AssetCacheDir, true); ConsolePrint("Asset cache cleared!", 3); MessageBox.Show("Asset cache cleared!"); } @@ -1437,7 +1437,7 @@ namespace NovetusLauncher private void checkBox2_CheckedChanged(object sender, EventArgs e) { - GlobalVars.DiscordPresence = checkBox2.Checked; + GlobalVars.UserConfiguration.DiscordPresence = checkBox2.Checked; MessageBox.Show("Restart the launcher to apply changes."); } @@ -1495,7 +1495,7 @@ namespace NovetusLauncher switch(LocalVars.Clicks) { case 1: - label12.Text = "Hi " + GlobalVars.PlayerName + "!"; + label12.Text = "Hi " + GlobalVars.UserConfiguration.PlayerName + "!"; break; case 3: label12.Text = "How are you doing today?"; @@ -1510,7 +1510,7 @@ namespace NovetusLauncher WriteConfigValues(); StartEasterEgg(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -1523,7 +1523,7 @@ namespace NovetusLauncher private void checkBox5_CheckedChanged(object sender, EventArgs e) { - GlobalVars.ReShade = checkBox5.Checked; + GlobalVars.UserConfiguration.ReShade = checkBox5.Checked; } private void checkBox6_CheckedChanged(object sender, EventArgs e) @@ -1541,10 +1541,10 @@ namespace NovetusLauncher switch (comboBox1.SelectedIndex) { case 1: - GlobalVars.GraphicsMode = GraphicsMode.DirectX; + GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX; break; default: - GlobalVars.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; break; } } @@ -1554,27 +1554,27 @@ namespace NovetusLauncher switch (comboBox2.SelectedIndex) { case 0: - GlobalVars.QualityLevel = QualityLevel.VeryLow; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow; break; case 1: - GlobalVars.QualityLevel = QualityLevel.Low; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low; break; case 2: - GlobalVars.QualityLevel = QualityLevel.Medium; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium; break; case 3: - GlobalVars.QualityLevel = QualityLevel.High; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High; break; case 4: default: - GlobalVars.QualityLevel = QualityLevel.Ultra; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; break; } } private void button36_Click(object sender, EventArgs e) { - GlobalVars.OldLayout = true; + GlobalVars.UserConfiguration.OldLayout = true; WriteConfigValues(); Application.Restart(); } diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs index f8fca71..2e59e2d 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs @@ -44,14 +44,14 @@ namespace NovetusLauncher #region UPnP public void InitUPnP() { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); } @@ -60,14 +60,14 @@ namespace NovetusLauncher public void StartUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); } @@ -76,14 +76,14 @@ namespace NovetusLauncher public void StopUPnP(INatDevice device, Protocol protocol, int port) { - if (GlobalVars.UPnP == true) + if (GlobalVars.UserConfiguration.UPnP == true) { try { UPnP.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); } @@ -96,12 +96,12 @@ namespace NovetusLauncher { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' registered.", 3); - StartUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StartUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StartUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StartUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StartUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); } @@ -113,12 +113,12 @@ namespace NovetusLauncher { INatDevice device = args.Device; ConsolePrint("UPnP: Device '" + device.GetExternalIP() + "' disconnected.", 3); - StopUPnP(device, Protocol.Udp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Tcp, GlobalVars.RobloxPort); - StopUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); - StopUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); + StopUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); + StopUPnP(device, Protocol.Udp, GlobalVars.WebServerPort); + StopUPnP(device, Protocol.Tcp, GlobalVars.WebServerPort); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); } @@ -155,7 +155,7 @@ namespace NovetusLauncher void StartDiscord() { - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { handlers = new DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; @@ -179,10 +179,10 @@ namespace NovetusLauncher { try { - GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.ServerDir, GlobalVars.WebServer_Port); + GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); label17.Visible = false; @@ -204,7 +204,7 @@ namespace NovetusLauncher ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); GlobalVars.WebServer.Stop(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); } @@ -233,22 +233,22 @@ namespace NovetusLauncher textBox3.Text = ""; string[] lines1 = { SecurityFuncs.Base64Encode(IP), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); string[] lines2 = { SecurityFuncs.Base64Encode("localhost"), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) }; string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); string[] text = { - "Client: " + GlobalVars.SelectedClient, + "Client: " + GlobalVars.UserConfiguration.SelectedClient, "IP: " + IP, - "Port: " + GlobalVars.RobloxPort.ToString(), - "Map: " + GlobalVars.Map, - "Players: " + GlobalVars.PlayerLimit, + "Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(), + "Map: " + GlobalVars.UserConfiguration.Map, + "Players: " + GlobalVars.UserConfiguration.PlayerLimit, "Version: Novetus " + GlobalVars.Version, "Online URI Link:", URI, @@ -272,10 +272,10 @@ namespace NovetusLauncher textBox3.ScrollToCaret(); break; case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: - string mapdir = GlobalVars.MapsDir; + string mapdir = Directories.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); textBox3.Text = ""; listBox2.Items.Clear(); @@ -283,14 +283,14 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: - string clientdir = GlobalVars.ClientDir; + string clientdir = Directories.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) { listBox2.Items.Add(dir.Name); } - listBox2.SelectedItem = GlobalVars.SelectedClient; + listBox2.SelectedItem = GlobalVars.UserConfiguration.SelectedClient; treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); textBox4.Text = ""; @@ -299,8 +299,8 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox3.Items.AddRange(lines_server); listBox4.Items.AddRange(lines_ports); treeView1.Nodes.Clear(); @@ -323,7 +323,7 @@ namespace NovetusLauncher void Button1Click(object sender, EventArgs e) { - if (GlobalVars.LocalPlayMode == true) + if (LocalVars.LocalPlayMode == true) { GeneratePlayerID(); GenerateTripcode(); @@ -335,7 +335,7 @@ namespace NovetusLauncher StartClient(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -346,7 +346,7 @@ namespace NovetusLauncher WriteConfigValues(); StartServer(false); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -360,7 +360,7 @@ namespace NovetusLauncher WriteConfigValues(); StartStudio(false); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -371,7 +371,7 @@ namespace NovetusLauncher WriteConfigValues(); StartServer(true); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -382,7 +382,7 @@ namespace NovetusLauncher WriteConfigValues(); StartSolo(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -396,7 +396,7 @@ namespace NovetusLauncher WriteConfigValues(); StartStudio(true); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -406,69 +406,69 @@ namespace NovetusLauncher { Text = "Novetus " + GlobalVars.Version; ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4); - ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4); - if (File.Exists(GlobalVars.RootPath + "\\changelog.txt")) + ConsolePrint("Novetus path: " + Directories.BasePath, 4); + if (File.Exists(Directories.RootPath + "\\changelog.txt")) { - richTextBox2.Text = File.ReadAllText(GlobalVars.RootPath + "\\changelog.txt"); + richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt"); } else { - ConsolePrint("ERROR - " + GlobalVars.RootPath + "\\changelog.txt not found.", 2); + ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2); } - if (File.Exists(GlobalVars.RootPath + "\\credits.txt")) + if (File.Exists(Directories.RootPath + "\\credits.txt")) { - richTextBox3.Text = File.ReadAllText(GlobalVars.RootPath + "\\credits.txt"); + richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt"); } else { - ConsolePrint("ERROR - " + GlobalVars.RootPath + "\\credits.txt not found.", 2); + ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2); } - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); WriteCustomizationValues(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\servers.txt")) + if (!File.Exists(Directories.ConfigDir + "\\servers.txt")) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); - File.Create(GlobalVars.ConfigDir + "\\servers.txt").Dispose(); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); + File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); } - if (!File.Exists(GlobalVars.ConfigDir + "\\ports.txt")) + if (!File.Exists(Directories.ConfigDir + "\\ports.txt")) { - ConsolePrint("WARNING - " + GlobalVars.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); - File.Create(GlobalVars.ConfigDir + "\\ports.txt").Dispose(); + ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); + File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(GlobalVars.AssetCacheDirFonts)) + if (!Directory.Exists(Directories.AssetCacheDirFonts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirFonts); + Directory.CreateDirectory(Directories.AssetCacheDirFonts); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSky)) + if (!Directory.Exists(Directories.AssetCacheDirSky)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSky); + Directory.CreateDirectory(Directories.AssetCacheDirSky); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSounds)) + if (!Directory.Exists(Directories.AssetCacheDirSounds)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSounds); + Directory.CreateDirectory(Directories.AssetCacheDirSounds); } - if (!Directory.Exists(GlobalVars.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(GlobalVars.AssetCacheDirScripts)) + if (!Directory.Exists(Directories.AssetCacheDirScripts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirScripts); + Directory.CreateDirectory(Directories.AssetCacheDirScripts); } label8.Text = Application.ProductVersion; @@ -486,11 +486,11 @@ namespace NovetusLauncher void MainFormClose(object sender, CancelEventArgs e) { - if (GlobalVars.LocalPlayMode != true) + if (LocalVars.LocalPlayMode != true) { WriteConfigValues(); } - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { DiscordRpc.Shutdown(); } @@ -502,48 +502,48 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); - checkBox1.Checked = GlobalVars.CloseOnLaunch; - textBox5.Text = GlobalVars.UserID.ToString(); - label18.Text = GlobalVars.PlayerTripcode.ToString(); - numericUpDown3.Value = Convert.ToDecimal(GlobalVars.PlayerLimit); - textBox2.Text = GlobalVars.PlayerName; - label26.Text = GlobalVars.SelectedClient; - label28.Text = GlobalVars.Map; - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; + textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString(); + label18.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); + numericUpDown3.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit); + textBox2.Text = GlobalVars.UserConfiguration.PlayerName; + label26.Text = GlobalVars.UserConfiguration.SelectedClient; + label28.Text = GlobalVars.UserConfiguration.Map; + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); label37.Text = GlobalVars.IP; - label38.Text = GlobalVars.RobloxPort.ToString(); - checkBox2.Checked = GlobalVars.DiscordPresence; + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); + checkBox2.Checked = GlobalVars.UserConfiguration.DiscordPresence; ConsolePrint("Config loaded.", 3); - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); } void WriteConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } void WriteCustomizationValues() { - LauncherFuncs.Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); ConsolePrint("Config Saved.", 3); } void ReadClientValues(string ClientName) { - string clientpath = GlobalVars.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); - GlobalVars.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; ReadClientValues(ClientName); } else @@ -574,7 +574,7 @@ namespace NovetusLauncher textBox5.Enabled = false; button4.Enabled = false; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; break; } @@ -589,34 +589,34 @@ namespace NovetusLauncher } textBox6.Text = GlobalVars.SelectedClientInfo.Description; - label26.Text = GlobalVars.SelectedClient; - ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); + label26.Text = GlobalVars.UserConfiguration.SelectedClient; + ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3); } } void GeneratePlayerID() { LauncherFuncs.GeneratePlayerID(); - textBox5.Text = Convert.ToString(GlobalVars.UserID); + textBox5.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID); } void GenerateTripcode() { LauncherFuncs.GenerateTripcode(); - label18.Text = GlobalVars.PlayerTripcode; + label18.Text = GlobalVars.UserConfiguration.PlayerTripcode; } void TextBox1TextChanged(object sender, EventArgs e) { GlobalVars.IP = textBox1.Text; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; label37.Text = GlobalVars.IP; } void CheckBox1CheckedChanged(object sender, EventArgs e) { - GlobalVars.CloseOnLaunch = checkBox1.Checked; + GlobalVars.UserConfiguration.CloseOnLaunch = checkBox1.Checked; } void Button4Click(object sender, EventArgs e) @@ -632,19 +632,19 @@ namespace NovetusLauncher void TextBox2TextChanged(object sender, EventArgs e) { - GlobalVars.PlayerName = textBox2.Text; + GlobalVars.UserConfiguration.PlayerName = textBox2.Text; } void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - GlobalVars.SelectedClient = listBox2.SelectedItem.ToString(); - ReadClientValues(GlobalVars.SelectedClient); + GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString(); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); } void CheckBox3CheckedChanged(object sender, EventArgs e) { - GlobalVars.LocalPlayMode = checkBox3.Checked; + LocalVars.LocalPlayMode = checkBox3.Checked; } void TextBox5TextChanged(object sender, EventArgs e) @@ -654,16 +654,16 @@ namespace NovetusLauncher { if (textBox5.Text.Equals("")) { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } else { - GlobalVars.UserID = Convert.ToInt32(textBox5.Text); + GlobalVars.UserConfiguration.UserID = Convert.ToInt32(textBox5.Text); } } else { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } } @@ -684,34 +684,34 @@ namespace NovetusLauncher GlobalVars.IP = listBox3.SelectedItem.ToString(); textBox1.Text = GlobalVars.IP; checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + LocalVars.LocalPlayMode = false; label37.Text = GlobalVars.IP; } void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(listBox4.SelectedItem.ToString()); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(listBox4.SelectedItem.ToString()); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); } void Button10Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); } void Button11Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button12Click(object sender, EventArgs e) { if (listBox3.SelectedIndex >= 0) { - TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.ConfigDir + "\\servers.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp"); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } } @@ -720,42 +720,42 @@ namespace NovetusLauncher { if (listBox4.SelectedIndex >= 0) { - TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.ConfigDir + "\\ports.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp"); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } } void Button14Click(object sender, EventArgs e) { - File.Create(GlobalVars.ConfigDir + "\\servers.txt").Dispose(); + File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button15Click(object sender, EventArgs e) { - File.Create(GlobalVars.ConfigDir + "\\ports.txt").Dispose(); + File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } void Button16Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button17Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } @@ -860,9 +860,9 @@ namespace NovetusLauncher { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { - if (SecurityFuncs.checkClientMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { - if (SecurityFuncs.checkScriptMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { OpenClient(rbxexe,args); } @@ -888,7 +888,7 @@ namespace NovetusLauncher OpenClient(rbxexe,args); } } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -901,18 +901,18 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.UserConfiguration.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.UserConfiguration.Map); } void ClientExited(object sender, EventArgs e) { LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -920,7 +920,7 @@ namespace NovetusLauncher void ServerExited(object sender, EventArgs e) { - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -930,7 +930,7 @@ namespace NovetusLauncher { LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); label12.Text = LocalVars.prevsplash; - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = true; } @@ -940,7 +940,7 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Solo); - string mapfile = GlobalVars.MapPath; + string mapfile = GlobalVars.UserConfiguration.MapPath; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -966,14 +966,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.UserConfiguration.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.UserConfiguration.Map); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -984,7 +984,7 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Server); - string mapfile = GlobalVars.MapPath; + string mapfile = GlobalVars.UserConfiguration.MapPath; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1018,13 +1018,13 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.UserConfiguration.Map); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1035,8 +1035,8 @@ namespace NovetusLauncher { string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Studio); - string mapfile = (nomap ? "" : GlobalVars.MapPath); - string mapname = (nomap ? "" : GlobalVars.Map); + string mapfile = (nomap ? "" : GlobalVars.UserConfiguration.MapPath); + string mapname = (nomap ? "" : GlobalVars.UserConfiguration.Map); string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1062,14 +1062,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; SecurityFuncs.RenameWindow(client, ScriptType.Studio, mapname); LauncherFuncs.UpdateRichPresence(LauncherState.InStudio, mapname); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Novetus. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1081,7 +1081,7 @@ namespace NovetusLauncher label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); - string mapfile = GlobalVars.ConfigDirData + "\\Appreciation.rbxl"; + string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) @@ -1107,14 +1107,14 @@ namespace NovetusLauncher client.StartInfo.FileName = rbxexe; client.StartInfo.Arguments = args; client.EnableRaisingEvents = true; - ReadClientValues(GlobalVars.SelectedClient); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); client.Start(); client.Exited += new EventHandler(EasterEggExited); client.PriorityClass = ProcessPriorityClass.RealTime; SecurityFuncs.RenameWindow(client, ScriptType.EasterEgg, ""); LauncherFuncs.UpdateRichPresence(LauncherState.InEasterEggGame, ""); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to launch Easter Egg. (" + ex.Message + ")", 2); MessageBox.Show("Failed to launch Easter Egg. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1185,7 +1185,7 @@ namespace NovetusLauncher StopWebServer(); StartWebServer(); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); } @@ -1238,7 +1238,7 @@ namespace NovetusLauncher { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = GlobalVars.ClientDir + @"\\" + GlobalVars.RegisterClient1 + @"\\RobloxApp_studio.exe"; + startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.RegisterClient1 + @"\\RobloxApp_studio.exe"; startInfo.Arguments = "/regserver"; startInfo.Verb = "runas"; process.StartInfo = startInfo; @@ -1246,7 +1246,7 @@ namespace NovetusLauncher Process process2 = new Process(); ProcessStartInfo startInfo2 = new ProcessStartInfo(); - startInfo2.FileName = GlobalVars.ClientDir + @"\\" + GlobalVars.RegisterClient2 + @"\\RobloxApp_studio.exe"; + startInfo2.FileName = Directories.ClientDir + @"\\" + GlobalVars.RegisterClient2 + @"\\RobloxApp_studio.exe"; startInfo2.Arguments = "/regserver"; startInfo2.Verb = "runas"; process2.StartInfo = startInfo2; @@ -1255,7 +1255,7 @@ namespace NovetusLauncher ConsolePrint("UserAgent Library successfully installed and registered!", 3); MessageBox.Show("UserAgent Library successfully installed and registered!", "Novetus - Register UserAgent Library", MessageBoxButtons.OK, MessageBoxIcon.Information); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { ConsolePrint("ERROR - Failed to register. (" + ex.Message + ")", 2); MessageBox.Show("Failed to register. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1270,54 +1270,54 @@ namespace NovetusLauncher void NumericUpDown1ValueChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown1.Value); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown1.Value); + numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); } void NumericUpDown2ValueChanged(object sender, EventArgs e) { - GlobalVars.RobloxPort = Convert.ToInt32(numericUpDown2.Value); - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); - label38.Text = GlobalVars.RobloxPort.ToString(); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(numericUpDown2.Value); + numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); + label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); } void NumericUpDown3ValueChanged(object sender, EventArgs e) { - GlobalVars.PlayerLimit = Convert.ToInt32(numericUpDown3.Value); + GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(numericUpDown3.Value); } void Button7Click(object sender, EventArgs e) { - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - GlobalVars.RobloxPort = GlobalVars.DefaultRobloxPort; + numericUpDown1.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + numericUpDown2.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + GlobalVars.UserConfiguration.RobloxPort = LocalVars.DefaultRobloxPort; } void Button23Click(object sender, EventArgs e) { - File.AppendAllText(GlobalVars.ConfigDir + "\\ports.txt", GlobalVars.RobloxPort + Environment.NewLine); + File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button22Click(object sender, EventArgs e) { - numericUpDown1.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - numericUpDown2.Value = Convert.ToDecimal(GlobalVars.DefaultRobloxPort); - GlobalVars.RobloxPort = GlobalVars.DefaultRobloxPort; + numericUpDown1.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + numericUpDown2.Value = Convert.ToDecimal(LocalVars.DefaultRobloxPort); + GlobalVars.UserConfiguration.RobloxPort = LocalVars.DefaultRobloxPort; } void TreeView1AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Nodes.Count == 0) { - GlobalVars.Map = treeView1.SelectedNode.Text.ToString(); - GlobalVars.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); - GlobalVars.MapPath = GlobalVars.BasePath + @"\\" + GlobalVars.MapPathSnip; - label28.Text = GlobalVars.Map; + GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString(); + GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); + GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; + label28.Text = GlobalVars.UserConfiguration.Map; - if (File.Exists(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1328,12 +1328,12 @@ namespace NovetusLauncher void Button6Click(object sender, EventArgs e) { - Process.Start("explorer.exe", GlobalVars.MapsDir.Replace(@"\\",@"\")); + Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\")); } void CheckBox4CheckedChanged(object sender, EventArgs e) { - GlobalVars.UPnP = checkBox4.Checked; + GlobalVars.UserConfiguration.UPnP = checkBox4.Checked; } void CheckBox4Click(object sender, EventArgs e) @@ -1345,14 +1345,14 @@ namespace NovetusLauncher { treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); - string mapdir = GlobalVars.MapsDir; + string mapdir = Directories.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - if (File.Exists(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(GlobalVars.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1388,9 +1388,9 @@ namespace NovetusLauncher private void button26_Click(object sender, EventArgs e) { - if (Directory.Exists(GlobalVars.AssetCacheDir)) + if (Directory.Exists(Directories.AssetCacheDir)) { - Directory.Delete(GlobalVars.AssetCacheDir, true); + Directory.Delete(Directories.AssetCacheDir, true); ConsolePrint("Asset cache cleared!", 3); MessageBox.Show("Asset cache cleared!"); } @@ -1402,7 +1402,7 @@ namespace NovetusLauncher private void checkBox2_CheckedChanged(object sender, EventArgs e) { - GlobalVars.DiscordPresence = checkBox2.Checked; + GlobalVars.UserConfiguration.DiscordPresence = checkBox2.Checked; MessageBox.Show("Restart the launcher to apply changes."); } @@ -1460,7 +1460,7 @@ namespace NovetusLauncher switch (LocalVars.Clicks) { case 1: - label12.Text = "Hi " + GlobalVars.PlayerName + "!"; + label12.Text = "Hi " + GlobalVars.UserConfiguration.PlayerName + "!"; break; case 3: label12.Text = "How are you doing today?"; @@ -1475,7 +1475,7 @@ namespace NovetusLauncher WriteConfigValues(); StartEasterEgg(); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -1508,7 +1508,7 @@ namespace NovetusLauncher WriteConfigValues(); StartStudio(nomap); - if (GlobalVars.CloseOnLaunch == true) + if (GlobalVars.UserConfiguration.CloseOnLaunch == true) { Visible = false; } @@ -1516,7 +1516,7 @@ namespace NovetusLauncher private void button36_Click(object sender, EventArgs e) { - GlobalVars.OldLayout = false; + GlobalVars.UserConfiguration.OldLayout = false; WriteConfigValues(); Application.Restart(); } diff --git a/NovetusLauncher/NovetusLauncher/NovetusSettings.cs b/NovetusLauncher/NovetusLauncher/NovetusSettings.cs index 078072c..9f5b4fc 100644 --- a/NovetusLauncher/NovetusLauncher/NovetusSettings.cs +++ b/NovetusLauncher/NovetusLauncher/NovetusSettings.cs @@ -18,12 +18,12 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, false); - checkBox5.Checked = GlobalVars.ReShade; + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + checkBox5.Checked = GlobalVars.UserConfiguration.ReShade; checkBox6.Checked = GlobalVars.ReShadeFPSDisplay; checkBox7.Checked = GlobalVars.ReShadePerformanceMode; - switch (GlobalVars.GraphicsMode) + switch (GlobalVars.UserConfiguration.GraphicsMode) { case GraphicsMode.DirectX: comboBox1.SelectedIndex = 1; @@ -34,7 +34,7 @@ namespace NovetusLauncher break; } - switch (GlobalVars.QualityLevel) + switch (GlobalVars.UserConfiguration.QualityLevel) { case QualityLevel.VeryLow: comboBox2.SelectedIndex = 0; @@ -57,7 +57,7 @@ namespace NovetusLauncher private void checkBox5_CheckedChanged(object sender, EventArgs e) { - GlobalVars.ReShade = checkBox5.Checked; + GlobalVars.UserConfiguration.ReShade = checkBox5.Checked; } private void checkBox6_CheckedChanged(object sender, EventArgs e) @@ -75,10 +75,10 @@ namespace NovetusLauncher switch (comboBox1.SelectedIndex) { case 1: - GlobalVars.GraphicsMode = GraphicsMode.DirectX; + GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX; break; default: - GlobalVars.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; break; } } @@ -88,20 +88,20 @@ namespace NovetusLauncher switch (comboBox2.SelectedIndex) { case 0: - GlobalVars.QualityLevel = QualityLevel.VeryLow; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow; break; case 1: - GlobalVars.QualityLevel = QualityLevel.Low; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low; break; case 2: - GlobalVars.QualityLevel = QualityLevel.Medium; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium; break; case 3: - GlobalVars.QualityLevel = QualityLevel.High; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High; break; case 4: default: - GlobalVars.QualityLevel = QualityLevel.Ultra; + GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; break; } } diff --git a/NovetusLauncher/NovetusLauncher/Program.cs b/NovetusLauncher/NovetusLauncher/Program.cs index 5f541ab..aa53b51 100644 --- a/NovetusLauncher/NovetusLauncher/Program.cs +++ b/NovetusLauncher/NovetusLauncher/Program.cs @@ -29,12 +29,12 @@ namespace NovetusLauncher { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - LauncherFuncs.ReadInfoFile(GlobalVars.ConfigDir + "\\" + GlobalVars.InfoName); + LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName); if (args.Length == 0) { //read from our config to determine which clients to load. - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, false); - if (GlobalVars.OldLayout == false) + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + if (GlobalVars.UserConfiguration.OldLayout == false) { Application.Run(new MainForm()); } diff --git a/NovetusLauncher/NovetusLauncher/SDK/AssetLocalizer.cs b/NovetusLauncher/NovetusLauncher/SDK/AssetLocalizer.cs index 4c2caba..1fe3c1b 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/AssetLocalizer.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/AssetLocalizer.cs @@ -7,7 +7,7 @@ namespace NovetusLauncher { public partial class AssetLocalizer : Form { - private DLType currentType; + private RobloxFileType currentType; private string path; private string name; private string meshname; @@ -21,7 +21,7 @@ namespace NovetusLauncher { OpenFileDialog openFileDialog1 = new OpenFileDialog { - Filter = (currentType == DLType.RBXL) ? "ROBLOX Level (*.rbxl)|*.rbxl" : "ROBLOX Model (*.rbxm)|*.rbxm", + Filter = (currentType == RobloxFileType.RBXL) ? "ROBLOX Level (*.rbxl)|*.rbxl" : "ROBLOX Model (*.rbxm)|*.rbxm", Title = "Open ROBLOX level or model" }; @@ -38,28 +38,28 @@ namespace NovetusLauncher switch (comboBox1.SelectedIndex) { case 1: - currentType = DLType.RBXM; + currentType = RobloxFileType.RBXM; break; case 2: - currentType = DLType.Hat; + currentType = RobloxFileType.Hat; break; case 3: - currentType = DLType.Head; + currentType = RobloxFileType.Head; break; case 4: - currentType = DLType.Face; + currentType = RobloxFileType.Face; break; case 5: - currentType = DLType.Shirt; + currentType = RobloxFileType.Shirt; break; case 6: - currentType = DLType.TShirt; + currentType = RobloxFileType.TShirt; break; case 7: - currentType = DLType.Pants; + currentType = RobloxFileType.Pants; break; default: - currentType = DLType.RBXL; + currentType = RobloxFileType.RBXL; break; } } @@ -69,9 +69,9 @@ namespace NovetusLauncher comboBox1.SelectedItem = "RBXL"; comboBox2.SelectedItem = "None"; - if (Directory.Exists(GlobalVars.hatdirFonts)) + if (Directory.Exists(Directories.hatdirFonts)) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdirFonts); + DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdirFonts); FileInfo[] Files = dinfo.GetFiles("*.mesh"); foreach (FileInfo file in Files) { @@ -84,29 +84,29 @@ namespace NovetusLauncher } } - if (!Directory.Exists(GlobalVars.AssetCacheDirFonts)) + if (!Directory.Exists(Directories.AssetCacheDirFonts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirFonts); + Directory.CreateDirectory(Directories.AssetCacheDirFonts); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSky)) + if (!Directory.Exists(Directories.AssetCacheDirSky)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSky); + Directory.CreateDirectory(Directories.AssetCacheDirSky); } - if (!Directory.Exists(GlobalVars.AssetCacheDirSounds)) + if (!Directory.Exists(Directories.AssetCacheDirSounds)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirSounds); + Directory.CreateDirectory(Directories.AssetCacheDirSounds); } - if (!Directory.Exists(GlobalVars.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(GlobalVars.AssetCacheDirScripts)) + if (!Directory.Exists(Directories.AssetCacheDirScripts)) { - Directory.CreateDirectory(GlobalVars.AssetCacheDirScripts); + Directory.CreateDirectory(Directories.AssetCacheDirScripts); } } @@ -116,7 +116,7 @@ namespace NovetusLauncher switch (currentType) { - case DLType.RBXL: + case RobloxFileType.RBXL: switch (percent) { case 0: @@ -163,7 +163,7 @@ namespace NovetusLauncher break; } break; - case DLType.RBXM: + case RobloxFileType.RBXM: switch (percent) { case 0: @@ -207,7 +207,7 @@ namespace NovetusLauncher break; } break; - case DLType.Hat: + case RobloxFileType.Hat: switch (percent) { case 0: @@ -224,7 +224,7 @@ namespace NovetusLauncher break; } break; - case DLType.Head: + case RobloxFileType.Head: //meshes switch (percent) { @@ -233,7 +233,7 @@ namespace NovetusLauncher break; } break; - case DLType.Face: + case RobloxFileType.Face: //decal switch (percent) { @@ -242,7 +242,7 @@ namespace NovetusLauncher break; } break; - case DLType.TShirt: + case RobloxFileType.TShirt: //texture switch (percent) { @@ -251,7 +251,7 @@ namespace NovetusLauncher break; } break; - case DLType.Shirt: + case RobloxFileType.Shirt: //texture switch (percent) { @@ -260,7 +260,7 @@ namespace NovetusLauncher break; } break; - case DLType.Pants: + case RobloxFileType.Pants: //texture switch (percent) { @@ -286,7 +286,7 @@ namespace NovetusLauncher { switch (currentType) { - case DLType.RBXL: + case RobloxFileType.RBXL: //backup the original copy try { @@ -299,132 +299,132 @@ namespace NovetusLauncher } //meshes worker.ReportProgress(5); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Fonts); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Fonts, 1, 1, 1, 1); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Fonts); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Fonts, 1, 1, 1, 1); //skybox worker.ReportProgress(10); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 1, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 2, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 3, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 4, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 5, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 1, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 2, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 3, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 4, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 5, 0, 0, 0); //decal worker.ReportProgress(15); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Decal); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Decal); //texture worker.ReportProgress(20); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Texture); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Texture); //tools and hopperbin worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Tool); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Tool); worker.ReportProgress(30); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.HopperBin); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.HopperBin); //sound worker.ReportProgress(40); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sound); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sound); worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ImageLabel); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ImageLabel); //clothing worker.ReportProgress(60); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Shirt); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Shirt); worker.ReportProgress(65); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ShirtGraphic); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ShirtGraphic); worker.ReportProgress(70); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Pants); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Pants); //scripts worker.ReportProgress(80); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Script); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Script); worker.ReportProgress(90); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.LocalScript); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.LocalScript); worker.ReportProgress(100); break; - case DLType.RBXM: + case RobloxFileType.RBXM: //meshes worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Fonts); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Fonts, 1, 1, 1, 1); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Fonts); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Fonts, 1, 1, 1, 1); //skybox worker.ReportProgress(10); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 1, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 2, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 3, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 4, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sky, 5, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 1, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 2, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 3, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 4, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sky, 5, 0, 0, 0); //decal worker.ReportProgress(15); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Decal); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Decal); //texture worker.ReportProgress(20); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Texture); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Texture); //tools and hopperbin worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Tool); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Tool); worker.ReportProgress(30); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.HopperBin); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.HopperBin); //sound worker.ReportProgress(40); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Sound); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Sound); worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ImageLabel); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ImageLabel); //clothing worker.ReportProgress(60); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Shirt); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Shirt); worker.ReportProgress(65); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ShirtGraphic); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ShirtGraphic); worker.ReportProgress(70); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Pants); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Pants); //scripts worker.ReportProgress(80); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Script); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Script); worker.ReportProgress(90); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.LocalScript); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.LocalScript); worker.ReportProgress(100); break; - case DLType.Hat: + case RobloxFileType.Hat: //meshes worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, name, meshname); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, 1, 1, 1, 1, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemHatFonts, name, meshname); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemHatFonts, 1, 1, 1, 1, name); worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatSound); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemHatSound); //scripts worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.Script); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.Script); worker.ReportProgress(75); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.LocalScript); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.LocalScript); worker.ReportProgress(100); break; - case DLType.Head: + case RobloxFileType.Head: //meshes worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHeadFonts, name); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHeadFonts, 1, 1, 1, 1, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemHeadFonts, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemHeadFonts, 1, 1, 1, 1, name); worker.ReportProgress(100); break; - case DLType.Face: + case RobloxFileType.Face: //decal worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemFaceTexture, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemFaceTexture, name); worker.ReportProgress(100); break; - case DLType.TShirt: + case RobloxFileType.TShirt: //texture worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemTShirtTexture, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemTShirtTexture, name); worker.ReportProgress(100); break; - case DLType.Shirt: + case RobloxFileType.Shirt: //texture worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemShirtTexture, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemShirtTexture, name); worker.ReportProgress(100); break; - case DLType.Pants: + case RobloxFileType.Pants: //texture worker.ReportProgress(0); - RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemPantsTexture, name); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxTypeDefs.ItemPantsTexture, name); worker.ReportProgress(100); break; default: @@ -432,7 +432,7 @@ namespace NovetusLauncher break; } } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Error); } diff --git a/NovetusLauncher/NovetusLauncher/SDK/ClientScriptDocumentation.cs b/NovetusLauncher/NovetusLauncher/SDK/ClientScriptDocumentation.cs index a3f61ae..97fdc68 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/ClientScriptDocumentation.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/ClientScriptDocumentation.cs @@ -31,7 +31,7 @@ namespace NovetusLauncher void ClientScriptDocumentationLoad(object sender, EventArgs e) { - richTextBox1.Text = File.ReadAllText(GlobalVars.BasePath + "\\documentation.txt"); + richTextBox1.Text = File.ReadAllText(Directories.BasePath + "\\documentation.txt"); } } } diff --git a/NovetusLauncher/NovetusLauncher/SDK/ClientinfoCreator.cs b/NovetusLauncher/NovetusLauncher/SDK/ClientinfoCreator.cs index 4ec2aac..3483771 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/ClientinfoCreator.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/ClientinfoCreator.cs @@ -52,7 +52,7 @@ namespace NovetusLauncher void ClientinfoCreatorLoad(object sender, EventArgs e) { - string cfgpath = GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName; + string cfgpath = Directories.ConfigDir + "\\" + GlobalVars.ConfigName; if (!File.Exists(cfgpath)) { LauncherFuncs.Config(cfgpath, true); diff --git a/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs b/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs index 9c97086..2f4cb9c 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs @@ -42,7 +42,7 @@ namespace NovetusLauncher if (!isWebSite) { - if (!GlobalVars.DisabledHelp) + if (!GlobalVars.UserConfiguration.DisabledItemMakerHelp) { string helptext = "If you're trying to create a offline item, please use these file extension names when saving your files:\n.rbxm - ROBLOX Model/Item\n.mesh - ROBLOX Mesh\n.png - Texture/Icon\n.wav - Sound"; MessageBox.Show(helptext, "Novetus Item SDK", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -53,9 +53,9 @@ namespace NovetusLauncher try { string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, you'll have to download the meshes/textures from the links in the rbxm file, then replace the links in the file pointing to where they are using rbxasset://. Look at the directory in the 'shareddata/charcustom' folder that best suits your item type, then look at the rbxm for any one of the items. If you get a corrupted file, change the URL using the drop down box."; - download.InitDownload((!GlobalVars.DisabledHelp) ? helptext : ""); + download.InitDownload((!GlobalVars.UserConfiguration.DisabledItemMakerHelp) ? helptext : ""); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { MessageBox.Show("Error: Unable to download the file. " +ex.Message, "Novetus Item SDK | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -69,14 +69,14 @@ namespace NovetusLauncher { System.Diagnostics.Process.Start(fullURL); - if (!GlobalVars.DisabledHelp) + if (!GlobalVars.UserConfiguration.DisabledItemMakerHelp) { string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, you'll have to download the meshes/textures from the links in the rbxm file, then replace the links in the file pointing to where they are using rbxasset://. Look at the directory in the 'shareddata/charcustom' folder that best suits your item type, then look at the rbxm for any one of the items. If you get a corrupted file, change the URL using the drop down box.\n\nIf you're trying to create a offline item, please use these file extension names when saving your files:\n.rbxm - ROBLOX Model/Item\n.mesh - ROBLOX Mesh\n.png - Texture/Icon\n.wav - Sound"; MessageBox.Show(helptext, "Novetus Item SDK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } - catch(Exception) when (!Env.Debugging) + catch (Exception) { MessageBox.Show("Error: Unable to download the file. Try using a different file name or ID.","Novetus Item SDK | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -107,7 +107,7 @@ namespace NovetusLauncher void ItemMakerLoad(object sender, EventArgs e) { - string cfgpath = GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName; + string cfgpath = Directories.ConfigDir + "\\" + GlobalVars.ConfigName; if (!File.Exists(cfgpath)) { LauncherFuncs.Config(cfgpath, true); @@ -120,17 +120,17 @@ namespace NovetusLauncher comboBox1.SelectedItem = "http://www.roblox.com/"; isWebSite = false; - checkBox1.Checked = GlobalVars.DisabledHelp; + checkBox1.Checked = GlobalVars.UserConfiguration.DisabledItemMakerHelp; } void ItemMakerClose(object sender, CancelEventArgs e) { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); } void CheckBox1CheckedChanged(object sender, EventArgs e) { - GlobalVars.DisabledHelp = checkBox1.Checked; + GlobalVars.UserConfiguration.DisabledItemMakerHelp = checkBox1.Checked; } } } diff --git a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs index 9c53e79..3c2793c 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs @@ -64,14 +64,14 @@ namespace NovetusLauncher break; case 6: Process proc = new Process(); - proc.StartInfo.FileName = GlobalVars.ConfigDirData + "\\RSG.exe"; + proc.StartInfo.FileName = Directories.ConfigDirData + "\\RSG.exe"; proc.StartInfo.CreateNoWindow = false; proc.StartInfo.UseShellExecute = false; proc.Start(); break; case 7: Process proc2 = new Process(); - proc2.StartInfo.FileName = GlobalVars.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; + proc2.StartInfo.FileName = Directories.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; proc2.StartInfo.CreateNoWindow = false; proc2.StartInfo.UseShellExecute = false; proc2.Start(); diff --git a/NovetusLauncher/NovetusLauncher/SDK/Obj2MeshV1GUI.cs b/NovetusLauncher/NovetusLauncher/SDK/Obj2MeshV1GUI.cs index 77dbf70..c69cd0d 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/Obj2MeshV1GUI.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/Obj2MeshV1GUI.cs @@ -25,7 +25,7 @@ namespace NovetusLauncher { if (openFileDialog1.ShowDialog() == DialogResult.OK) { - ProcessOBJ(GlobalVars.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName); + ProcessOBJ(Directories.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName); } } diff --git a/NovetusLauncher/NovetusURI/Form1.cs b/NovetusLauncher/NovetusURI/Form1.cs index cc01fec..423dd5b 100644 --- a/NovetusLauncher/NovetusURI/Form1.cs +++ b/NovetusLauncher/NovetusURI/Form1.cs @@ -1,6 +1,5 @@ using System; using System.Windows.Forms; -using NovetusFuncs; namespace NovetusURI { @@ -22,7 +21,7 @@ namespace NovetusURI MessageBox.Show("URI successfully installed and registered!", "Novetus - Install URI", MessageBoxButtons.OK, MessageBoxIcon.Information); } - catch (Exception ex) when (!Env.Debugging) + catch (Exception ex) { MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); diff --git a/NovetusLauncher/NovetusURI/LocalVars.cs b/NovetusLauncher/NovetusURI/LocalVars.cs new file mode 100644 index 0000000..cebfef6 --- /dev/null +++ b/NovetusLauncher/NovetusURI/LocalVars.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NovetusURI +{ + class LocalVars + { + public static bool ReadyToLaunch = false; + } +} diff --git a/NovetusLauncher/NovetusURI/NovetusURI.csproj b/NovetusLauncher/NovetusURI/NovetusURI.csproj index 35f3113..b85cbd8 100644 --- a/NovetusLauncher/NovetusURI/NovetusURI.csproj +++ b/NovetusLauncher/NovetusURI/NovetusURI.csproj @@ -91,6 +91,7 @@ Form1.cs + diff --git a/NovetusLauncher/NovetusURI/URI/LoaderForm.cs b/NovetusLauncher/NovetusURI/URI/LoaderForm.cs index 6470a94..ad60155 100644 --- a/NovetusLauncher/NovetusURI/URI/LoaderForm.cs +++ b/NovetusLauncher/NovetusURI/URI/LoaderForm.cs @@ -67,7 +67,7 @@ namespace NovetusURI void StartDiscord() { - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { handlers = new DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; @@ -90,10 +90,10 @@ namespace NovetusURI string ip = SecurityFuncs.Base64Decode(SplitArg[0]); string port = SecurityFuncs.Base64Decode(SplitArg[1]); string client = SecurityFuncs.Base64Decode(SplitArg[2]); - GlobalVars.SelectedClient = client; + GlobalVars.UserConfiguration.SelectedClient = client; GlobalVars.IP = ip; - GlobalVars.RobloxPort = Convert.ToInt32(port); - ReadClientValues(GlobalVars.SelectedClient); + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); + ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); string luafile = ""; if (!GlobalVars.SelectedClientInfo.Fix2007) { @@ -101,16 +101,16 @@ namespace NovetusURI } else { - luafile = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { - rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_client.exe"; + rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; } string quote = "\""; string args = ""; @@ -136,9 +136,9 @@ namespace NovetusURI { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { - if (SecurityFuncs.checkClientMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { - if (SecurityFuncs.checkScriptMD5(GlobalVars.SelectedClient) == true) + if (SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient) == true) { LaunchClient(rbxexe,args); } @@ -190,14 +190,14 @@ namespace NovetusURI private void CheckIfFinished(object state) { - if (GlobalVars.ReadyToLaunch == false) + if (LocalVars.ReadyToLaunch == false) { System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0); } else { Visible = true; - if (GlobalVars.DiscordPresence) + if (GlobalVars.UserConfiguration.DiscordPresence) { label1.Text = "Starting Discord Rich Presence..."; StartDiscord(); @@ -209,12 +209,12 @@ namespace NovetusURI void ReadClientValues(string ClientName) { - string clientpath = GlobalVars.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus Launcher - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); - GlobalVars.SelectedClient = GlobalVars.DefaultClient; + GlobalVars.UserConfiguration.SelectedClient = GlobalVars.DefaultClient; ReadClientValues(ClientName); } else diff --git a/NovetusLauncher/NovetusURI/URI/QuickConfigure.cs b/NovetusLauncher/NovetusURI/URI/QuickConfigure.cs index cfeb640..43a1c52 100644 --- a/NovetusLauncher/NovetusURI/URI/QuickConfigure.cs +++ b/NovetusLauncher/NovetusURI/URI/QuickConfigure.cs @@ -33,7 +33,7 @@ namespace NovetusURI void QuickConfigureLoad(object sender, EventArgs e) { - string cfgpath = GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName; + string cfgpath = Directories.ConfigDir + "\\" + GlobalVars.ConfigName; if (!File.Exists(cfgpath)) { LauncherFuncs.Config(cfgpath, true); @@ -52,20 +52,20 @@ namespace NovetusURI void ReadConfigValues(string cfgpath) { LauncherFuncs.Config(cfgpath, false); - textBox2.Text = GlobalVars.UserID.ToString(); - label3.Text = GlobalVars.PlayerTripcode.ToString(); - textBox1.Text = GlobalVars.PlayerName; + textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString(); + label3.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); + textBox1.Text = GlobalVars.UserConfiguration.PlayerName; } void GeneratePlayerID() { LauncherFuncs.GeneratePlayerID(); - textBox2.Text = GlobalVars.UserID.ToString(); + textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString(); } void TextBox1TextChanged(object sender, EventArgs e) { - GlobalVars.PlayerName = textBox1.Text; + GlobalVars.UserConfiguration.PlayerName = textBox1.Text; } void TextBox2TextChanged(object sender, EventArgs e) @@ -75,16 +75,16 @@ namespace NovetusURI { if (textBox2.Text.Equals("")) { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } else { - GlobalVars.UserID = Convert.ToInt32(textBox2.Text); + GlobalVars.UserConfiguration.UserID = Convert.ToInt32(textBox2.Text); } } else { - GlobalVars.UserID = 0; + GlobalVars.UserConfiguration.UserID = 0; } } @@ -101,8 +101,8 @@ namespace NovetusURI void QuickConfigureClose(object sender, CancelEventArgs e) { - LauncherFuncs.Config(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigName, true); - GlobalVars.ReadyToLaunch = true; + LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LocalVars.ReadyToLaunch = true; } } }