From 52206710c425a99063f1534ed64c55ff2fbfa3ee Mon Sep 17 00:00:00 2001 From: Bitl Date: Tue, 7 Jul 2020 11:19:40 -0700 Subject: [PATCH] Seperated class files so they are easier to access. --- Novetus/NovetusCMD/Program.cs | 42 +- Novetus/NovetusFuncs/CryptoRandom.cs | 51 + Novetus/NovetusFuncs/FileFormat.cs | 169 +++ Novetus/NovetusFuncs/GlobalPaths.cs | 100 ++ Novetus/NovetusFuncs/GlobalVars.cs | 78 + Novetus/NovetusFuncs/IDiscordRPC.cs | 96 ++ Novetus/NovetusFuncs/INIFile.cs | 67 + ...tusLauncherLibrary.cs => LauncherFuncs.cs} | 108 +- ...vetusCodeExtensionLibrary.cs => NETExt.cs} | 178 +-- Novetus/NovetusFuncs/NetFuncs.cs | 54 + Novetus/NovetusFuncs/NovetusFuncs.projitems | 20 +- Novetus/NovetusFuncs/NovetusMainLibrary.cs | 1321 ----------------- Novetus/NovetusFuncs/NovetusScriptLibrary.cs | 295 ---- Novetus/NovetusFuncs/ScriptFuncs.cs | 307 ++++ ...tusSecurityLibrary.cs => SecurityFuncs.cs} | 12 +- Novetus/NovetusFuncs/Settings.cs | 132 ++ Novetus/NovetusFuncs/SimpleHTTPServer.cs | 253 ++++ Novetus/NovetusFuncs/TextLineRemover.cs | 105 ++ Novetus/NovetusFuncs/VarStorage.cs | 38 + .../CharacterCustomization.cs | 440 +++--- .../CharacterCustomization_legacy.cs | 440 +++--- .../NovetusLauncher/Classes/AddonLoader.cs | 85 ++ .../Classes/CharCustom/IconLoader.cs | 65 + Novetus/NovetusLauncher/Classes/LocalVars.cs | 811 +--------- .../NovetusLauncher/Classes/SDK/Downloader.cs | 167 +++ .../Classes/SDK/RobloxXMLLocalizer.cs | 439 ++++++ .../NovetusLauncher/Classes/SplashLoader.cs | 94 ++ .../Classes/WinForms/FormExt.cs | 28 + .../WinForms/TabControlWithoutHeader.cs | 45 + .../Classes/WinForms/TreeNodeHelper.cs | 119 ++ .../MainForm/Compact/MainForm_legacy.cs | 178 +-- .../MainForm/Compact/NovetusSettings.cs | 30 +- .../MainForm/Extended/MainForm.cs | 206 +-- .../NovetusLauncher/Novetus.Launcher.csproj | 11 + Novetus/NovetusLauncher/Program.cs | 6 +- Novetus/NovetusLauncher/SDK/AssetLocalizer.cs | 24 +- .../SDK/ClientScriptDocumentation.cs | 2 +- .../NovetusLauncher/SDK/ClientinfoCreator.cs | 2 +- Novetus/NovetusLauncher/SDK/NovetusSDK.cs | 6 +- Novetus/NovetusLauncher/SDK/Obj2MeshV1GUI.cs | 2 +- Novetus/NovetusURI/Classes/URIReg.cs | 95 ++ Novetus/NovetusURI/Novetus.URI.csproj | 1 + Novetus/NovetusURI/Program.cs | 2 +- Novetus/NovetusURI/URI/LoaderForm.cs | 22 +- Novetus/NovetusURI/URI/QuickConfigure.cs | 4 +- 45 files changed, 3429 insertions(+), 3321 deletions(-) create mode 100644 Novetus/NovetusFuncs/CryptoRandom.cs create mode 100644 Novetus/NovetusFuncs/FileFormat.cs create mode 100644 Novetus/NovetusFuncs/GlobalPaths.cs create mode 100644 Novetus/NovetusFuncs/GlobalVars.cs create mode 100644 Novetus/NovetusFuncs/IDiscordRPC.cs create mode 100644 Novetus/NovetusFuncs/INIFile.cs rename Novetus/NovetusFuncs/{NovetusLauncherLibrary.cs => LauncherFuncs.cs} (91%) rename Novetus/NovetusFuncs/{NovetusCodeExtensionLibrary.cs => NETExt.cs} (54%) create mode 100644 Novetus/NovetusFuncs/NetFuncs.cs delete mode 100644 Novetus/NovetusFuncs/NovetusMainLibrary.cs delete mode 100644 Novetus/NovetusFuncs/NovetusScriptLibrary.cs create mode 100644 Novetus/NovetusFuncs/ScriptFuncs.cs rename Novetus/NovetusFuncs/{NovetusSecurityLibrary.cs => SecurityFuncs.cs} (94%) create mode 100644 Novetus/NovetusFuncs/Settings.cs create mode 100644 Novetus/NovetusFuncs/SimpleHTTPServer.cs create mode 100644 Novetus/NovetusFuncs/TextLineRemover.cs create mode 100644 Novetus/NovetusFuncs/VarStorage.cs create mode 100644 Novetus/NovetusLauncher/Classes/AddonLoader.cs create mode 100644 Novetus/NovetusLauncher/Classes/CharCustom/IconLoader.cs create mode 100644 Novetus/NovetusLauncher/Classes/SDK/Downloader.cs create mode 100644 Novetus/NovetusLauncher/Classes/SDK/RobloxXMLLocalizer.cs create mode 100644 Novetus/NovetusLauncher/Classes/SplashLoader.cs create mode 100644 Novetus/NovetusLauncher/Classes/WinForms/FormExt.cs create mode 100644 Novetus/NovetusLauncher/Classes/WinForms/TabControlWithoutHeader.cs create mode 100644 Novetus/NovetusLauncher/Classes/WinForms/TreeNodeHelper.cs create mode 100644 Novetus/NovetusURI/Classes/URIReg.cs diff --git a/Novetus/NovetusCMD/Program.cs b/Novetus/NovetusCMD/Program.cs index fa1d301..7666f02 100644 --- a/Novetus/NovetusCMD/Program.cs +++ b/Novetus/NovetusCMD/Program.cs @@ -22,12 +22,12 @@ namespace NovetusCMD { try { - UPnP.InitUPnP(DeviceFound,DeviceLost); + NetFuncs.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } catch (Exception ex) { - ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); + ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2); } } } @@ -38,7 +38,7 @@ namespace NovetusCMD { try { - UPnP.StartUPnP(device,protocol,port); + NetFuncs.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -54,7 +54,7 @@ namespace NovetusCMD { try { - UPnP.StopUPnP(device,protocol,port); + NetFuncs.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -104,7 +104,7 @@ namespace NovetusCMD { try { - GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); + GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } catch (Exception ex) @@ -140,7 +140,7 @@ namespace NovetusCMD static void WriteConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } @@ -163,14 +163,14 @@ namespace NovetusCMD static void ReadConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); ConsolePrint("Config loaded.", 3); ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); } static void ReadClientValues(string ClientName) { - string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { @@ -192,11 +192,11 @@ namespace NovetusCMD public static void Main(string[] args) { - LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName, true); + LauncherFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalVars.InfoName, true); Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD"; ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1); - ConsolePrint("Novetus path: " + Directories.BasePath, 1); + ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 1); if (args.Length == 0) { @@ -212,7 +212,7 @@ namespace NovetusCMD ConsolePrint("---------", 1); ConsolePrint("Custom server options", 3); ConsolePrint("-overrideconfig must be added in order for the below commands to function.", 5); - ConsolePrint("-upnp | Turns on UPnP.", 4); + ConsolePrint("-upnp | Turns on NetFuncs.", 4); ConsolePrint("-map | Sets the map.", 4); ConsolePrint("-client | Sets the client.", 4); ConsolePrint("-port | Sets the server port.", 4); @@ -302,7 +302,7 @@ namespace NovetusCMD { ConsolePrint("NovetusCMD is now loading all server configurations from the INI file.", 5); - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName)) { ConsolePrint("WARNING 2 - " + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); @@ -346,17 +346,17 @@ namespace NovetusCMD } else { - luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } string mapfile = GlobalVars.UserConfiguration.MapPath; string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; } string quote = "\""; string args = ""; @@ -364,11 +364,11 @@ namespace NovetusCMD { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Server); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -376,11 +376,11 @@ namespace NovetusCMD { if (!no3d) { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } } try @@ -448,8 +448,8 @@ namespace NovetusCMD GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" ); - File.WriteAllText(Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text)); - ConsolePrint("Server Information sent to file " + Directories.BasePath + "\\" + LocalVars.ServerInfoFileName, 4); + File.WriteAllText(GlobalPaths.BasePath + "\\" + LocalVars.ServerInfoFileName, GlobalVars.RemoveEmptyLines(text)); + ConsolePrint("Server Information sent to file " + GlobalPaths.BasePath + "\\" + LocalVars.ServerInfoFileName, 4); } } diff --git a/Novetus/NovetusFuncs/CryptoRandom.cs b/Novetus/NovetusFuncs/CryptoRandom.cs new file mode 100644 index 0000000..ac252f3 --- /dev/null +++ b/Novetus/NovetusFuncs/CryptoRandom.cs @@ -0,0 +1,51 @@ +#region Usings +using System; +using System.Security.Cryptography; +#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 diff --git a/Novetus/NovetusFuncs/FileFormat.cs b/Novetus/NovetusFuncs/FileFormat.cs new file mode 100644 index 0000000..8e28d51 --- /dev/null +++ b/Novetus/NovetusFuncs/FileFormat.cs @@ -0,0 +1,169 @@ +#region File Formats + +public class FileFormat +{ + #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 = Settings.GraphicsOptions.Mode.OpenGL; + ReShade = false; + QualityLevel = Settings.QualityOptions.Level.Ultra; + LauncherLayout = Settings.UIOptions.Style.Extended; + ReShadeFPSDisplay = false; + ReShadePerformanceMode = false; + AssetLocalizerSaveBackups = true; + } + + 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 Settings.GraphicsOptions.Mode GraphicsMode { get; set; } + public bool ReShade { get; set; } + public Settings.QualityOptions.Level QualityLevel { get; set; } + public Settings.UIOptions.Style LauncherLayout { get; set; } + public bool ReShadeFPSDisplay { get; set; } + public bool ReShadePerformanceMode { get; set; } + public bool AssetLocalizerSaveBackups { 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 + public class ProgramInfo + { + public ProgramInfo() + { + Version = ""; + Branch = ""; + DefaultClient = ""; + RegisterClient1 = ""; + RegisterClient2 = ""; + DefaultMap = ""; + } + + public string Version { get; set; } + public string Branch { get; set; } + public string DefaultClient { get; set; } + public string RegisterClient1 { get; set; } + public string RegisterClient2 { get; set; } + public string DefaultMap { get; set; } + } + #endregion +} +#endregion diff --git a/Novetus/NovetusFuncs/GlobalPaths.cs b/Novetus/NovetusFuncs/GlobalPaths.cs new file mode 100644 index 0000000..76a31ed --- /dev/null +++ b/Novetus/NovetusFuncs/GlobalPaths.cs @@ -0,0 +1,100 @@ +#region Usings +using System.IO; +using System.Reflection; +#endregion + +#region Global Paths + +public class GlobalPaths +{ + 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 diff --git a/Novetus/NovetusFuncs/GlobalVars.cs b/Novetus/NovetusFuncs/GlobalVars.cs new file mode 100644 index 0000000..de86107 --- /dev/null +++ b/Novetus/NovetusFuncs/GlobalVars.cs @@ -0,0 +1,78 @@ +#region Usings +using System; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +#endregion + +/* + * change field names for all forms + * Rewrite client launching into one function. + * add regions to ALL classes. + * maybe make enums print out the names in inis instead of the int value? + */ + +#region Global Variables +public static class GlobalVars +{ + public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo(); + public static FileFormat.Config UserConfiguration = new FileFormat.Config(); + public static string IP = "localhost"; + 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.ini"; + //client shit + public static FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo(); + public static string AddonScriptPath = ""; + //charcustom + public static FileFormat.CustomizationConfig UserCustomization = new FileFormat.CustomizationConfig(); + public static string loadtext = ""; + public static string sololoadtext = ""; + //color menu. + public static bool AdminMode = false; + public static string important = ""; + //discord + public static IDiscordRPC.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"; + + 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 diff --git a/Novetus/NovetusFuncs/IDiscordRPC.cs b/Novetus/NovetusFuncs/IDiscordRPC.cs new file mode 100644 index 0000000..e07eaf2 --- /dev/null +++ b/Novetus/NovetusFuncs/IDiscordRPC.cs @@ -0,0 +1,96 @@ +#region Usings +using System.Runtime.InteropServices; +#endregion + +#region Discord RPC +//code by discord obv. just renamed it to fit better. +public class IDiscordRPC +{ + [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 diff --git a/Novetus/NovetusFuncs/INIFile.cs b/Novetus/NovetusFuncs/INIFile.cs new file mode 100644 index 0000000..7dba0a3 --- /dev/null +++ b/Novetus/NovetusFuncs/INIFile.cs @@ -0,0 +1,67 @@ +#region Usings +using System; +using System.Runtime.InteropServices; +using System.Text; +#endregion + +#region INI File Parser +//modified from https://www.codeproject.com/articles/1966/an-ini-file-handling-class-using-c?fid=425860&df=90&mpp=25&prof=True&sort=Position&view=Normal&spc=Relaxed&fr=51 + +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 diff --git a/Novetus/NovetusFuncs/NovetusLauncherLibrary.cs b/Novetus/NovetusFuncs/LauncherFuncs.cs similarity index 91% rename from Novetus/NovetusFuncs/NovetusLauncherLibrary.cs rename to Novetus/NovetusFuncs/LauncherFuncs.cs index 510f78d..e38d774 100644 --- a/Novetus/NovetusFuncs/NovetusLauncherLibrary.cs +++ b/Novetus/NovetusFuncs/LauncherFuncs.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Reflection; +using System.Windows.Forms; #endregion #region Launcher State @@ -20,15 +21,6 @@ public enum LauncherState } #endregion -#region Launcher Layout -public enum LauncherLayout -{ - None = 0, - Extended = 1, - Compact = 2 -} -#endregion - #region Launcher Functions public class LauncherFuncs { @@ -42,7 +34,7 @@ public class LauncherFuncs string versionbranch, defaultclient, defaultmap, regclient1, regclient2, issnapshot, snapshottemplate, snapshotrevision; - IniFile ini = new IniFile(infopath); + INIFile ini = new INIFile(infopath); string section = "ProgramInfo"; @@ -63,7 +55,7 @@ public class LauncherFuncs { if (cmd) { - var versionInfo = FileVersionInfo.GetVersionInfo(Directories.RootPathLauncher + "\\Novetus.exe"); + var versionInfo = FileVersionInfo.GetVersionInfo(GlobalPaths.RootPathLauncher + "\\Novetus.exe"); GlobalVars.ProgramInformation.Version = snapshottemplate.Replace("%version%", versionbranch) .Replace("%build%", versionInfo.ProductBuildPart.ToString()) .Replace("%revision%", versionInfo.FilePrivatePart.ToString()) @@ -77,7 +69,7 @@ public class LauncherFuncs .Replace("%snapshot-revision%", snapshotrevision); } - string changelog = Directories.BasePath + "\\changelog.txt"; + string changelog = GlobalPaths.BasePath + "\\changelog.txt"; if (File.Exists(changelog)) { string[] changelogedit = File.ReadAllLines(changelog); @@ -100,8 +92,8 @@ public class LauncherFuncs GlobalVars.ProgramInformation.RegisterClient2 = regclient2; GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap; - GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; - GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; + GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; + GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; } catch (Exception) { @@ -114,7 +106,7 @@ public class LauncherFuncs if (write) { //WRITE - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "Config"; @@ -131,10 +123,10 @@ public class LauncherFuncs 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", EnumParser.GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); + ini.IniWriteValue(section, "GraphicsMode", Settings.GraphicsOptions.GetIntForMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); ini.IniWriteValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString()); - ini.IniWriteValue(section, "QualityLevel", EnumParser.GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); - ini.IniWriteValue(section, "Layout", EnumParser.GetIntForLauncherLayout(GlobalVars.UserConfiguration.LauncherLayout).ToString()); + ini.IniWriteValue(section, "QualityLevel", Settings.QualityOptions.GetIntForLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); + ini.IniWriteValue(section, "Layout", Settings.UIOptions.GetIntForStyle(GlobalVars.UserConfiguration.LauncherLayout).ToString()); ini.IniWriteValue(section, "AssetLocalizerSaveBackups", GlobalVars.UserConfiguration.AssetLocalizerSaveBackups.ToString()); } else @@ -145,7 +137,7 @@ public class LauncherFuncs disablehelpmessage, tripcode, discord, mappath, mapsnip, graphics, reshade, qualitylevel, layout, savebackups; - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "Config"; @@ -162,10 +154,10 @@ public class LauncherFuncs 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", EnumParser.GetIntForGraphicsMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); + graphics = ini.IniReadValue(section, "GraphicsMode", Settings.GraphicsOptions.GetIntForMode(GlobalVars.UserConfiguration.GraphicsMode).ToString()); reshade = ini.IniReadValue(section, "ReShade", GlobalVars.UserConfiguration.ReShade.ToString()); - qualitylevel = ini.IniReadValue(section, "QualityLevel", EnumParser.GetIntForQualityLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); - layout = ini.IniReadValue(section, "Layout", EnumParser.GetIntForLauncherLayout(GlobalVars.UserConfiguration.LauncherLayout).ToString()); + qualitylevel = ini.IniReadValue(section, "QualityLevel", Settings.QualityOptions.GetIntForLevel(GlobalVars.UserConfiguration.QualityLevel).ToString()); + layout = ini.IniReadValue(section, "Layout", Settings.UIOptions.GetIntForStyle(GlobalVars.UserConfiguration.LauncherLayout).ToString()); savebackups = ini.IniReadValue(section, "AssetLocalizerSaveBackups", GlobalVars.UserConfiguration.AssetLocalizerSaveBackups.ToString()); try @@ -175,7 +167,7 @@ public class LauncherFuncs if (userid.Equals("0")) { GeneratePlayerID(); - Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); } else { @@ -199,7 +191,7 @@ public class LauncherFuncs if (string.IsNullOrWhiteSpace(SecurityFuncs.Base64Decode(tripcode))) { GenerateTripcode(); - Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); } else { @@ -211,10 +203,10 @@ public class LauncherFuncs GlobalVars.UserConfiguration.MapPath = mappath; GlobalVars.UserConfiguration.MapPathSnip = mapsnip; - GlobalVars.UserConfiguration.GraphicsMode = EnumParser.GetGraphicsModeForInt(Convert.ToInt32(graphics)); + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.GetModeForInt(Convert.ToInt32(graphics)); GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade); - GlobalVars.UserConfiguration.QualityLevel = EnumParser.GetQualityLevelForInt(Convert.ToInt32(qualitylevel)); - GlobalVars.UserConfiguration.LauncherLayout = EnumParser.GetLauncherLayoutForInt(Convert.ToInt32(layout)); + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.GetLevelForInt(Convert.ToInt32(qualitylevel)); + GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.GetStyleForInt(Convert.ToInt32(layout)); GlobalVars.UserConfiguration.AssetLocalizerSaveBackups = Convert.ToBoolean(savebackups); } catch (Exception) @@ -223,16 +215,16 @@ public class LauncherFuncs } } - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); } else { - Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write); + Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write); } - ReShade(Directories.ConfigDir, "ReShade.ini", write); + ReShade(GlobalPaths.ConfigDir, "ReShade.ini", write); } public static void Customization(string cfgpath, bool write) @@ -240,7 +232,7 @@ public class LauncherFuncs if (write) { //WRITE - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "Items"; @@ -286,7 +278,7 @@ public class LauncherFuncs larmid, larmstring, rarmid, rarmstring, llegid, llegstring, rlegid, rlegstring, characterid, extraishat, showhatsonextra; - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "Items"; @@ -373,7 +365,7 @@ public class LauncherFuncs if (write) { //WRITE - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "GENERAL"; @@ -388,7 +380,7 @@ public class LauncherFuncs //READ string framerate, frametime, performance; - IniFile ini = new IniFile(cfgpath); + INIFile ini = new INIFile(cfgpath); string section = "GENERAL"; @@ -498,7 +490,7 @@ public class LauncherFuncs if (!File.Exists(fullpath)) { - File.Copy(Directories.ConfigDir + "\\ReShade_default.ini", fullpath, true); + File.Copy(GlobalPaths.ConfigDir + "\\ReShade_default.ini", fullpath, true); ReShadeValues(fullpath, write, true); } else @@ -506,7 +498,7 @@ public class LauncherFuncs ReShadeValues(fullpath, write, true); } - string clientdir = Directories.ClientDir; + string clientdir = GlobalPaths.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) @@ -529,7 +521,7 @@ public class LauncherFuncs { if (!File.Exists(fulldllpath)) { - File.Copy(Directories.ConfigDirData + "\\opengl32.dll", fulldllpath, true); + File.Copy(GlobalPaths.ConfigDirData + "\\opengl32.dll", fulldllpath, true); } } else @@ -554,12 +546,12 @@ public class LauncherFuncs GlobalVars.UserConfiguration.UPnP = false; GlobalVars.UserConfiguration.DisabledItemMakerHelp = false; GlobalVars.UserConfiguration.DiscordPresence = true; - GlobalVars.UserConfiguration.MapPath = Directories.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; - GlobalVars.UserConfiguration.MapPathSnip = Directories.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; - GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; + GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL; GlobalVars.UserConfiguration.ReShade = false; - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; - GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Extended; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra; + GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Extended; ResetCustomizationValues(); } @@ -783,7 +775,7 @@ public class LauncherFuncs break; } - DiscordRpc.UpdatePresence(ref GlobalVars.presence); + IDiscordRPC.UpdatePresence(ref GlobalVars.presence); } } @@ -795,10 +787,10 @@ public class LauncherFuncs { switch (GlobalVars.UserConfiguration.GraphicsMode) { - case GraphicsMode.OpenGL: + case Settings.GraphicsOptions.Mode.OpenGL: result += "xpcall( function() settings().Rendering.graphicsMode = 2 end, function( err ) settings().Rendering.graphicsMode = 4 end );"; break; - case GraphicsMode.DirectX: + case Settings.GraphicsOptions.Mode.DirectX: result += "pcall(function() settings().Rendering.graphicsMode = 3 end);"; break; default: @@ -818,7 +810,7 @@ public class LauncherFuncs switch (GlobalVars.UserConfiguration.QualityLevel) { - case QualityLevel.VeryLow: + case Settings.QualityOptions.Level.VeryLow: MeshDetail = 50; ShadingQuality = 50; GFXQualityLevel = 1; @@ -828,7 +820,7 @@ public class LauncherFuncs Shadows_2008 = 2; Shadows_2007 = false; break; - case QualityLevel.Low: + case Settings.QualityOptions.Level.Low: MeshDetail = 50; ShadingQuality = 50; GFXQualityLevel = 5; @@ -838,7 +830,7 @@ public class LauncherFuncs Shadows_2008 = 2; Shadows_2007 = false; break; - case QualityLevel.Medium: + case Settings.QualityOptions.Level.Medium: MeshDetail = 50; ShadingQuality = 50; GFXQualityLevel = 10; @@ -847,13 +839,13 @@ public class LauncherFuncs Bevels = 2; Shadows_2007 = false; break; - case QualityLevel.High: + case Settings.QualityOptions.Level.High: MeshDetail = 75; ShadingQuality = 75; GFXQualityLevel = 15; AASamples = 4; break; - case QualityLevel.Ultra: + case Settings.QualityOptions.Level.Ultra: default: break; } @@ -892,7 +884,7 @@ public class LauncherFuncs } else { - luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } return luafile; @@ -903,28 +895,28 @@ public class LauncherFuncs string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode) { - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { switch (type) { case ScriptType.Client: - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; break; case ScriptType.Server: - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; break; case ScriptType.Studio: - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe"; break; case ScriptType.Solo: case ScriptType.EasterEgg: - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe"; break; case ScriptType.None: default: - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; break; } } diff --git a/Novetus/NovetusFuncs/NovetusCodeExtensionLibrary.cs b/Novetus/NovetusFuncs/NETExt.cs similarity index 54% rename from Novetus/NovetusFuncs/NovetusCodeExtensionLibrary.cs rename to Novetus/NovetusFuncs/NETExt.cs index cede700..dc81a8d 100644 --- a/Novetus/NovetusFuncs/NovetusCodeExtensionLibrary.cs +++ b/Novetus/NovetusFuncs/NETExt.cs @@ -3,63 +3,66 @@ using System; using System.Drawing; using System.Windows.Forms; using System.Diagnostics; -using System.IO.Compression; -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) - { - box.SelectionStart = box.TextLength; - box.SelectionLength = 0; +#region .NET Extentions - box.SelectionColor = color; - box.AppendText(text); - box.SelectionColor = box.ForeColor; - } -} -#endregion +//This code was brought to you by: +//https://stackoverflow.com/questions/1926264/color-different-parts-of-a-richtextbox-string +//https://stackoverflow.com/questions/262280/how-can-i-know-if-a-process-is-running +//https://stackoverflow.com/questions/444798/case-insensitive-containsstring +//https://stackoverflow.com/questions/6084940/how-do-i-search-a-multi-dimensional-array +//https://www.dotnetperls.com/between-before-after +//https://stackoverflow.com/questions/12422619/can-i-disable-the-close-button-of-a-form-using-c +//https://stackoverflow.com/questions/9031537/really-simple-encryption-with-c-sharp-and-symmetricalgorithm -#region Process Extensions -public static class ProcessExtensions +public static class NETExt { - public static bool IsRunning(this Process process) - { - try { - Process.GetProcessById(process.Id); - } catch (InvalidOperationException) { - return false; - } catch (ArgumentException) { - return false; - } - return true; - } -} -#endregion + #region Rich Text Box Extensions + public static void AppendText(this RichTextBox box, string text, Color color) + { + box.SelectionStart = box.TextLength; + box.SelectionLength = 0; -#region String Extensions -public static class StringExtensions -{ - public static bool Contains(this string source, string toCheck, StringComparison comp) - { - if (source == null) - return false; - return source.IndexOf(toCheck, comp) >= 0; - } -} -#endregion + box.SelectionColor = color; + box.AppendText(text); + box.SelectionColor = box.ForeColor; + } + #endregion -#region Array Helper -//credit to code4life -public static class ArrayHelper -{ + #region Process Extensions + public static bool IsRunning(this Process process) + { + try + { + Process.GetProcessById(process.Id); + } + catch (InvalidOperationException) + { + return false; + } + catch (ArgumentException) + { + return false; + } + return true; + } + #endregion + + #region String Extensions + public static bool Contains(this string source, string toCheck, StringComparison comp) + { + if (source == null) + return false; + return source.IndexOf(toCheck, comp) >= 0; + } + #endregion + + #region Array Helper public static object FindInDimensions(this object[,] target, - object searchTerm) + object searchTerm) { object result = null; var rowLowerLimit = target.GetLowerBound(0); @@ -78,13 +81,9 @@ public static class ArrayHelper return result; } -} -#endregion + #endregion -#region Substring Extensions -//dotnetperls -static class SubstringExtensions -{ + #region Substring Extensions /// /// Get string value between [first] a and [last] b. /// @@ -138,77 +137,9 @@ static class SubstringExtensions } return value.Substring(adjustedPosA); } -} -#endregion + #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 -{ - int layoutval = 1; - - public TabControlWithoutHeader(int layout) - { - SetLayout(layout); - } - public TabControlWithoutHeader() - { - SetLayout(1); - } - - private void SetLayout(int layout) - { - layoutval = layout; - if (layoutval == 1) - { - if (!DesignMode) Multiline = true; - } - } - - protected override void WndProc(ref Message m) - { - if (layoutval == 2) - { - base.WndProc(ref m); - return; - } - - if (m.Msg == 0x1328 && !DesignMode) - m.Result = new IntPtr(1); - else - 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 -{ - [DllImport("user32")] - public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); - - [DllImport("user32")] - public static extern bool EnableMenuItem(IntPtr hMenu, uint itemId, uint uEnable); - - public static void DisableCloseButton(this Form form) - { - // The 1 parameter means to gray out. 0xF060 is SC_CLOSE. - EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 1); - } - - public static void EnableCloseButton(this Form form) - { - // The zero parameter means to enable. 0xF060 is SC_CLOSE. - 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 -{ + #region String Utilities private static byte[] key = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 }; private static byte[] iv = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 }; @@ -229,5 +160,6 @@ public static class StringUtil byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length); return Encoding.Unicode.GetString(outputBuffer); } + #endregion } #endregion \ No newline at end of file diff --git a/Novetus/NovetusFuncs/NetFuncs.cs b/Novetus/NovetusFuncs/NetFuncs.cs new file mode 100644 index 0000000..693824f --- /dev/null +++ b/Novetus/NovetusFuncs/NetFuncs.cs @@ -0,0 +1,54 @@ +#region Usings +using Mono.Nat; +using System; +#endregion + +#region NetFuncs + +public static class NetFuncs +{ + 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 diff --git a/Novetus/NovetusFuncs/NovetusFuncs.projitems b/Novetus/NovetusFuncs/NovetusFuncs.projitems index 6615b30..2e15436 100644 --- a/Novetus/NovetusFuncs/NovetusFuncs.projitems +++ b/Novetus/NovetusFuncs/NovetusFuncs.projitems @@ -9,10 +9,20 @@ NovetusFuncs - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Novetus/NovetusFuncs/NovetusMainLibrary.cs b/Novetus/NovetusFuncs/NovetusMainLibrary.cs deleted file mode 100644 index 1cc8d0f..0000000 --- a/Novetus/NovetusFuncs/NovetusMainLibrary.cs +++ /dev/null @@ -1,1321 +0,0 @@ -#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; -#endregion - -/* - * change field names for all forms - * Rewrite client launching into one function. - * add regions to ALL classes. - * maybe make enums print out the names in inis instead of the int value? - */ - -#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 ProgramInfo ProgramInformation = new ProgramInfo(); - public static Config UserConfiguration = new Config(); - public static string IP = "localhost"; - 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.ini"; - //client shit - public static ClientInfo SelectedClientInfo = new ClientInfo(); - public static string AddonScriptPath = ""; - //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"; - - 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; - LauncherLayout = LauncherLayout.Extended; - ReShadeFPSDisplay = false; - ReShadePerformanceMode = false; - AssetLocalizerSaveBackups = true; - } - - 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 LauncherLayout LauncherLayout { get; set; } - public bool ReShadeFPSDisplay { get; set; } - public bool ReShadePerformanceMode { get; set; } - public bool AssetLocalizerSaveBackups { 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 -public class ProgramInfo -{ - public ProgramInfo() - { - Version = ""; - Branch = ""; - DefaultClient = ""; - RegisterClient1 = ""; - RegisterClient2 = ""; - DefaultMap = ""; - } - - public string Version { get; set; } - public string Branch { get; set; } - public string DefaultClient { get; set; } - public string RegisterClient1 { get; set; } - public string RegisterClient2 { get; set; } - public string DefaultMap { get; set; } -} -#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 Enum Parser -public static class EnumParser -{ - public static QualityLevel GetQualityLevelForInt(int level) - { - switch (level) - { - case 1: - return QualityLevel.VeryLow; - case 2: - return QualityLevel.Low; - case 3: - return QualityLevel.Medium; - case 4: - return QualityLevel.High; - case 5: - default: - return QualityLevel.Ultra; - } - } - - public static int GetIntForQualityLevel(QualityLevel level) - { - switch (level) - { - case QualityLevel.VeryLow: - return 1; - case QualityLevel.Low: - return 2; - case QualityLevel.Medium: - return 3; - case QualityLevel.High: - return 4; - case QualityLevel.Ultra: - default: - return 5; - } - } - - public static GraphicsMode GetGraphicsModeForInt(int level) - { - switch (level) - { - case 1: - return GraphicsMode.OpenGL; - case 2: - return GraphicsMode.DirectX; - default: - return GraphicsMode.None; - } - } - - public static int GetIntForGraphicsMode(GraphicsMode level) - { - switch (level) - { - case GraphicsMode.OpenGL: - return 1; - case GraphicsMode.DirectX: - return 2; - default: - return 0; - } - } - - public static LauncherLayout GetLauncherLayoutForInt(int level) - { - switch (level) - { - case 1: - return LauncherLayout.Extended; - case 2: - return LauncherLayout.Compact; - default: - return LauncherLayout.None; - } - } - - public static int GetIntForLauncherLayout(LauncherLayout level) - { - switch (level) - { - case LauncherLayout.Extended: - return 1; - case LauncherLayout.Compact: - return 2; - default: - return 0; - } - } -} -#endregion - -#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 - -#endregion - -#endregion \ No newline at end of file diff --git a/Novetus/NovetusFuncs/NovetusScriptLibrary.cs b/Novetus/NovetusFuncs/NovetusScriptLibrary.cs deleted file mode 100644 index 32b4b49..0000000 --- a/Novetus/NovetusFuncs/NovetusScriptLibrary.cs +++ /dev/null @@ -1,295 +0,0 @@ -#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) - { - try - { - int pFrom = code.IndexOf(tag) + tag.Length; - int pTo = code.LastIndexOf(endtag); - string result = code.Substring(pFrom, pTo - pFrom); - return result; - } - catch (Exception) - { - return "%donothing%"; - } - } - - public static ScriptType GetTypeFromTag(string tag) - { - switch (tag) - { - case string client when client.Contains("client"): - return ScriptType.Client; - case string server when server.Contains("server"): - case string no3d when no3d.Contains("no3d"): - return ScriptType.Server; - case string solo when solo.Contains("solo"): - return ScriptType.Solo; - case string studio when studio.Contains("studio"): - return ScriptType.Studio; - default: - return ScriptType.None; - } - } - - public static string GetRawArgsForType(ScriptType type, string md5s, string luafile) - { - switch (type) - { - case ScriptType.Client: - return LauncherFuncs.ChangeGameSettings() + - " dofile('" + luafile + "'); _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 LauncherFuncs.ChangeGameSettings() + - " dofile('" + luafile + "'); _G.CSServer(" - + GlobalVars.UserConfiguration.RobloxPort + "," - + GlobalVars.UserConfiguration.PlayerLimit + "," - + md5s + "); " - + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + - " dofile('" + GlobalVars.AddonScriptPath + "');" : ""); - case ScriptType.Solo: - case ScriptType.EasterEgg: - return LauncherFuncs.ChangeGameSettings() - + " dofile('" + luafile + "'); _G.CSSolo(" - + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" - + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," - + GlobalVars.sololoadtext + ")"; - case ScriptType.Studio: - return LauncherFuncs.ChangeGameSettings() - + " dofile('" + luafile + "');"; - default: - return ""; - } - } - - public static string GetRawArgsFromTag(string tag, string md5s, string luafile) - { - return GetRawArgsForType(GetTypeFromTag(tag), md5s, luafile); - } - - public static int ConvertIconStringToInt() - { - switch (GlobalVars.UserCustomization.Icon) - { - case "BC": - return 1; - case "TBC": - return 2; - case "OBC": - return 3; - case "NBC": - default: - return 0; - } - } - - public static string GetFolderAndMapName(string source, string seperator) - { - try { - string result = source.Substring(0, source.IndexOf(seperator)); - - if (File.Exists(Directories.MapsDir + @"\\" + result + @"\\" + source)) { - return result + @"\\" + source; - } else { - return source; - } - } catch (Exception) { - return source; - } - } - - public static string GetFolderAndMapName(string source) - { - return GetFolderAndMapName(source, " -"); - } - - public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe) - { - if (GlobalVars.SelectedClientInfo.Fix2007) { - ScriptGenerator.GenerateScriptForClient(GetTypeFromTag(tag)); - } - - string extractedCode = GetArgsFromTag(code, tag, endtag); - - if (extractedCode.Contains("%donothing%")) - { - return ""; - } - - string md5dir = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : ""; - 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.UserConfiguration.RobloxPort.ToString()) - .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) - .Replace("%icone%", ConvertIconStringToInt().ToString()) - .Replace("%icon%", GlobalVars.UserCustomization.Icon) - .Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString()) - .Replace("%face%", GlobalVars.UserCustomization.Face) - .Replace("%head%", GlobalVars.UserCustomization.Head) - .Replace("%tshirt%", GlobalVars.UserCustomization.TShirt) - .Replace("%shirt%", GlobalVars.UserCustomization.Shirt) - .Replace("%pants%", GlobalVars.UserCustomization.Pants) - .Replace("%hat1%", GlobalVars.UserCustomization.Hat1) - .Replace("%hat2%", GlobalVars.UserCustomization.Hat2) - .Replace("%hat3%", 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()) - .Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString()) - .Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString()) - .Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString()) - .Replace("%md5launcher%", md5dir) - .Replace("%md5script%", GlobalVars.SelectedClientInfo.ClientMD5) - .Replace("%md5exe%", GlobalVars.SelectedClientInfo.ScriptMD5) - .Replace("%md5scriptd%", md5script) - .Replace("%md5exed%", md5exe) - .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString()) - .Replace("%extra%", GlobalVars.UserCustomization.Extra) - .Replace("%hat4%", 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%", 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; - } -} -#endregion \ No newline at end of file diff --git a/Novetus/NovetusFuncs/ScriptFuncs.cs b/Novetus/NovetusFuncs/ScriptFuncs.cs new file mode 100644 index 0000000..fec084a --- /dev/null +++ b/Novetus/NovetusFuncs/ScriptFuncs.cs @@ -0,0 +1,307 @@ +#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 Functions +public class ScriptFuncs +{ + #region Script Generator + public class Generator + { + public static string GetScriptFuncForType(ScriptType type) + { + string rbxexe = ""; + if (GlobalVars.SelectedClientInfo.LegacyMode == true) + { + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + } + else + { + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; + } + + string md5dir = SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location); + string md5script = SecurityFuncs.CalculateMD5(GlobalPaths.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(GlobalPaths.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) + { + try + { + int pFrom = code.IndexOf(tag) + tag.Length; + int pTo = code.LastIndexOf(endtag); + string result = code.Substring(pFrom, pTo - pFrom); + return result; + } + catch (Exception) + { + return "%donothing%"; + } + } + + public static ScriptType GetTypeFromTag(string tag) + { + switch (tag) + { + case string client when client.Contains("client"): + return ScriptType.Client; + case string server when server.Contains("server"): + case string no3d when no3d.Contains("no3d"): + return ScriptType.Server; + case string solo when solo.Contains("solo"): + return ScriptType.Solo; + case string studio when studio.Contains("studio"): + return ScriptType.Studio; + default: + return ScriptType.None; + } + } + + public static string GetRawArgsForType(ScriptType type, string md5s, string luafile) + { + switch (type) + { + case ScriptType.Client: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "'); _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 LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "'); _G.CSServer(" + + GlobalVars.UserConfiguration.RobloxPort + "," + + GlobalVars.UserConfiguration.PlayerLimit + "," + + md5s + "); " + + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + + " dofile('" + GlobalVars.AddonScriptPath + "');" : ""); + case ScriptType.Solo: + case ScriptType.EasterEgg: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "'); _G.CSSolo(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + + GlobalVars.sololoadtext + ")"; + case ScriptType.Studio: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "');"; + default: + return ""; + } + } + + public static string GetRawArgsFromTag(string tag, string md5s, string luafile) + { + return GetRawArgsForType(GetTypeFromTag(tag), md5s, luafile); + } + + public static int ConvertIconStringToInt() + { + switch (GlobalVars.UserCustomization.Icon) + { + case "BC": + return 1; + case "TBC": + return 2; + case "OBC": + return 3; + case "NBC": + default: + return 0; + } + } + + public static string GetFolderAndMapName(string source, string seperator) + { + try + { + string result = source.Substring(0, source.IndexOf(seperator)); + + if (File.Exists(GlobalPaths.MapsDir + @"\\" + result + @"\\" + source)) + { + return result + @"\\" + source; + } + else + { + return source; + } + } + catch (Exception) + { + return source; + } + } + + public static string GetFolderAndMapName(string source) + { + return GetFolderAndMapName(source, " -"); + } + + public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe) + { + if (GlobalVars.SelectedClientInfo.Fix2007) + { + ScriptFuncs.Generator.GenerateScriptForClient(GetTypeFromTag(tag)); + } + + string extractedCode = GetArgsFromTag(code, tag, endtag); + + if (extractedCode.Contains("%donothing%")) + { + return ""; + } + + string md5dir = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : ""; + string md5script = GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(GlobalPaths.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.UserConfiguration.RobloxPort.ToString()) + .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) + .Replace("%icone%", ConvertIconStringToInt().ToString()) + .Replace("%icon%", GlobalVars.UserCustomization.Icon) + .Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString()) + .Replace("%face%", GlobalVars.UserCustomization.Face) + .Replace("%head%", GlobalVars.UserCustomization.Head) + .Replace("%tshirt%", GlobalVars.UserCustomization.TShirt) + .Replace("%shirt%", GlobalVars.UserCustomization.Shirt) + .Replace("%pants%", GlobalVars.UserCustomization.Pants) + .Replace("%hat1%", GlobalVars.UserCustomization.Hat1) + .Replace("%hat2%", GlobalVars.UserCustomization.Hat2) + .Replace("%hat3%", GlobalVars.UserCustomization.Hat3) + .Replace("%faced%", GlobalPaths.faceGameDir + GlobalVars.UserCustomization.Face) + .Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.Head) + .Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.TShirt) + .Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.Shirt) + .Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.Pants) + .Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat1) + .Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat2) + .Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat3) + .Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString()) + .Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString()) + .Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString()) + .Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString()) + .Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString()) + .Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString()) + .Replace("%md5launcher%", md5dir) + .Replace("%md5script%", GlobalVars.SelectedClientInfo.ClientMD5) + .Replace("%md5exe%", GlobalVars.SelectedClientInfo.ScriptMD5) + .Replace("%md5scriptd%", md5script) + .Replace("%md5exed%", md5exe) + .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString()) + .Replace("%extra%", GlobalVars.UserCustomization.Extra) + .Replace("%hat4%", GlobalVars.UserCustomization.Extra) + .Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.Extra) + .Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra) + .Replace("%args%", GetRawArgsFromTag(tag, md5s, luafile)) + .Replace("%facews%", GlobalPaths.WebServer_FaceDir + GlobalVars.UserCustomization.Face) + .Replace("%headws%", GlobalPaths.WebServer_HeadDir + GlobalVars.UserCustomization.Head) + .Replace("%tshirtws%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.WebServer_TShirtDir + GlobalVars.UserCustomization.TShirt) + .Replace("%shirtws%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.WebServer_ShirtDir + GlobalVars.UserCustomization.Shirt) + .Replace("%pantsws%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.WebServer_PantsDir + GlobalVars.UserCustomization.Pants) + .Replace("%hat1ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat1) + .Replace("%hat2ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat2) + .Replace("%hat3ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Hat3) + .Replace("%extraws%", GlobalPaths.WebServer_ExtraDir + GlobalVars.UserCustomization.Extra) + .Replace("%hat4ws%", GlobalPaths.WebServer_HatDir + GlobalVars.UserCustomization.Extra) + .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\")) + .Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode) + .Replace("%addonscriptpath%", GlobalVars.AddonScriptPath); + return compiled; + } + } + #endregion +} +#endregion \ No newline at end of file diff --git a/Novetus/NovetusFuncs/NovetusSecurityLibrary.cs b/Novetus/NovetusFuncs/SecurityFuncs.cs similarity index 94% rename from Novetus/NovetusFuncs/NovetusSecurityLibrary.cs rename to Novetus/NovetusFuncs/SecurityFuncs.cs index 532b357..145cd5c 100644 --- a/Novetus/NovetusFuncs/NovetusSecurityLibrary.cs +++ b/Novetus/NovetusFuncs/SecurityFuncs.cs @@ -91,9 +91,9 @@ public class SecurityFuncs if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp.exe"; + rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp.exe"; } else { - rbxexe = Directories.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe"; + rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe"; } using (var md5 = MD5.Create()) { using (var stream = File.OpenRead(rbxexe)) { @@ -118,7 +118,7 @@ public class SecurityFuncs { if (GlobalVars.AdminMode != true) { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { - string rbxscript = Directories.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"; + string rbxscript = GlobalPaths.BasePath + "\\clients\\" + client + "\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"; using (var md5 = MD5.Create()) { using (var stream = File.OpenRead(rbxscript)) { byte[] hash = md5.ComputeHash(stream); @@ -186,7 +186,7 @@ public class SecurityFuncs SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.ProgramInformation.Version + " - " + clientname + " " - + ScriptGenerator.GetNameForType(type) + + ScriptFuncs.Generator.GetNameForType(type) + " [" + GlobalVars.IP + ":" + GlobalVars.UserConfiguration.RobloxPort + "]" + RandomStringTitle()); break; @@ -195,7 +195,7 @@ public class SecurityFuncs SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.ProgramInformation.Version + " - " + clientname + " " - + ScriptGenerator.GetNameForType(type) + + ScriptFuncs.Generator.GetNameForType(type) + (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]") + RandomStringTitle()); break; @@ -208,7 +208,7 @@ public class SecurityFuncs break; case ScriptType.EasterEgg: default: - SetWindowText(exe.MainWindowHandle, ScriptGenerator.GetNameForType(type) + SetWindowText(exe.MainWindowHandle, ScriptFuncs.Generator.GetNameForType(type) + RandomStringTitle()); break; } diff --git a/Novetus/NovetusFuncs/Settings.cs b/Novetus/NovetusFuncs/Settings.cs new file mode 100644 index 0000000..fd4e516 --- /dev/null +++ b/Novetus/NovetusFuncs/Settings.cs @@ -0,0 +1,132 @@ +#region Settings +public class Settings +{ + #region Quality Options + + public class QualityOptions + { + public enum Level + { + VeryLow = 1, + Low = 2, + Medium = 3, + High = 4, + Ultra = 5 + } + + public static Level GetLevelForInt(int level) + { + switch (level) + { + case 1: + return Level.VeryLow; + case 2: + return Level.Low; + case 3: + return Level.Medium; + case 4: + return Level.High; + case 5: + default: + return Level.Ultra; + } + } + + public static int GetIntForLevel(Level level) + { + switch (level) + { + case Level.VeryLow: + return 1; + case Level.Low: + return 2; + case Level.Medium: + return 3; + case Level.High: + return 4; + case Level.Ultra: + default: + return 5; + } + } + } + #endregion + + #region Graphics Options + + public class GraphicsOptions + { + public enum Mode + { + None = 0, + OpenGL = 1, + DirectX = 2 + } + + public static Mode GetModeForInt(int level) + { + switch (level) + { + case 1: + return Mode.OpenGL; + case 2: + return Mode.DirectX; + default: + return Mode.None; + } + } + + public static int GetIntForMode(Mode level) + { + switch (level) + { + case Mode.OpenGL: + return 1; + case Mode.DirectX: + return 2; + default: + return 0; + } + } + } + #endregion + + #region UI Options + public static class UIOptions + { + public enum Style + { + None = 0, + Extended = 1, + Compact = 2 + } + + public static Style GetStyleForInt(int level) + { + switch (level) + { + case 1: + return Style.Extended; + case 2: + return Style.Compact; + default: + return Style.None; + } + } + + public static int GetIntForStyle(Style level) + { + switch (level) + { + case Style.Extended: + return 1; + case Style.Compact: + return 2; + default: + return 0; + } + } + } + #endregion +} +#endregion diff --git a/Novetus/NovetusFuncs/SimpleHTTPServer.cs b/Novetus/NovetusFuncs/SimpleHTTPServer.cs new file mode 100644 index 0000000..b380ff0 --- /dev/null +++ b/Novetus/NovetusFuncs/SimpleHTTPServer.cs @@ -0,0 +1,253 @@ +#region Usings +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; +#endregion + +#region Simple HTTP Server +// Modified from https://gist.github.com/aksakalli/9191056 +// MIT License - Copyright (c) 2016 Can Güney Aksakalli +// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html +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(GlobalPaths.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 \ No newline at end of file diff --git a/Novetus/NovetusFuncs/TextLineRemover.cs b/Novetus/NovetusFuncs/TextLineRemover.cs new file mode 100644 index 0000000..1f57901 --- /dev/null +++ b/Novetus/NovetusFuncs/TextLineRemover.cs @@ -0,0 +1,105 @@ +#region Usings +using System; +using System.Collections.Generic; +using System.IO; +#endregion + +#region Text Line Remover and Friends +// modified from https://stackoverflow.com/questions/668907/how-to-delete-a-line-from-a-text-file-in-c/668914#668914 + +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) + { + OnFinished?.Invoke(null, args); + } + + public static void InvokeOnRemovedLine(RemovedLineArgs args) + { + OnRemovedLine?.Invoke(null, args); + } +} + +public delegate void Finished(object sender, FinishedArgs args); + +public struct 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 struct RemovedLineArgs +{ + public string RemovedLine { get; set; } + public int RemovedLineNumber { get; set; } +} +#endregion diff --git a/Novetus/NovetusFuncs/VarStorage.cs b/Novetus/NovetusFuncs/VarStorage.cs new file mode 100644 index 0000000..fe32ea9 --- /dev/null +++ b/Novetus/NovetusFuncs/VarStorage.cs @@ -0,0 +1,38 @@ +#region Usings +using System.Drawing; +#endregion + +#region Variable Storage +public class VarStorage +{ + #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 Part Colors + public class PartColors + { + public int ColorID { get; set; } + public Color ButtonColor { get; set; } + } + + #endregion +} +#endregion diff --git a/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs b/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs index 670904c..4a9e4d7 100644 --- a/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs +++ b/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs @@ -25,7 +25,7 @@ namespace NovetusLauncher private string Custom_T_Shirt_URL = "http://www.roblox.com/asset/?id="; private string Custom_Shirt_URL = "http://www.roblox.com/asset/?id="; private string Custom_Pants_URL = "http://www.roblox.com/asset/?id="; - List PartColorList; + List PartColorList; public CharacterCustomization() { @@ -45,77 +45,77 @@ namespace NovetusLauncher void InitColors() { - PartColorList = new List() + PartColorList = new List() { //White - new PartColors{ ColorID = 1, ButtonColor = button7.BackColor }, + new VarStorage.PartColors{ ColorID = 1, ButtonColor = button7.BackColor }, //Light stone grey - new PartColors{ ColorID = 208, ButtonColor = button8.BackColor }, + new VarStorage.PartColors{ ColorID = 208, ButtonColor = button8.BackColor }, //Medium stone grey - new PartColors{ ColorID = 194, ButtonColor = button9.BackColor }, + new VarStorage.PartColors{ ColorID = 194, ButtonColor = button9.BackColor }, //Dark stone grey - new PartColors{ ColorID = 199, ButtonColor = button10.BackColor }, + new VarStorage.PartColors{ ColorID = 199, ButtonColor = button10.BackColor }, //Black - new PartColors{ ColorID = 26, ButtonColor = button14.BackColor }, + new VarStorage.PartColors{ ColorID = 26, ButtonColor = button14.BackColor }, //Bright red - new PartColors{ ColorID = 21, ButtonColor = button13.BackColor }, + new VarStorage.PartColors{ ColorID = 21, ButtonColor = button13.BackColor }, //Bright yellow - new PartColors{ ColorID = 24, ButtonColor = button12.BackColor }, + new VarStorage.PartColors{ ColorID = 24, ButtonColor = button12.BackColor }, //Cool yellow - new PartColors{ ColorID = 226, ButtonColor = button11.BackColor }, + new VarStorage.PartColors{ ColorID = 226, ButtonColor = button11.BackColor }, //Bright blue - new PartColors{ ColorID = 23, ButtonColor = button18.BackColor }, + new VarStorage.PartColors{ ColorID = 23, ButtonColor = button18.BackColor }, //Bright bluish green - new PartColors{ ColorID = 107, ButtonColor = button17.BackColor }, + new VarStorage.PartColors{ ColorID = 107, ButtonColor = button17.BackColor }, //Medium blue - new PartColors{ ColorID = 102, ButtonColor = button16.BackColor }, + new VarStorage.PartColors{ ColorID = 102, ButtonColor = button16.BackColor }, //Pastel Blue - new PartColors{ ColorID = 11, ButtonColor = button15.BackColor }, + new VarStorage.PartColors{ ColorID = 11, ButtonColor = button15.BackColor }, //Light blue - new PartColors{ ColorID = 45, ButtonColor = button22.BackColor }, + new VarStorage.PartColors{ ColorID = 45, ButtonColor = button22.BackColor }, //Sand blue - new PartColors{ ColorID = 135, ButtonColor = button21.BackColor }, + new VarStorage.PartColors{ ColorID = 135, ButtonColor = button21.BackColor }, //Bright orange - new PartColors{ ColorID = 106, ButtonColor = button20.BackColor }, + new VarStorage.PartColors{ ColorID = 106, ButtonColor = button20.BackColor }, //Br. yellowish orange - new PartColors{ ColorID = 105, ButtonColor = button19.BackColor }, + new VarStorage.PartColors{ ColorID = 105, ButtonColor = button19.BackColor }, //Earth green - new PartColors{ ColorID = 141, ButtonColor = button26.BackColor }, + new VarStorage.PartColors{ ColorID = 141, ButtonColor = button26.BackColor }, //Dark green - new PartColors{ ColorID = 28, ButtonColor = button25.BackColor }, + new VarStorage.PartColors{ ColorID = 28, ButtonColor = button25.BackColor }, //Bright green - new PartColors{ ColorID = 37, ButtonColor = button24.BackColor }, + new VarStorage.PartColors{ ColorID = 37, ButtonColor = button24.BackColor }, //Br. yellowish green - new PartColors{ ColorID = 119, ButtonColor = button23.BackColor }, + new VarStorage.PartColors{ ColorID = 119, ButtonColor = button23.BackColor }, //Medium green - new PartColors{ ColorID = 29, ButtonColor = button30.BackColor }, + new VarStorage.PartColors{ ColorID = 29, ButtonColor = button30.BackColor }, //Sand green - new PartColors{ ColorID = 151, ButtonColor = button29.BackColor }, + new VarStorage.PartColors{ ColorID = 151, ButtonColor = button29.BackColor }, //Dark orange - new PartColors{ ColorID = 38, ButtonColor = button28.BackColor }, + new VarStorage.PartColors{ ColorID = 38, ButtonColor = button28.BackColor }, //Reddish brown - new PartColors{ ColorID = 192, ButtonColor = button27.BackColor }, + new VarStorage.PartColors{ ColorID = 192, ButtonColor = button27.BackColor }, //Bright violet - new PartColors{ ColorID = 104, ButtonColor = button34.BackColor }, + new VarStorage.PartColors{ ColorID = 104, ButtonColor = button34.BackColor }, //Light reddish violet - new PartColors{ ColorID = 9, ButtonColor = button33.BackColor }, + new VarStorage.PartColors{ ColorID = 9, ButtonColor = button33.BackColor }, //Medium red - new PartColors{ ColorID = 101, ButtonColor = button32.BackColor }, + new VarStorage.PartColors{ ColorID = 101, ButtonColor = button32.BackColor }, //Brick yellow - new PartColors{ ColorID = 5, ButtonColor = button31.BackColor }, + new VarStorage.PartColors{ ColorID = 5, ButtonColor = button31.BackColor }, //Sand red - new PartColors{ ColorID = 153, ButtonColor = button38.BackColor }, + new VarStorage.PartColors{ ColorID = 153, ButtonColor = button38.BackColor }, //Brown - new PartColors{ ColorID = 217, ButtonColor = button37.BackColor }, + new VarStorage.PartColors{ ColorID = 217, ButtonColor = button37.BackColor }, //Nougat - new PartColors{ ColorID = 18, ButtonColor = button36.BackColor }, + new VarStorage.PartColors{ ColorID = 18, ButtonColor = button36.BackColor }, //Light orange - new PartColors{ ColorID = 125, ButtonColor = button35.BackColor }, + new VarStorage.PartColors{ ColorID = 125, ButtonColor = button35.BackColor }, // RARE 2006 COLORS!! //Med. reddish violet - new PartColors{ ColorID = 22, ButtonColor = button69.BackColor }, + new VarStorage.PartColors{ ColorID = 22, ButtonColor = button69.BackColor }, //Dark nougat - new PartColors{ ColorID = 128, ButtonColor = button70.BackColor } + new VarStorage.PartColors{ ColorID = 128, ButtonColor = button70.BackColor } }; } @@ -223,12 +223,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } break; @@ -242,9 +242,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -263,33 +263,33 @@ namespace NovetusLauncher listBox1.Enabled = true; listBox2.Enabled = true; listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -309,9 +309,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.facedir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.facedir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -324,12 +324,12 @@ namespace NovetusLauncher } listBox4.SelectedItem = GlobalVars.UserCustomization.Face; listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -350,9 +350,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.tshirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -365,12 +365,12 @@ namespace NovetusLauncher } listBox5.SelectedItem = GlobalVars.UserCustomization.TShirt; listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -380,7 +380,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\NoTShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; } break; @@ -397,9 +397,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.shirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.shirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -412,12 +412,12 @@ namespace NovetusLauncher } listBox6.SelectedItem = GlobalVars.UserCustomization.Shirt; listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -427,7 +427,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\NoShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; } break; @@ -444,9 +444,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.pantsdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.pantsdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -459,12 +459,12 @@ namespace NovetusLauncher } listBox7.SelectedItem = GlobalVars.UserCustomization.Pants; listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -474,7 +474,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\NoPants.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + @"\\NoPants.png"); pictureBox7.Image = icon1; } break; @@ -490,9 +490,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.headdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -505,12 +505,12 @@ namespace NovetusLauncher } listBox8.SelectedItem = GlobalVars.UserCustomization.Head; listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -530,9 +530,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox8.Items.Clear(); - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -547,9 +547,9 @@ namespace NovetusLauncher if (GlobalVars.UserCustomization.ShowHatsInExtra == true) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -572,11 +572,11 @@ namespace NovetusLauncher listBox9.Enabled = true; try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -585,13 +585,13 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -624,15 +624,15 @@ namespace NovetusLauncher void ListBox1SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -643,15 +643,15 @@ namespace NovetusLauncher void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -662,15 +662,15 @@ namespace NovetusLauncher void ListBox3SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -681,45 +681,45 @@ namespace NovetusLauncher void Button41Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -730,41 +730,41 @@ namespace NovetusLauncher void Button42Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { listBox1.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; listBox2.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; listBox3.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -777,15 +777,15 @@ namespace NovetusLauncher void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -796,18 +796,18 @@ namespace NovetusLauncher void Button45Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.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(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -818,16 +818,16 @@ namespace NovetusLauncher void Button44Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { listBox4.SelectedItem = "DefaultFace.rbxm"; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -840,19 +840,19 @@ namespace NovetusLauncher void ListBox5SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { string previtem = listBox5.SelectedItem.ToString(); textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox5.SelectedItem = previtem; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -863,7 +863,7 @@ namespace NovetusLauncher void Button47Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; @@ -871,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(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -887,18 +887,18 @@ namespace NovetusLauncher void Button46Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { textBox12.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox5.SelectedItem = "NoTShirt.rbxm"; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -911,19 +911,19 @@ namespace NovetusLauncher void ListBox6SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { string previtem = listBox6.SelectedItem.ToString(); textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox6.SelectedItem = previtem; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -934,7 +934,7 @@ namespace NovetusLauncher void Button49Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; @@ -942,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(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -958,18 +958,18 @@ namespace NovetusLauncher void Button48Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox6.SelectedItem = "NoShirt.rbxm"; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -982,19 +982,19 @@ namespace NovetusLauncher void ListBox7SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { string previtem = listBox7.SelectedItem.ToString(); textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox7.SelectedItem = previtem; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1005,7 +1005,7 @@ namespace NovetusLauncher void Button51Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; @@ -1013,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(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1029,18 +1029,18 @@ namespace NovetusLauncher void Button50Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { textBox13.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox7.SelectedItem = "NoPants.rbxm"; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1053,15 +1053,15 @@ namespace NovetusLauncher void ListBox8SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1072,18 +1072,18 @@ namespace NovetusLauncher void Button57Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.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(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1094,16 +1094,16 @@ namespace NovetusLauncher void Button56Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { listBox8.SelectedItem = "DefaultHead.rbxm"; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1444,8 +1444,8 @@ namespace NovetusLauncher { LauncherFuncs.ReloadLoadtextValue(); string luafile = "rbxasset://scripts\\\\CSView.lua"; - string mapfile = Directories.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; - string rbxexe = Directories.BasePathLauncher + "\\preview\\3DView.exe"; + string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; + string rbxexe = GlobalPaths.BasePathLauncher + "\\preview\\3DView.exe"; string quote = "\""; string args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CS3DView(0,'Player'," + GlobalVars.loadtext + ");" + quote; try @@ -1496,17 +1496,17 @@ namespace NovetusLauncher void ListBox9SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1515,15 +1515,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1536,7 +1536,7 @@ namespace NovetusLauncher void Button59Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { Random random = new Random(); int randomItem1 = random.Next(listBox9.Items.Count); @@ -1544,12 +1544,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1558,15 +1558,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1579,18 +1579,18 @@ namespace NovetusLauncher void Button58Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { listBox9.SelectedItem = "NoExtra.rbxm"; try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1599,15 +1599,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1625,9 +1625,9 @@ namespace NovetusLauncher case true: GlobalVars.UserCustomization.ShowHatsInExtra = true; - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1649,9 +1649,9 @@ namespace NovetusLauncher GlobalVars.UserCustomization.ShowHatsInExtra = false; listBox9.Items.Clear(); - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1668,12 +1668,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1682,15 +1682,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1722,12 +1722,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } } @@ -1784,7 +1784,7 @@ namespace NovetusLauncher private void button71_Click(object sender, EventArgs e) { - LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); MessageBox.Show("Outfit Saved!"); } diff --git a/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs b/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs index 85951fe..1faca70 100644 --- a/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs +++ b/Novetus/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs @@ -25,7 +25,7 @@ namespace NovetusLauncher private string Custom_T_Shirt_URL = "http://www.roblox.com/asset/?id="; private string Custom_Shirt_URL = "http://www.roblox.com/asset/?id="; private string Custom_Pants_URL = "http://www.roblox.com/asset/?id="; - List PartColorList; + List PartColorList; public CharacterCustomization_legacy() { @@ -42,77 +42,77 @@ namespace NovetusLauncher void InitColors() { - PartColorList = new List() + PartColorList = new List() { //White - new PartColors{ ColorID = 1, ButtonColor = button7.BackColor }, + new VarStorage.PartColors{ ColorID = 1, ButtonColor = button7.BackColor }, //Light stone grey - new PartColors{ ColorID = 208, ButtonColor = button8.BackColor }, + new VarStorage.PartColors{ ColorID = 208, ButtonColor = button8.BackColor }, //Medium stone grey - new PartColors{ ColorID = 194, ButtonColor = button9.BackColor }, + new VarStorage.PartColors{ ColorID = 194, ButtonColor = button9.BackColor }, //Dark stone grey - new PartColors{ ColorID = 199, ButtonColor = button10.BackColor }, + new VarStorage.PartColors{ ColorID = 199, ButtonColor = button10.BackColor }, //Black - new PartColors{ ColorID = 26, ButtonColor = button14.BackColor }, + new VarStorage.PartColors{ ColorID = 26, ButtonColor = button14.BackColor }, //Bright red - new PartColors{ ColorID = 21, ButtonColor = button13.BackColor }, + new VarStorage.PartColors{ ColorID = 21, ButtonColor = button13.BackColor }, //Bright yellow - new PartColors{ ColorID = 24, ButtonColor = button12.BackColor }, + new VarStorage.PartColors{ ColorID = 24, ButtonColor = button12.BackColor }, //Cool yellow - new PartColors{ ColorID = 226, ButtonColor = button11.BackColor }, + new VarStorage.PartColors{ ColorID = 226, ButtonColor = button11.BackColor }, //Bright blue - new PartColors{ ColorID = 23, ButtonColor = button18.BackColor }, + new VarStorage.PartColors{ ColorID = 23, ButtonColor = button18.BackColor }, //Bright bluish green - new PartColors{ ColorID = 107, ButtonColor = button17.BackColor }, + new VarStorage.PartColors{ ColorID = 107, ButtonColor = button17.BackColor }, //Medium blue - new PartColors{ ColorID = 102, ButtonColor = button16.BackColor }, + new VarStorage.PartColors{ ColorID = 102, ButtonColor = button16.BackColor }, //Pastel Blue - new PartColors{ ColorID = 11, ButtonColor = button15.BackColor }, + new VarStorage.PartColors{ ColorID = 11, ButtonColor = button15.BackColor }, //Light blue - new PartColors{ ColorID = 45, ButtonColor = button22.BackColor }, + new VarStorage.PartColors{ ColorID = 45, ButtonColor = button22.BackColor }, //Sand blue - new PartColors{ ColorID = 135, ButtonColor = button21.BackColor }, + new VarStorage.PartColors{ ColorID = 135, ButtonColor = button21.BackColor }, //Bright orange - new PartColors{ ColorID = 106, ButtonColor = button20.BackColor }, + new VarStorage.PartColors{ ColorID = 106, ButtonColor = button20.BackColor }, //Br. yellowish orange - new PartColors{ ColorID = 105, ButtonColor = button19.BackColor }, + new VarStorage.PartColors{ ColorID = 105, ButtonColor = button19.BackColor }, //Earth green - new PartColors{ ColorID = 141, ButtonColor = button26.BackColor }, + new VarStorage.PartColors{ ColorID = 141, ButtonColor = button26.BackColor }, //Dark green - new PartColors{ ColorID = 28, ButtonColor = button25.BackColor }, + new VarStorage.PartColors{ ColorID = 28, ButtonColor = button25.BackColor }, //Bright green - new PartColors{ ColorID = 37, ButtonColor = button24.BackColor }, + new VarStorage.PartColors{ ColorID = 37, ButtonColor = button24.BackColor }, //Br. yellowish green - new PartColors{ ColorID = 119, ButtonColor = button23.BackColor }, + new VarStorage.PartColors{ ColorID = 119, ButtonColor = button23.BackColor }, //Medium green - new PartColors{ ColorID = 29, ButtonColor = button30.BackColor }, + new VarStorage.PartColors{ ColorID = 29, ButtonColor = button30.BackColor }, //Sand green - new PartColors{ ColorID = 151, ButtonColor = button29.BackColor }, + new VarStorage.PartColors{ ColorID = 151, ButtonColor = button29.BackColor }, //Dark orange - new PartColors{ ColorID = 38, ButtonColor = button28.BackColor }, + new VarStorage.PartColors{ ColorID = 38, ButtonColor = button28.BackColor }, //Reddish brown - new PartColors{ ColorID = 192, ButtonColor = button27.BackColor }, + new VarStorage.PartColors{ ColorID = 192, ButtonColor = button27.BackColor }, //Bright violet - new PartColors{ ColorID = 104, ButtonColor = button34.BackColor }, + new VarStorage.PartColors{ ColorID = 104, ButtonColor = button34.BackColor }, //Light reddish violet - new PartColors{ ColorID = 9, ButtonColor = button33.BackColor }, + new VarStorage.PartColors{ ColorID = 9, ButtonColor = button33.BackColor }, //Medium red - new PartColors{ ColorID = 101, ButtonColor = button32.BackColor }, + new VarStorage.PartColors{ ColorID = 101, ButtonColor = button32.BackColor }, //Brick yellow - new PartColors{ ColorID = 5, ButtonColor = button31.BackColor }, + new VarStorage.PartColors{ ColorID = 5, ButtonColor = button31.BackColor }, //Sand red - new PartColors{ ColorID = 153, ButtonColor = button38.BackColor }, + new VarStorage.PartColors{ ColorID = 153, ButtonColor = button38.BackColor }, //Brown - new PartColors{ ColorID = 217, ButtonColor = button37.BackColor }, + new VarStorage.PartColors{ ColorID = 217, ButtonColor = button37.BackColor }, //Nougat - new PartColors{ ColorID = 18, ButtonColor = button36.BackColor }, + new VarStorage.PartColors{ ColorID = 18, ButtonColor = button36.BackColor }, //Light orange - new PartColors{ ColorID = 125, ButtonColor = button35.BackColor }, + new VarStorage.PartColors{ ColorID = 125, ButtonColor = button35.BackColor }, // RARE 2006 COLORS!! //Med. reddish violet - new PartColors{ ColorID = 22, ButtonColor = button69.BackColor }, + new VarStorage.PartColors{ ColorID = 22, ButtonColor = button69.BackColor }, //Dark nougat - new PartColors{ ColorID = 128, ButtonColor = button70.BackColor } + new VarStorage.PartColors{ ColorID = 128, ButtonColor = button70.BackColor } }; } @@ -218,12 +218,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } break; @@ -236,9 +236,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -257,33 +257,33 @@ namespace NovetusLauncher listBox1.Enabled = true; listBox2.Enabled = true; listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -302,9 +302,9 @@ namespace NovetusLauncher listBox8.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.facedir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.facedir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -317,12 +317,12 @@ namespace NovetusLauncher } listBox4.SelectedItem = GlobalVars.UserCustomization.Face; listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -343,9 +343,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.tshirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -358,12 +358,12 @@ namespace NovetusLauncher } listBox5.SelectedItem = GlobalVars.UserCustomization.TShirt; listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -373,7 +373,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + @"\\NoTShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; } break; @@ -390,9 +390,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.shirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.shirtdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -405,12 +405,12 @@ namespace NovetusLauncher } listBox6.SelectedItem = GlobalVars.UserCustomization.Shirt; listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -420,7 +420,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + @"\\NoShirt.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; } break; @@ -437,9 +437,9 @@ namespace NovetusLauncher try { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.pantsdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.pantsdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -452,12 +452,12 @@ namespace NovetusLauncher } listBox7.SelectedItem = GlobalVars.UserCustomization.Pants; listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -467,7 +467,7 @@ namespace NovetusLauncher } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + @"\\NoPants.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + @"\\NoPants.png"); pictureBox7.Image = icon1; } break; @@ -482,9 +482,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox9.Items.Clear(); - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.headdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -497,12 +497,12 @@ namespace NovetusLauncher } listBox8.SelectedItem = GlobalVars.UserCustomization.Head; listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -521,9 +521,9 @@ namespace NovetusLauncher listBox7.Items.Clear(); listBox8.Items.Clear(); - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -538,9 +538,9 @@ namespace NovetusLauncher if (GlobalVars.UserCustomization.ShowHatsInExtra == true) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -563,11 +563,11 @@ namespace NovetusLauncher listBox9.Enabled = true; try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -576,13 +576,13 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -615,15 +615,15 @@ namespace NovetusLauncher void ListBox1SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -634,15 +634,15 @@ namespace NovetusLauncher void ListBox2SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -653,15 +653,15 @@ namespace NovetusLauncher void ListBox3SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -672,45 +672,45 @@ namespace NovetusLauncher void Button41Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.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(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -721,41 +721,41 @@ namespace NovetusLauncher void Button42Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { listBox1.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + ".png"); pictureBox1.Image = icon1; listBox2.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); - Image icon2 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); + Image icon2 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + ".png"); pictureBox2.Image = icon2; listBox3.SelectedItem = "NoHat.rbxm"; GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); - Image icon3 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); + Image icon3 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + ".png"); pictureBox3.Image = icon3; - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt")) { - textBox2.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); + textBox2.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat1.Replace(".rbxm", "") + "_desc.txt"); } else { textBox2.Text = GlobalVars.UserCustomization.Hat1; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt")) { - textBox3.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); + textBox3.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat2.Replace(".rbxm", "") + "_desc.txt"); } else { textBox3.Text = GlobalVars.UserCustomization.Hat2; } - if (File.Exists(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.hatdir + @"\\" + GlobalVars.UserCustomization.Hat3.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -768,15 +768,15 @@ namespace NovetusLauncher void ListBox4SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -787,18 +787,18 @@ namespace NovetusLauncher void Button45Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.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(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -809,16 +809,16 @@ namespace NovetusLauncher void Button44Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.facedir)) + if (Directory.Exists(GlobalPaths.facedir)) { listBox4.SelectedItem = "DefaultFace.rbxm"; GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.facedir + "\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + ".png"); pictureBox4.Image = icon1; - if (File.Exists(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt")) { - textBox6.Text = File.ReadAllText(Directories.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); + textBox6.Text = File.ReadAllText(GlobalPaths.facedir + @"\\" + GlobalVars.UserCustomization.Face.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -831,19 +831,19 @@ namespace NovetusLauncher void ListBox5SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { string previtem = listBox5.SelectedItem.ToString(); textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox5.SelectedItem = previtem; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -854,7 +854,7 @@ namespace NovetusLauncher void Button47Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; @@ -862,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(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -878,18 +878,18 @@ namespace NovetusLauncher void Button46Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.tshirtdir)) + if (Directory.Exists(GlobalPaths.tshirtdir)) { textBox11.Text = ""; comboBox2.SelectedItem = "Roblox"; listBox5.SelectedItem = "NoTShirt.rbxm"; GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.tshirtdir + "\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + ".png"); pictureBox5.Image = icon1; - if (File.Exists(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox7.Text = File.ReadAllText(Directories.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); + textBox7.Text = File.ReadAllText(GlobalPaths.tshirtdir + @"\\" + GlobalVars.UserCustomization.TShirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -902,19 +902,19 @@ namespace NovetusLauncher void ListBox6SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { string previtem = listBox6.SelectedItem.ToString(); textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox6.SelectedItem = previtem; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -925,7 +925,7 @@ namespace NovetusLauncher void Button49Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; @@ -933,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(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -949,18 +949,18 @@ namespace NovetusLauncher void Button48Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.shirtdir)) + if (Directory.Exists(GlobalPaths.shirtdir)) { textBox12.Text = ""; comboBox1.SelectedItem = "Roblox"; listBox6.SelectedItem = "NoShirt.rbxm"; GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.shirtdir + "\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + ".png"); pictureBox6.Image = icon1; - if (File.Exists(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt")) { - textBox8.Text = File.ReadAllText(Directories.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); + textBox8.Text = File.ReadAllText(GlobalPaths.shirtdir + @"\\" + GlobalVars.UserCustomization.Shirt.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -973,19 +973,19 @@ namespace NovetusLauncher void ListBox7SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { string previtem = listBox7.SelectedItem.ToString(); textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox7.SelectedItem = previtem; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -996,7 +996,7 @@ namespace NovetusLauncher void Button51Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; @@ -1004,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(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1020,18 +1020,18 @@ namespace NovetusLauncher void Button50Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.pantsdir)) + if (Directory.Exists(GlobalPaths.pantsdir)) { textBox13.Text = ""; comboBox3.SelectedItem = "Roblox"; listBox7.SelectedItem = "NoPants.rbxm"; GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.pantsdir + "\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + ".png"); pictureBox7.Image = icon1; - if (File.Exists(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(Directories.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); + textBox9.Text = File.ReadAllText(GlobalPaths.pantsdir + @"\\" + GlobalVars.UserCustomization.Pants.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1044,15 +1044,15 @@ namespace NovetusLauncher void ListBox8SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1063,18 +1063,18 @@ namespace NovetusLauncher void Button57Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.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(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1085,16 +1085,16 @@ namespace NovetusLauncher void Button56Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.headdir)) + if (Directory.Exists(GlobalPaths.headdir)) { listBox8.SelectedItem = "DefaultHead.rbxm"; GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.headdir + "\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + ".png"); pictureBox8.Image = icon1; - if (File.Exists(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt")) { - textBox5.Text = File.ReadAllText(Directories.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalPaths.headdir + @"\\" + GlobalVars.UserCustomization.Head.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1435,8 +1435,8 @@ namespace NovetusLauncher { LauncherFuncs.ReloadLoadtextValue(); string luafile = "rbxasset://scripts\\\\CSView.lua"; - string mapfile = Directories.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; - string rbxexe = Directories.BasePathLauncher + "\\preview\\3DView.exe"; + string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; + string rbxexe = GlobalPaths.BasePathLauncher + "\\preview\\3DView.exe"; string quote = "\""; string args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CS3DView(0,'Player'," + GlobalVars.loadtext + ");" + quote; try @@ -1487,17 +1487,17 @@ namespace NovetusLauncher void ListBox9SelectedIndexChanged(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1506,15 +1506,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1527,7 +1527,7 @@ namespace NovetusLauncher void Button59Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { Random random = new Random(); int randomItem1 = random.Next(listBox9.Items.Count); @@ -1535,12 +1535,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1549,15 +1549,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1570,18 +1570,18 @@ namespace NovetusLauncher void Button58Click(object sender, EventArgs e) { - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { listBox9.SelectedItem = "NoExtra.rbxm"; try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1590,15 +1590,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1616,9 +1616,9 @@ namespace NovetusLauncher case true: GlobalVars.UserCustomization.ShowHatsInExtra = true; - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1640,9 +1640,9 @@ namespace NovetusLauncher GlobalVars.UserCustomization.ShowHatsInExtra = false; listBox9.Items.Clear(); - if (Directory.Exists(Directories.extradir)) + if (Directory.Exists(GlobalPaths.extradir)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.extradir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.extradir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -1659,12 +1659,12 @@ namespace NovetusLauncher try { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = false; - if (File.Exists(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.extradir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1673,15 +1673,15 @@ namespace NovetusLauncher } catch (Exception) { - if (Directory.Exists(Directories.hatdir)) + if (Directory.Exists(GlobalPaths.hatdir)) { GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; GlobalVars.UserCustomization.ExtraSelectionIsHat = true; - if (File.Exists(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt")) { - textBox10.Text = File.ReadAllText(Directories.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); + textBox10.Text = File.ReadAllText(GlobalPaths.hatdir + "\\" + GlobalVars.UserCustomization.Extra.Replace(".rbxm", "") + "_desc.txt"); } else { @@ -1713,12 +1713,12 @@ namespace NovetusLauncher try { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png"); pictureBox10.Image = icon1; } catch (Exception) { - Image icon1 = LauncherFuncs.LoadImage(Directories.extradir + "\\NoExtra.png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalPaths.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; } } @@ -1775,7 +1775,7 @@ namespace NovetusLauncher private void button71_Click(object sender, EventArgs e) { - LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); MessageBox.Show("Outfit Saved!"); } diff --git a/Novetus/NovetusLauncher/Classes/AddonLoader.cs b/Novetus/NovetusLauncher/Classes/AddonLoader.cs new file mode 100644 index 0000000..0f4138d --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/AddonLoader.cs @@ -0,0 +1,85 @@ +#region Usings +using Ionic.Zip; +using System; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows.Forms; +#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(GlobalPaths.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 diff --git a/Novetus/NovetusLauncher/Classes/CharCustom/IconLoader.cs b/Novetus/NovetusLauncher/Classes/CharCustom/IconLoader.cs new file mode 100644 index 0000000..234491c --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/CharCustom/IconLoader.cs @@ -0,0 +1,65 @@ +#region Usings +using System; +using System.IO; +using System.Windows.Forms; +#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(GlobalPaths.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/Novetus/NovetusLauncher/Classes/LocalVars.cs b/Novetus/NovetusLauncher/Classes/LocalVars.cs index f5dc9e5..304793b 100644 --- a/Novetus/NovetusLauncher/Classes/LocalVars.cs +++ b/Novetus/NovetusLauncher/Classes/LocalVars.cs @@ -1,16 +1,4 @@ -#region Usings -using Ionic.Zip; -using System; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using System.Xml; -using System.Xml.Linq; -#endregion - + namespace NovetusLauncher { #region LocalVars @@ -22,801 +10,4 @@ namespace NovetusLauncher public static bool LocalPlayMode = false; } #endregion - - #region Downloader - class Downloader - { - private readonly string fileURL; - private readonly string fileName; - private readonly string fileFilter; - private string downloadOutcome; - private static string downloadOutcomeException; - - public Downloader(string url, string name, string filter) - { - fileName = name; - fileURL = url; - fileFilter = filter; - } - - public Downloader(string url, string name) - { - fileName = name; - fileURL = url; - fileFilter = ""; - } - - public void setDownloadOutcome(string text) - { - downloadOutcome = text; - } - - public string getDownloadOutcome() - { - return downloadOutcome; - } - - public void InitDownload(string path, string fileext, string additionalText = "") - { - string downloadOutcomeAddText = additionalText; - - string outputfilename = fileName + fileext; - string fullpath = path + "\\" + outputfilename; - - try - { - int read = DownloadFile(fileURL, fullpath); - downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; - } - catch (Exception ex) - { - downloadOutcome = "Error when downloading file: " + ex.Message; - } - } - - public void InitDownload(string additionalText = "") - { - string downloadOutcomeAddText = additionalText; - - SaveFileDialog saveFileDialog1 = new SaveFileDialog - { - FileName = fileName, - //"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*" - Filter = fileFilter, - Title = "Save " + fileName - }; - - if (saveFileDialog1.ShowDialog() == DialogResult.OK) - { - try - { - int read = DownloadFile(fileURL, saveFileDialog1.FileName); - downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; - } - catch (Exception ex) - { - downloadOutcome = "Error when downloading file: " + ex.Message; - } - } - } - - 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) - - // Function will return the number of bytes processed - // to the caller. Initialize to 0 here. - int bytesProcessed = 0; - - // Assign values to these objects here so that they can - // be referenced in the finally block - Stream remoteStream = null; - Stream localStream = null; - WebResponse response = null; - - // Use a try/catch/finally block as both the WebRequest and Stream - // classes throw exceptions upon error - //thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code! - try - { - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls - | (SecurityProtocolType)3072 - | (SecurityProtocolType)768 - | SecurityProtocolType.Ssl3; - // Create a request for the specified remote file name - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename); - request.UserAgent = "Roblox/WinINet"; - request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate"); - request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; - if (request != null) - { - // Send the request to the server and retrieve the - // WebResponse object - response = request.GetResponse(); - if (response != null) - { - // Once the WebResponse object has been retrieved, - // get the stream object associated with the response's data - remoteStream = response.GetResponseStream(); - - // Create the local file - localStream = File.Create(localFilename); - - // Allocate a 1k buffer - byte[] buffer = new byte[1024]; - int bytesRead; - - // Simple do/while loop to read from stream until - // no bytes are returned - do - { - // Read data (up to 1k) from the stream - bytesRead = remoteStream.Read(buffer, 0, buffer.Length); - - // Write the data to the local file - localStream.Write(buffer, 0, bytesRead); - - // Increment total bytes processed - bytesProcessed += bytesRead; - } while (bytesRead > 0); - } - } - } - catch (Exception e) - { - downloadOutcomeException = " Exception detected: " + e.Message; - } - finally - { - // Close the response and streams objects here - // to make sure they're closed even if an exception - // is thrown at some point - if (response != null) response.Close(); - if (remoteStream != null) remoteStream.Close(); - if (localStream != null) localStream.Close(); - } - - // Return total bytes processed to caller. - 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 - - #region Roblox Type Definitions - public class RobloxDefs - { - 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 - - #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 - - #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.ProgramInformation.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/Novetus/NovetusLauncher/Classes/SDK/Downloader.cs b/Novetus/NovetusLauncher/Classes/SDK/Downloader.cs new file mode 100644 index 0000000..2a45bb6 --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/SDK/Downloader.cs @@ -0,0 +1,167 @@ +#region Usings +using System; +using System.IO; +using System.Net; +using System.Windows.Forms; +#endregion + +#region Downloader + +class Downloader +{ + private readonly string fileURL; + private readonly string fileName; + private readonly string fileFilter; + private string downloadOutcome; + private static string downloadOutcomeException; + + public Downloader(string url, string name, string filter) + { + fileName = name; + fileURL = url; + fileFilter = filter; + } + + public Downloader(string url, string name) + { + fileName = name; + fileURL = url; + fileFilter = ""; + } + + public void setDownloadOutcome(string text) + { + downloadOutcome = text; + } + + public string getDownloadOutcome() + { + return downloadOutcome; + } + + public void InitDownload(string path, string fileext, string additionalText = "") + { + string downloadOutcomeAddText = additionalText; + + string outputfilename = fileName + fileext; + string fullpath = path + "\\" + outputfilename; + + try + { + int read = DownloadFile(fileURL, fullpath); + downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; + } + catch (Exception ex) + { + downloadOutcome = "Error when downloading file: " + ex.Message; + } + } + + public void InitDownload(string additionalText = "") + { + string downloadOutcomeAddText = additionalText; + + SaveFileDialog saveFileDialog1 = new SaveFileDialog + { + FileName = fileName, + //"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*" + Filter = fileFilter, + Title = "Save " + fileName + }; + + if (saveFileDialog1.ShowDialog() == DialogResult.OK) + { + try + { + int read = DownloadFile(fileURL, saveFileDialog1.FileName); + downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; + } + catch (Exception ex) + { + downloadOutcome = "Error when downloading file: " + ex.Message; + } + } + } + + 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) + + // Function will return the number of bytes processed + // to the caller. Initialize to 0 here. + int bytesProcessed = 0; + + // Assign values to these objects here so that they can + // be referenced in the finally block + Stream remoteStream = null; + Stream localStream = null; + WebResponse response = null; + + // Use a try/catch/finally block as both the WebRequest and Stream + // classes throw exceptions upon error + //thanks to https://stackoverflow.com/questions/33761919/tls-1-2-in-net-framework-4-0 for the net 4.0 compatible TLS 1.1/1.2 code! + try + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls + | (SecurityProtocolType)3072 + | (SecurityProtocolType)768 + | SecurityProtocolType.Ssl3; + // Create a request for the specified remote file name + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(remoteFilename); + request.UserAgent = "Roblox/WinINet"; + request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate"); + request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; + if (request != null) + { + // Send the request to the server and retrieve the + // WebResponse object + response = request.GetResponse(); + if (response != null) + { + // Once the WebResponse object has been retrieved, + // get the stream object associated with the response's data + remoteStream = response.GetResponseStream(); + + // Create the local file + localStream = File.Create(localFilename); + + // Allocate a 1k buffer + byte[] buffer = new byte[1024]; + int bytesRead; + + // Simple do/while loop to read from stream until + // no bytes are returned + do + { + // Read data (up to 1k) from the stream + bytesRead = remoteStream.Read(buffer, 0, buffer.Length); + + // Write the data to the local file + localStream.Write(buffer, 0, bytesRead); + + // Increment total bytes processed + bytesProcessed += bytesRead; + } while (bytesRead > 0); + } + } + } + catch (Exception e) + { + downloadOutcomeException = " Exception detected: " + e.Message; + } + finally + { + // Close the response and streams objects here + // to make sure they're closed even if an exception + // is thrown at some point + if (response != null) response.Close(); + if (remoteStream != null) remoteStream.Close(); + if (localStream != null) localStream.Close(); + } + + // Return total bytes processed to caller. + return bytesProcessed; + } +} +#endregion diff --git a/Novetus/NovetusLauncher/Classes/SDK/RobloxXMLLocalizer.cs b/Novetus/NovetusLauncher/Classes/SDK/RobloxXMLLocalizer.cs new file mode 100644 index 0000000..024ba79 --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/SDK/RobloxXMLLocalizer.cs @@ -0,0 +1,439 @@ +#region Usings +using NovetusLauncher; +using System; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using System.Xml; +using System.Xml.Linq; +#endregion + +#region Roblox File Types +public enum RobloxFileType +{ + //RBXL and RBXM + RBXL, + RBXM, + //Items + Hat, + Head, + Face, + TShirt, + Shirt, + Pants +} +#endregion + +#region Roblox Type Definitions +public struct RobloxDefs +{ + public static VarStorage.AssetCacheDef Fonts + { + get + { + return new VarStorage.AssetCacheDef("SpecialMesh", + new string[] { "MeshId", "TextureId" }, + new string[] { ".mesh", ".png" }, + new string[] { GlobalPaths.AssetCacheDirFonts, GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheFontsGameDir, GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Sky + { + get + { + return new VarStorage.AssetCacheDef("Sky", + new string[] { "SkyboxBk", "SkyboxDn", "SkyboxFt", "SkyboxLf", "SkyboxRt", "SkyboxUp" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirSky }, + new string[] { GlobalPaths.AssetCacheSkyGameDir }); + } + } + + public static VarStorage.AssetCacheDef Decal + { + get + { + return new VarStorage.AssetCacheDef("Decal", + new string[] { "Texture" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Texture + { + get + { + return new VarStorage.AssetCacheDef("Texture", + new string[] { "Texture" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef HopperBin + { + get + { + return new VarStorage.AssetCacheDef("HopperBin", + new string[] { "TextureId" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Tool + { + get + { + return new VarStorage.AssetCacheDef("Tool", + new string[] { "TextureId" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Sound + { + get + { + return new VarStorage.AssetCacheDef("Sound", + new string[] { "SoundId" }, + new string[] { ".wav" }, + new string[] { GlobalPaths.AssetCacheDirSounds }, + new string[] { GlobalPaths.AssetCacheSoundsGameDir }); + } + } + + public static VarStorage.AssetCacheDef ImageLabel + { + get + { + return new VarStorage.AssetCacheDef("ImageLabel", + new string[] { "Image" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Shirt + { + get + { + return new VarStorage.AssetCacheDef("Shirt", + new string[] { "ShirtTemplate" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef ShirtGraphic + { + get + { + return new VarStorage.AssetCacheDef("ShirtGraphic", + new string[] { "Graphic" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Pants + { + get + { + return new VarStorage.AssetCacheDef("Pants", + new string[] { "PantsTemplate" }, + new string[] { ".png" }, + new string[] { GlobalPaths.AssetCacheDirTextures }, + new string[] { GlobalPaths.AssetCacheTexturesGameDir }); + } + } + + public static VarStorage.AssetCacheDef Script + { + get + { + return new VarStorage.AssetCacheDef("Script", + new string[] { "LinkedSource" }, + new string[] { ".lua" }, + new string[] { GlobalPaths.AssetCacheDirScripts }, + new string[] { GlobalPaths.AssetCacheScriptsGameDir }); + } + } + + public static VarStorage.AssetCacheDef LocalScript + { + get + { + return new VarStorage.AssetCacheDef("LocalScript", + new string[] { "LinkedSource" }, + new string[] { ".lua" }, + new string[] { GlobalPaths.AssetCacheDirScripts }, + new string[] { GlobalPaths.AssetCacheScriptsGameDir }); + } + } + + //item defs below + public static VarStorage.AssetCacheDef ItemHatFonts + { + get + { + return new VarStorage.AssetCacheDef("SpecialMesh", + new string[] { "MeshId", "TextureId" }, + new string[] { ".mesh", ".png" }, + new string[] { GlobalPaths.hatdirFonts, GlobalPaths.hatdirTextures }, + new string[] { GlobalPaths.hatGameDirFonts, GlobalPaths.hatGameDirTextures }); + } + } + + public static VarStorage.AssetCacheDef ItemHatSound + { + get + { + return new VarStorage.AssetCacheDef("Sound", + new string[] { "SoundId" }, + new string[] { ".wav" }, + new string[] { GlobalPaths.hatdirSounds }, + new string[] { GlobalPaths.hatGameDirSounds }); + } + } + + public static VarStorage.AssetCacheDef ItemHatScript + { + get + { + return new VarStorage.AssetCacheDef("Script", + new string[] { "LinkedSource" }, + new string[] { ".lua" }, + new string[] { GlobalPaths.hatdirScripts }, + new string[] { GlobalPaths.hatGameDirScripts }); + } + } + + public static VarStorage.AssetCacheDef ItemHatLocalScript + { + get + { + return new VarStorage.AssetCacheDef("LocalScript", + new string[] { "LinkedSource" }, + new string[] { ".lua" }, + new string[] { GlobalPaths.hatdirScripts }, + new string[] { GlobalPaths.hatGameDirScripts }); + } + } + + public static VarStorage.AssetCacheDef ItemHeadFonts + { + get + { + return new VarStorage.AssetCacheDef("SpecialMesh", + new string[] { "MeshId", "TextureId" }, + new string[] { ".mesh", ".png" }, + new string[] { GlobalPaths.headdirFonts, GlobalPaths.headdirTextures }, + new string[] { GlobalPaths.headGameDirFonts, GlobalPaths.headGameDirTextures }); + } + } + + public static VarStorage.AssetCacheDef ItemFaceTexture + { + get + { + return new VarStorage.AssetCacheDef("Decal", + new string[] { "Texture" }, + new string[] { ".png" }, + new string[] { GlobalPaths.facedirTextures }, + new string[] { GlobalPaths.faceGameDirTextures }); + } + } + + public static VarStorage.AssetCacheDef ItemShirtTexture + { + get + { + return new VarStorage.AssetCacheDef("Shirt", + new string[] { "ShirtTemplate" }, + new string[] { ".png" }, + new string[] { GlobalPaths.shirtdirTextures }, + new string[] { GlobalPaths.shirtGameDirTextures }); + } + } + + public static VarStorage.AssetCacheDef ItemTShirtTexture + { + get + { + return new VarStorage.AssetCacheDef("ShirtGraphic", + new string[] { "Graphic" }, + new string[] { ".png" }, + new string[] { GlobalPaths.tshirtdirTextures }, + new string[] { GlobalPaths.tshirtGameDirTextures }); + } + } + + public static VarStorage.AssetCacheDef ItemPantsTexture + { + get + { + return new VarStorage.AssetCacheDef("Pants", + new string[] { "PantsTemplate" }, + new string[] { ".png" }, + new string[] { GlobalPaths.pantsdirTextures }, + new string[] { GlobalPaths.pantsGameDirTextures }); + } + } +} +#endregion + +#region Roblox XML Localizer +public static class RobloxXMLLocalizer +{ + public static void DownloadFromNodes(string filepath, VarStorage.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, VarStorage.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 diff --git a/Novetus/NovetusLauncher/Classes/SplashLoader.cs b/Novetus/NovetusLauncher/Classes/SplashLoader.cs new file mode 100644 index 0000000..50f884c --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/SplashLoader.cs @@ -0,0 +1,94 @@ +#region Usings +using System; +using System.IO; +#endregion + +#region Splash Reader + +public static class SplashReader +{ + private static string RandomSplash() + { + string[] splashes = File.ReadAllLines(GlobalPaths.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.ProgramInformation.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/Novetus/NovetusLauncher/Classes/WinForms/FormExt.cs b/Novetus/NovetusLauncher/Classes/WinForms/FormExt.cs new file mode 100644 index 0000000..f3d7eaa --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/WinForms/FormExt.cs @@ -0,0 +1,28 @@ +#region Usings +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; +#endregion + +#region Form Extensions +public static class FormExt +{ + [DllImport("user32")] + public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); + + [DllImport("user32")] + public static extern bool EnableMenuItem(IntPtr hMenu, uint itemId, uint uEnable); + + public static void DisableCloseButton(this Form form) + { + // The 1 parameter means to gray out. 0xF060 is SC_CLOSE. + EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 1); + } + + public static void EnableCloseButton(this Form form) + { + // The zero parameter means to enable. 0xF060 is SC_CLOSE. + EnableMenuItem(GetSystemMenu(form.Handle, false), 0xF060, 0); + } +} +#endregion diff --git a/Novetus/NovetusLauncher/Classes/WinForms/TabControlWithoutHeader.cs b/Novetus/NovetusLauncher/Classes/WinForms/TabControlWithoutHeader.cs new file mode 100644 index 0000000..0e17912 --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/WinForms/TabControlWithoutHeader.cs @@ -0,0 +1,45 @@ +#region Usings +using System; +using System.Windows.Forms; +#endregion + +#region Tab Control without Header +//https://stackoverflow.com/questions/23247941/c-sharp-how-to-remove-tabcontrol-border + +public partial class TabControlWithoutHeader : TabControl +{ + int layoutval = 1; + + public TabControlWithoutHeader(int layout) + { + SetLayout(layout); + } + public TabControlWithoutHeader() + { + SetLayout(1); + } + + private void SetLayout(int layout) + { + layoutval = layout; + if (layoutval == 1) + { + if (!DesignMode) Multiline = true; + } + } + + protected override void WndProc(ref Message m) + { + if (layoutval == 2) + { + base.WndProc(ref m); + return; + } + + if (m.Msg == 0x1328 && !DesignMode) + m.Result = new IntPtr(1); + else + base.WndProc(ref m); + } +} +#endregion diff --git a/Novetus/NovetusLauncher/Classes/WinForms/TreeNodeHelper.cs b/Novetus/NovetusLauncher/Classes/WinForms/TreeNodeHelper.cs new file mode 100644 index 0000000..1e8da8b --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/WinForms/TreeNodeHelper.cs @@ -0,0 +1,119 @@ +#region Usings +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Windows.Forms; +#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(GlobalPaths.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 diff --git a/Novetus/NovetusLauncher/MainForm/Compact/MainForm_legacy.cs b/Novetus/NovetusLauncher/MainForm/Compact/MainForm_legacy.cs index ebd5a5f..46964f9 100644 --- a/Novetus/NovetusLauncher/MainForm/Compact/MainForm_legacy.cs +++ b/Novetus/NovetusLauncher/MainForm/Compact/MainForm_legacy.cs @@ -25,7 +25,7 @@ namespace NovetusLauncher /// public partial class MainForm_legacy : Form { - DiscordRpc.EventHandlers handlers; + IDiscordRPC.EventHandlers handlers; public MainForm_legacy() { @@ -48,12 +48,12 @@ namespace NovetusLauncher { try { - UPnP.InitUPnP(DeviceFound,DeviceLost); + NetFuncs.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } catch (Exception ex) { - ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); + ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2); } } } @@ -64,7 +64,7 @@ namespace NovetusLauncher { try { - UPnP.StartUPnP(device,protocol,port); + NetFuncs.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -80,7 +80,7 @@ namespace NovetusLauncher { try { - UPnP.StopUPnP(device,protocol,port); + NetFuncs.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -149,7 +149,7 @@ namespace NovetusLauncher { } - public void RequestCallback(DiscordRpc.JoinRequest request) + public void RequestCallback(IDiscordRPC.JoinRequest request) { } @@ -157,14 +157,14 @@ namespace NovetusLauncher { if (GlobalVars.UserConfiguration.DiscordPresence) { - handlers = new DiscordRpc.EventHandlers(); + handlers = new IDiscordRPC.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; handlers.requestCallback += RequestCallback; - DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); + IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true); } @@ -179,7 +179,7 @@ namespace NovetusLauncher { try { - GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); + GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } catch (Exception ex) @@ -272,7 +272,7 @@ namespace NovetusLauncher textBox3.ScrollToCaret(); break; case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: - string mapdir = Directories.MapsDir; + string mapdir = GlobalPaths.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); @@ -283,7 +283,7 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: - string clientdir = Directories.ClientDir; + string clientdir = GlobalPaths.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) @@ -299,8 +299,8 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox3.Items.AddRange(lines_server); listBox4.Items.AddRange(lines_ports); treeView1.Nodes.Clear(); @@ -406,69 +406,69 @@ namespace NovetusLauncher { Text = "Novetus " + GlobalVars.ProgramInformation.Version; ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4); - ConsolePrint("Novetus path: " + Directories.BasePath, 4); - if (File.Exists(Directories.RootPath + "\\changelog.txt")) + ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4); + if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt")) { - richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt"); + richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt"); } else { - ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2); + ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2); } - if (File.Exists(Directories.RootPath + "\\credits.txt")) + if (File.Exists(GlobalPaths.RootPath + "\\credits.txt")) { - richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt"); + richTextBox3.Text = File.ReadAllText(GlobalPaths.RootPath + "\\credits.txt"); } else { - ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2); + ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\credits.txt not found.", 2); } - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName)) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); } - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); WriteCustomizationValues(); } - if (!File.Exists(Directories.ConfigDir + "\\servers.txt")) + if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt")) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); - File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); } - if (!File.Exists(Directories.ConfigDir + "\\ports.txt")) + if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt")) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); - File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(Directories.AssetCacheDirFonts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts)) { - Directory.CreateDirectory(Directories.AssetCacheDirFonts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts); } - if (!Directory.Exists(Directories.AssetCacheDirSky)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSky)) { - Directory.CreateDirectory(Directories.AssetCacheDirSky); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky); } - if (!Directory.Exists(Directories.AssetCacheDirSounds)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds)) { - Directory.CreateDirectory(Directories.AssetCacheDirSounds); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds); } - if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(Directories.AssetCacheDirScripts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts)) { - Directory.CreateDirectory(Directories.AssetCacheDirScripts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts); } label8.Text = Application.ProductVersion; @@ -492,7 +492,7 @@ namespace NovetusLauncher } if (GlobalVars.UserConfiguration.DiscordPresence) { - DiscordRpc.Shutdown(); + IDiscordRPC.Shutdown(); } if (GlobalVars.IsWebServerOn) { @@ -502,7 +502,7 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString(); @@ -525,19 +525,19 @@ namespace NovetusLauncher void WriteConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } void WriteCustomizationValues() { - LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); ConsolePrint("Config Saved.", 3); } void ReadClientValues(string ClientName) { - string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { @@ -697,21 +697,21 @@ namespace NovetusLauncher void Button10Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); } void Button11Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.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() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp"); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.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() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp"); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } } void Button14Click(object sender, EventArgs e) { - File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); + File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button15Click(object sender, EventArgs e) { - File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); + File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } void Button16Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button17Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } @@ -841,17 +841,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Client); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); } try { @@ -947,17 +947,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Solo) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Solo); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Solo); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -991,11 +991,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Server); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -1003,11 +1003,11 @@ namespace NovetusLauncher { if (!no3d) { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } } try @@ -1043,17 +1043,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Studio) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Studio); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Studio); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -1081,24 +1081,24 @@ namespace NovetusLauncher label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); - string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl"; + string mapfile = GlobalPaths.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.EasterEgg); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -1238,7 +1238,7 @@ namespace NovetusLauncher { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe"; + startInfo.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.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 = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe"; + startInfo2.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe"; startInfo2.Arguments = "/regserver"; startInfo2.Verb = "runas"; process2.StartInfo = startInfo2; @@ -1296,7 +1296,7 @@ namespace NovetusLauncher void Button23Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button22Click(object sender, EventArgs e) @@ -1312,12 +1312,12 @@ namespace NovetusLauncher { GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString(); GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); - GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; + GlobalVars.UserConfiguration.MapPath = GlobalPaths.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; label28.Text = GlobalVars.UserConfiguration.Map; - if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1328,7 +1328,7 @@ namespace NovetusLauncher void Button6Click(object sender, EventArgs e) { - Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\")); + Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\",@"\")); } void CheckBox4CheckedChanged(object sender, EventArgs e) @@ -1345,14 +1345,14 @@ namespace NovetusLauncher { treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); - string mapdir = Directories.MapsDir; + string mapdir = GlobalPaths.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.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(Directories.AssetCacheDir)) + if (Directory.Exists(GlobalPaths.AssetCacheDir)) { - Directory.Delete(Directories.AssetCacheDir, true); + Directory.Delete(GlobalPaths.AssetCacheDir, true); ConsolePrint("Asset cache cleared!", 3); MessageBox.Show("Asset cache cleared!"); } @@ -1516,7 +1516,7 @@ namespace NovetusLauncher private void button36_Click(object sender, EventArgs e) { - GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Extended; + GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Extended; WriteConfigValues(); Application.Restart(); } diff --git a/Novetus/NovetusLauncher/MainForm/Compact/NovetusSettings.cs b/Novetus/NovetusLauncher/MainForm/Compact/NovetusSettings.cs index adf94f9..490d88d 100644 --- a/Novetus/NovetusLauncher/MainForm/Compact/NovetusSettings.cs +++ b/Novetus/NovetusLauncher/MainForm/Compact/NovetusSettings.cs @@ -18,17 +18,17 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); checkBox5.Checked = GlobalVars.UserConfiguration.ReShade; checkBox6.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay; checkBox7.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode; switch (GlobalVars.UserConfiguration.GraphicsMode) { - case GraphicsMode.DirectX: + case Settings.GraphicsOptions.Mode.DirectX: comboBox1.SelectedIndex = 1; break; - case GraphicsMode.OpenGL: + case Settings.GraphicsOptions.Mode.OpenGL: default: comboBox1.SelectedIndex = 0; break; @@ -36,19 +36,19 @@ namespace NovetusLauncher switch (GlobalVars.UserConfiguration.QualityLevel) { - case QualityLevel.VeryLow: + case Settings.QualityOptions.Level.VeryLow: comboBox2.SelectedIndex = 0; break; - case QualityLevel.Low: + case Settings.QualityOptions.Level.Low: comboBox2.SelectedIndex = 1; break; - case QualityLevel.Medium: + case Settings.QualityOptions.Level.Medium: comboBox2.SelectedIndex = 2; break; - case QualityLevel.High: + case Settings.QualityOptions.Level.High: comboBox2.SelectedIndex = 3; break; - case QualityLevel.Ultra: + case Settings.QualityOptions.Level.Ultra: default: comboBox2.SelectedIndex = 4; break; @@ -75,10 +75,10 @@ namespace NovetusLauncher switch (comboBox1.SelectedIndex) { case 1: - GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX; + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.DirectX; break; default: - GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL; break; } } @@ -88,20 +88,20 @@ namespace NovetusLauncher switch (comboBox2.SelectedIndex) { case 0: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.VeryLow; break; case 1: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Low; break; case 2: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Medium; break; case 3: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.High; break; case 4: default: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra; break; } } diff --git a/Novetus/NovetusLauncher/MainForm/Extended/MainForm.cs b/Novetus/NovetusLauncher/MainForm/Extended/MainForm.cs index 17324b0..66ba39b 100644 --- a/Novetus/NovetusLauncher/MainForm/Extended/MainForm.cs +++ b/Novetus/NovetusLauncher/MainForm/Extended/MainForm.cs @@ -24,7 +24,7 @@ namespace NovetusLauncher /// public partial class MainForm : Form { - DiscordRpc.EventHandlers handlers; + IDiscordRPC.EventHandlers handlers; public MainForm() { @@ -49,12 +49,12 @@ namespace NovetusLauncher { try { - UPnP.InitUPnP(DeviceFound,DeviceLost); + NetFuncs.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } catch (Exception ex) { - ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); + ConsolePrint("UPnP: Unable to initialize NetFuncs. Reason - " + ex.Message, 2); } } } @@ -65,7 +65,7 @@ namespace NovetusLauncher { try { - UPnP.StartUPnP(device,protocol,port); + NetFuncs.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -81,7 +81,7 @@ namespace NovetusLauncher { try { - UPnP.StopUPnP(device,protocol,port); + NetFuncs.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } catch (Exception ex) @@ -150,7 +150,7 @@ namespace NovetusLauncher { } - public void RequestCallback(DiscordRpc.JoinRequest request) + public void RequestCallback(IDiscordRPC.JoinRequest request) { } @@ -158,14 +158,14 @@ namespace NovetusLauncher { if (GlobalVars.UserConfiguration.DiscordPresence) { - handlers = new DiscordRpc.EventHandlers(); + handlers = new IDiscordRPC.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; handlers.requestCallback += RequestCallback; - DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); + IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true); } @@ -180,7 +180,7 @@ namespace NovetusLauncher { try { - GlobalVars.WebServer = new SimpleHTTPServer(Directories.ServerDir, GlobalVars.WebServerPort); + GlobalVars.WebServer = new SimpleHTTPServer(GlobalPaths.ServerDir, GlobalVars.WebServerPort); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } catch (Exception ex) @@ -273,7 +273,7 @@ namespace NovetusLauncher textBox3.ScrollToCaret(); break; case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: - string mapdir = Directories.MapsDir; + string mapdir = GlobalPaths.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); @@ -284,7 +284,7 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: - string clientdir = Directories.ClientDir; + string clientdir = GlobalPaths.ClientDir; DirectoryInfo dinfo = new DirectoryInfo(clientdir); DirectoryInfo[] Dirs = dinfo.GetDirectories(); foreach (DirectoryInfo dir in Dirs) @@ -300,8 +300,8 @@ namespace NovetusLauncher listBox4.Items.Clear(); break; case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox3.Items.AddRange(lines_server); listBox4.Items.AddRange(lines_ports); treeView1.Nodes.Clear(); @@ -407,69 +407,69 @@ namespace NovetusLauncher { Text = "Novetus " + GlobalVars.ProgramInformation.Version; ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4); - ConsolePrint("Novetus path: " + Directories.BasePath, 4); - if (File.Exists(Directories.RootPath + "\\changelog.txt")) + ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4); + if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt")) { - richTextBox2.Text = File.ReadAllText(Directories.RootPath + "\\changelog.txt"); + richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt"); } else { - ConsolePrint("ERROR - " + Directories.RootPath + "\\changelog.txt not found.", 2); + ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\changelog.txt not found.", 2); } - if (File.Exists(Directories.RootPath + "\\credits.txt")) + if (File.Exists(GlobalPaths.RootPath + "\\credits.txt")) { - richTextBox3.Text = File.ReadAllText(Directories.RootPath + "\\credits.txt"); + richTextBox3.Text = File.ReadAllText(GlobalPaths.RootPath + "\\credits.txt"); } else { - ConsolePrint("ERROR - " + Directories.RootPath + "\\credits.txt not found.", 2); + ConsolePrint("ERROR - " + GlobalPaths.RootPath + "\\credits.txt not found.", 2); } - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigName)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName)) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName + " not found. Creating one with default values.", 5); WriteConfigValues(); } - if (!File.Exists(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) + if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization)) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization + " not found. Creating one with default values.", 5); WriteCustomizationValues(); } - if (!File.Exists(Directories.ConfigDir + "\\servers.txt")) + if (!File.Exists(GlobalPaths.ConfigDir + "\\servers.txt")) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); - File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\servers.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); } - if (!File.Exists(Directories.ConfigDir + "\\ports.txt")) + if (!File.Exists(GlobalPaths.ConfigDir + "\\ports.txt")) { - ConsolePrint("WARNING - " + Directories.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); - File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); + ConsolePrint("WARNING - " + GlobalPaths.ConfigDir + "\\ports.txt not found. Creating empty file.", 5); + File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(Directories.AssetCacheDirFonts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts)) { - Directory.CreateDirectory(Directories.AssetCacheDirFonts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts); } - if (!Directory.Exists(Directories.AssetCacheDirSky)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSky)) { - Directory.CreateDirectory(Directories.AssetCacheDirSky); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky); } - if (!Directory.Exists(Directories.AssetCacheDirSounds)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds)) { - Directory.CreateDirectory(Directories.AssetCacheDirSounds); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds); } - if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(Directories.AssetCacheDirScripts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts)) { - Directory.CreateDirectory(Directories.AssetCacheDirScripts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts); } label8.Text = Application.ProductVersion; @@ -493,7 +493,7 @@ namespace NovetusLauncher } if (GlobalVars.UserConfiguration.DiscordPresence) { - DiscordRpc.Shutdown(); + IDiscordRPC.Shutdown(); } if (GlobalVars.IsWebServerOn) { @@ -503,7 +503,7 @@ namespace NovetusLauncher void ReadConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString(); @@ -525,10 +525,10 @@ namespace NovetusLauncher switch (GlobalVars.UserConfiguration.GraphicsMode) { - case GraphicsMode.DirectX: + case Settings.GraphicsOptions.Mode.DirectX: comboBox1.SelectedIndex = 1; break; - case GraphicsMode.OpenGL: + case Settings.GraphicsOptions.Mode.OpenGL: default: comboBox1.SelectedIndex = 0; break; @@ -536,19 +536,19 @@ namespace NovetusLauncher switch (GlobalVars.UserConfiguration.QualityLevel) { - case QualityLevel.VeryLow: + case Settings.QualityOptions.Level.VeryLow: comboBox2.SelectedIndex = 0; break; - case QualityLevel.Low: + case Settings.QualityOptions.Level.Low: comboBox2.SelectedIndex = 1; break; - case QualityLevel.Medium: + case Settings.QualityOptions.Level.Medium: comboBox2.SelectedIndex = 2; break; - case QualityLevel.High: + case Settings.QualityOptions.Level.High: comboBox2.SelectedIndex = 3; break; - case QualityLevel.Ultra: + case Settings.QualityOptions.Level.Ultra: default: comboBox2.SelectedIndex = 4; break; @@ -560,19 +560,19 @@ namespace NovetusLauncher void WriteConfigValues() { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); ConsolePrint("Config Saved.", 3); } void WriteCustomizationValues() { - LauncherFuncs.Customization(Directories.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); + LauncherFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true); ConsolePrint("Config Saved.", 3); } void ReadClientValues(string ClientName) { - string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { @@ -732,21 +732,21 @@ namespace NovetusLauncher void Button10Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); } void Button11Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.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() }, Directories.ConfigDir + "\\servers.txt", Directories.ConfigDir + "\\servers.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox3.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\servers.txt", GlobalPaths.ConfigDir + "\\servers.tmp"); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.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() }, Directories.ConfigDir + "\\ports.txt", Directories.ConfigDir + "\\ports.tmp"); + TextLineRemover.RemoveTextLines(new List { listBox4.SelectedItem.ToString() }, GlobalPaths.ConfigDir + "\\ports.txt", GlobalPaths.ConfigDir + "\\ports.tmp"); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } } void Button14Click(object sender, EventArgs e) { - File.Create(Directories.ConfigDir + "\\servers.txt").Dispose(); + File.Create(GlobalPaths.ConfigDir + "\\servers.txt").Dispose(); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button15Click(object sender, EventArgs e) { - File.Create(Directories.ConfigDir + "\\ports.txt").Dispose(); + File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } void Button16Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\servers.txt", GlobalVars.IP + Environment.NewLine); listBox3.Items.Clear(); - string[] lines_server = File.ReadAllLines(Directories.ConfigDir + "\\servers.txt"); + string[] lines_server = File.ReadAllLines(GlobalPaths.ConfigDir + "\\servers.txt"); listBox3.Items.AddRange(lines_server); } void Button17Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); listBox4.Items.Clear(); - string[] lines_ports = File.ReadAllLines(Directories.ConfigDir + "\\ports.txt"); + string[] lines_ports = File.ReadAllLines(GlobalPaths.ConfigDir + "\\ports.txt"); listBox4.Items.AddRange(lines_ports); } @@ -876,17 +876,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Client); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); } try { @@ -982,17 +982,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Solo) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Solo); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Solo); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -1026,11 +1026,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Server); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -1038,11 +1038,11 @@ namespace NovetusLauncher { if (!no3d) { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } } try @@ -1078,17 +1078,17 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Studio) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Studio); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Studio); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -1116,24 +1116,24 @@ namespace NovetusLauncher label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); - string mapfile = Directories.ConfigDirData + "\\Appreciation.rbxl"; + string mapfile = GlobalPaths.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.EasterEgg); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", mapfile, luafile, rbxexe); } try { @@ -1273,7 +1273,7 @@ namespace NovetusLauncher { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient1 + @"\\RobloxApp_studio.exe"; + startInfo.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.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 = Directories.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe"; + startInfo2.FileName = GlobalPaths.ClientDir + @"\\" + GlobalVars.ProgramInformation.RegisterClient2 + @"\\RobloxApp_studio.exe"; startInfo2.Arguments = "/regserver"; startInfo2.Verb = "runas"; process2.StartInfo = startInfo2; @@ -1331,7 +1331,7 @@ namespace NovetusLauncher void Button23Click(object sender, EventArgs e) { - File.AppendAllText(Directories.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); + File.AppendAllText(GlobalPaths.ConfigDir + "\\ports.txt", GlobalVars.UserConfiguration.RobloxPort + Environment.NewLine); } void Button22Click(object sender, EventArgs e) @@ -1347,12 +1347,12 @@ namespace NovetusLauncher { GlobalVars.UserConfiguration.Map = treeView1.SelectedNode.Text.ToString(); GlobalVars.UserConfiguration.MapPathSnip = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); - GlobalVars.UserConfiguration.MapPath = Directories.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; + GlobalVars.UserConfiguration.MapPath = GlobalPaths.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip; label28.Text = GlobalVars.UserConfiguration.Map; - if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); } else { @@ -1363,7 +1363,7 @@ namespace NovetusLauncher void Button6Click(object sender, EventArgs e) { - Process.Start("explorer.exe", Directories.MapsDir.Replace(@"\\",@"\")); + Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\",@"\")); } void CheckBox4CheckedChanged(object sender, EventArgs e) @@ -1380,14 +1380,14 @@ namespace NovetusLauncher { treeView1.Nodes.Clear(); _fieldsTreeCache.Nodes.Clear(); - string mapdir = Directories.MapsDir; + string mapdir = GlobalPaths.MapsDir; TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes); treeView1.Focus(); - if (File.Exists(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) + if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt")) { - textBox4.Text = File.ReadAllText(Directories.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"); + textBox4.Text = File.ReadAllText(GlobalPaths.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(Directories.AssetCacheDir)) + if (Directory.Exists(GlobalPaths.AssetCacheDir)) { - Directory.Delete(Directories.AssetCacheDir, true); + Directory.Delete(GlobalPaths.AssetCacheDir, true); ConsolePrint("Asset cache cleared!", 3); MessageBox.Show("Asset cache cleared!"); } @@ -1541,10 +1541,10 @@ namespace NovetusLauncher switch (comboBox1.SelectedIndex) { case 1: - GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.DirectX; + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.DirectX; break; default: - GlobalVars.UserConfiguration.GraphicsMode = GraphicsMode.OpenGL; + GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.Mode.OpenGL; break; } } @@ -1554,27 +1554,27 @@ namespace NovetusLauncher switch (comboBox2.SelectedIndex) { case 0: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.VeryLow; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.VeryLow; break; case 1: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Low; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Low; break; case 2: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Medium; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Medium; break; case 3: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.High; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.High; break; case 4: default: - GlobalVars.UserConfiguration.QualityLevel = QualityLevel.Ultra; + GlobalVars.UserConfiguration.QualityLevel = Settings.QualityOptions.Level.Ultra; break; } } private void button36_Click(object sender, EventArgs e) { - GlobalVars.UserConfiguration.LauncherLayout = LauncherLayout.Compact; + GlobalVars.UserConfiguration.LauncherLayout = Settings.UIOptions.Style.Compact; WriteConfigValues(); Application.Restart(); } diff --git a/Novetus/NovetusLauncher/Novetus.Launcher.csproj b/Novetus/NovetusLauncher/Novetus.Launcher.csproj index 6fec565..6a19e4a 100644 --- a/Novetus/NovetusLauncher/Novetus.Launcher.csproj +++ b/Novetus/NovetusLauncher/Novetus.Launcher.csproj @@ -134,7 +134,17 @@ CharacterCustomization.cs + + + + + + + + Component + + Form @@ -296,6 +306,7 @@ + diff --git a/Novetus/NovetusLauncher/Program.cs b/Novetus/NovetusLauncher/Program.cs index b0eba7c..e324bee 100644 --- a/Novetus/NovetusLauncher/Program.cs +++ b/Novetus/NovetusLauncher/Program.cs @@ -29,13 +29,13 @@ namespace NovetusLauncher { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - LauncherFuncs.ReadInfoFile(Directories.ConfigDir + "\\" + GlobalVars.InfoName); - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalVars.InfoName); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); if (args.Length == 0) { switch (GlobalVars.UserConfiguration.LauncherLayout) { - case LauncherLayout.Compact: + case Settings.UIOptions.Style.Compact: Application.Run(new MainForm_legacy()); break; default: diff --git a/Novetus/NovetusLauncher/SDK/AssetLocalizer.cs b/Novetus/NovetusLauncher/SDK/AssetLocalizer.cs index bad874b..b1cad05 100644 --- a/Novetus/NovetusLauncher/SDK/AssetLocalizer.cs +++ b/Novetus/NovetusLauncher/SDK/AssetLocalizer.cs @@ -70,9 +70,9 @@ namespace NovetusLauncher comboBox1.SelectedItem = "RBXL"; comboBox2.SelectedItem = "None"; - if (Directory.Exists(Directories.hatdirFonts)) + if (Directory.Exists(GlobalPaths.hatdirFonts)) { - DirectoryInfo dinfo = new DirectoryInfo(Directories.hatdirFonts); + DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.hatdirFonts); FileInfo[] Files = dinfo.GetFiles("*.mesh"); foreach (FileInfo file in Files) { @@ -85,29 +85,29 @@ namespace NovetusLauncher } } - if (!Directory.Exists(Directories.AssetCacheDirFonts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts)) { - Directory.CreateDirectory(Directories.AssetCacheDirFonts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirFonts); } - if (!Directory.Exists(Directories.AssetCacheDirSky)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSky)) { - Directory.CreateDirectory(Directories.AssetCacheDirSky); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSky); } - if (!Directory.Exists(Directories.AssetCacheDirSounds)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirSounds)) { - Directory.CreateDirectory(Directories.AssetCacheDirSounds); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds); } - if (!Directory.Exists(Directories.AssetCacheDirTexturesGUI)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI)) { - Directory.CreateDirectory(Directories.AssetCacheDirTexturesGUI); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI); } - if (!Directory.Exists(Directories.AssetCacheDirScripts)) + if (!Directory.Exists(GlobalPaths.AssetCacheDirScripts)) { - Directory.CreateDirectory(Directories.AssetCacheDirScripts); + Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts); } } diff --git a/Novetus/NovetusLauncher/SDK/ClientScriptDocumentation.cs b/Novetus/NovetusLauncher/SDK/ClientScriptDocumentation.cs index 97fdc68..aea91e9 100644 --- a/Novetus/NovetusLauncher/SDK/ClientScriptDocumentation.cs +++ b/Novetus/NovetusLauncher/SDK/ClientScriptDocumentation.cs @@ -31,7 +31,7 @@ namespace NovetusLauncher void ClientScriptDocumentationLoad(object sender, EventArgs e) { - richTextBox1.Text = File.ReadAllText(Directories.BasePath + "\\documentation.txt"); + richTextBox1.Text = File.ReadAllText(GlobalPaths.BasePath + "\\documentation.txt"); } } } diff --git a/Novetus/NovetusLauncher/SDK/ClientinfoCreator.cs b/Novetus/NovetusLauncher/SDK/ClientinfoCreator.cs index 1a9d003..24311a5 100644 --- a/Novetus/NovetusLauncher/SDK/ClientinfoCreator.cs +++ b/Novetus/NovetusLauncher/SDK/ClientinfoCreator.cs @@ -18,7 +18,7 @@ namespace NovetusLauncher /// public partial class ClientinfoEditor : Form { - private ClientInfo loadedClientInfo = new ClientInfo(); + private FileFormat.ClientInfo loadedClientInfo = new FileFormat.ClientInfo(); private string SelectedClientInfoPath = ""; private bool Locked = false; private bool IsVersion2 = false; diff --git a/Novetus/NovetusLauncher/SDK/NovetusSDK.cs b/Novetus/NovetusLauncher/SDK/NovetusSDK.cs index f90e331..f14e35c 100644 --- a/Novetus/NovetusLauncher/SDK/NovetusSDK.cs +++ b/Novetus/NovetusLauncher/SDK/NovetusSDK.cs @@ -41,7 +41,7 @@ namespace NovetusLauncher private void NovetusSDK_Close(object sender, CancelEventArgs e) { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) @@ -70,14 +70,14 @@ namespace NovetusLauncher break; case 6: Process proc = new Process(); - proc.StartInfo.FileName = Directories.ConfigDirData + "\\RSG.exe"; + proc.StartInfo.FileName = GlobalPaths.ConfigDirData + "\\RSG.exe"; proc.StartInfo.CreateNoWindow = false; proc.StartInfo.UseShellExecute = false; proc.Start(); break; case 7: Process proc2 = new Process(); - proc2.StartInfo.FileName = Directories.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; + proc2.StartInfo.FileName = GlobalPaths.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; proc2.StartInfo.CreateNoWindow = false; proc2.StartInfo.UseShellExecute = false; proc2.Start(); diff --git a/Novetus/NovetusLauncher/SDK/Obj2MeshV1GUI.cs b/Novetus/NovetusLauncher/SDK/Obj2MeshV1GUI.cs index c69cd0d..f8335f9 100644 --- a/Novetus/NovetusLauncher/SDK/Obj2MeshV1GUI.cs +++ b/Novetus/NovetusLauncher/SDK/Obj2MeshV1GUI.cs @@ -25,7 +25,7 @@ namespace NovetusLauncher { if (openFileDialog1.ShowDialog() == DialogResult.OK) { - ProcessOBJ(Directories.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName); + ProcessOBJ(GlobalPaths.ConfigDirData + "\\RBXMeshConverter.exe", openFileDialog1.FileName); } } diff --git a/Novetus/NovetusURI/Classes/URIReg.cs b/Novetus/NovetusURI/Classes/URIReg.cs new file mode 100644 index 0000000..7b72bf2 --- /dev/null +++ b/Novetus/NovetusURI/Classes/URIReg.cs @@ -0,0 +1,95 @@ +#region Usings +using Microsoft.Win32; +using System; +using System.Windows.Forms; +#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 \ No newline at end of file diff --git a/Novetus/NovetusURI/Novetus.URI.csproj b/Novetus/NovetusURI/Novetus.URI.csproj index 4dad0af..c673190 100644 --- a/Novetus/NovetusURI/Novetus.URI.csproj +++ b/Novetus/NovetusURI/Novetus.URI.csproj @@ -85,6 +85,7 @@ + Form diff --git a/Novetus/NovetusURI/Program.cs b/Novetus/NovetusURI/Program.cs index 5195fed..1b1b64b 100644 --- a/Novetus/NovetusURI/Program.cs +++ b/Novetus/NovetusURI/Program.cs @@ -21,7 +21,7 @@ namespace NovetusURI { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, false); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, false); if (args.Length == 0) { Application.Run(new Form1()); diff --git a/Novetus/NovetusURI/URI/LoaderForm.cs b/Novetus/NovetusURI/URI/LoaderForm.cs index dcff533..1ebb966 100644 --- a/Novetus/NovetusURI/URI/LoaderForm.cs +++ b/Novetus/NovetusURI/URI/LoaderForm.cs @@ -20,7 +20,7 @@ namespace NovetusURI /// public partial class LoaderForm : Form { - DiscordRpc.EventHandlers handlers; + IDiscordRPC.EventHandlers handlers; public LoaderForm() { @@ -54,7 +54,7 @@ namespace NovetusURI { } - public void RequestCallback(DiscordRpc.JoinRequest request) + public void RequestCallback(IDiscordRPC.JoinRequest request) { } @@ -69,14 +69,14 @@ namespace NovetusURI { if (GlobalVars.UserConfiguration.DiscordPresence) { - handlers = new DiscordRpc.EventHandlers(); + handlers = new IDiscordRPC.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; handlers.requestCallback += RequestCallback; - DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); + IDiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); LauncherFuncs.UpdateRichPresence(LauncherState.LoadingURI, "", true); } @@ -101,16 +101,16 @@ namespace NovetusURI } else { - luafile = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; + luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptGenName + ".lua"; } string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode == true) { - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; } else { - rbxexe = Directories.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; + rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; } string quote = "\""; string args = ""; @@ -118,17 +118,17 @@ namespace NovetusURI { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptFuncs.Generator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptType.Client); + ScriptFuncs.Generator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } else { - args = ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); + args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, "", "", "", luafile, rbxexe); } try { @@ -209,7 +209,7 @@ namespace NovetusURI void ReadClientValues(string ClientName) { - string clientpath = Directories.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; if (!File.Exists(clientpath)) { diff --git a/Novetus/NovetusURI/URI/QuickConfigure.cs b/Novetus/NovetusURI/URI/QuickConfigure.cs index 2ff7891..c324914 100644 --- a/Novetus/NovetusURI/URI/QuickConfigure.cs +++ b/Novetus/NovetusURI/URI/QuickConfigure.cs @@ -33,7 +33,7 @@ namespace NovetusURI void QuickConfigureLoad(object sender, EventArgs e) { - ReadConfigValues(Directories.ConfigDir + "\\" + GlobalVars.ConfigName); + ReadConfigValues(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName); } void Button3Click(object sender, EventArgs e) @@ -93,7 +93,7 @@ namespace NovetusURI void QuickConfigureClose(object sender, CancelEventArgs e) { - LauncherFuncs.Config(Directories.ConfigDir + "\\" + GlobalVars.ConfigName, true); + LauncherFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalVars.ConfigName, true); LocalVars.ReadyToLaunch = true; } }