From aad4582f8474219b4bc4dbab88ac57a93d63d646 Mon Sep 17 00:00:00 2001 From: Bitl Date: Sat, 4 Jul 2020 13:19:38 -0700 Subject: [PATCH] rewrite part 1 --- NovetusLauncher/NovetusCMD/Program.cs | 64 +- NovetusLauncher/NovetusFuncs/ClientScript.cs | 120 +- NovetusLauncher/NovetusFuncs/GlobalVars.cs | 4 +- NovetusLauncher/NovetusFuncs/LauncherFuncs.cs | 320 +++-- .../NovetusFuncs/ScriptGenerator.cs | 123 +- NovetusLauncher/NovetusFuncs/SecurityFuncs.cs | 45 +- NovetusLauncher/NovetusFuncs/SplashReader.cs | 69 +- .../CharacterCustomization.cs | 1095 ++++++++-------- .../CharacterCustomization_legacy.cs | 1117 ++++++++--------- .../NovetusLauncher/MainForm/MainForm.cs | 591 ++++----- .../MainForm/MainForm_legacy.cs | 504 ++++---- .../NovetusLauncher/NovetusSettings.cs | 125 +- .../NovetusLauncher/SDK/ItemMaker.cs | 55 +- .../SDK/NovetusSDK.Designer.cs | 2 +- .../NovetusLauncher/SDK/NovetusSDK.cs | 92 +- NovetusLauncher/NovetusURI/URI/LoaderForm.cs | 12 +- 16 files changed, 2129 insertions(+), 2209 deletions(-) diff --git a/NovetusLauncher/NovetusCMD/Program.cs b/NovetusLauncher/NovetusCMD/Program.cs index 2f7623b..c636be0 100644 --- a/NovetusLauncher/NovetusCMD/Program.cs +++ b/NovetusLauncher/NovetusCMD/Program.cs @@ -364,11 +364,11 @@ namespace NovetusCMD { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? "dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Server); + ScriptGenerator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -394,7 +394,7 @@ namespace NovetusCMD client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); LocalVars.ProcessID = client.Id; CreateTXT(); } @@ -452,35 +452,35 @@ namespace NovetusCMD ConsolePrint("Server Information sent to file " + GlobalVars.BasePath + "\\" + LocalVars.ServerInfoFileName, 4); } } - - static void ConsolePrint(string text, int type) - { - ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White); - if (type == 1) - { - ConsoleText(text, ConsoleColor.White); - } - else if (type == 2) - { - ConsoleText(text, ConsoleColor.Red); - } - else if (type == 3) - { - ConsoleText(text, ConsoleColor.Green); - } - else if (type == 4) - { - ConsoleText(text, ConsoleColor.Cyan); - } - else if (type == 5) - { - ConsoleText(text, ConsoleColor.Yellow); - } - - ConsoleText(Environment.NewLine, ConsoleColor.White); - } - - static void ConsoleText(string text, ConsoleColor color) + + static void ConsolePrint(string text, int type) + { + ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White); + + switch (type) + { + case 2: + ConsoleText(text, ConsoleColor.Red); + break; + case 3: + ConsoleText(text, ConsoleColor.Green); + break; + case 4: + ConsoleText(text, ConsoleColor.Cyan); + break; + case 5: + ConsoleText(text, ConsoleColor.Yellow); + break; + case 1: + default: + ConsoleText(text, ConsoleColor.White); + break; + } + + ConsoleText(Environment.NewLine, ConsoleColor.White); + } + + static void ConsoleText(string text, ConsoleColor color) { Console.ForegroundColor = color; Console.Write(text); diff --git a/NovetusLauncher/NovetusFuncs/ClientScript.cs b/NovetusLauncher/NovetusFuncs/ClientScript.cs index c88cf80..5aa1da4 100644 --- a/NovetusLauncher/NovetusFuncs/ClientScript.cs +++ b/NovetusLauncher/NovetusFuncs/ClientScript.cs @@ -19,9 +19,7 @@ public class ClientScript { int pFrom = code.IndexOf(tag) + tag.Length; int pTo = code.LastIndexOf(endtag); - string result = code.Substring(pFrom, pTo - pFrom); - return result; } catch (Exception) when (!Env.Debugging) @@ -30,74 +28,80 @@ public class ClientScript } } - public static ScriptGenerator.ScriptType GetTypeFromTag(string tag, string endtag) + public static ScriptType GetTypeFromTag(string tag) { - if (tag.Contains("client") && endtag.Contains("client")) { - return ScriptGenerator.ScriptType.Client; - } else if (tag.Contains("server") && endtag.Contains("server") || tag.Contains("no3d") && endtag.Contains("no3d")) { - return ScriptGenerator.ScriptType.Server; - } else if (tag.Contains("solo") && endtag.Contains("solo")) { - return ScriptGenerator.ScriptType.Solo; - } else if (tag.Contains("studio") && endtag.Contains("studio")) { - return ScriptGenerator.ScriptType.Studio; - } else { - return ScriptGenerator.ScriptType.None; + 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(ScriptGenerator.ScriptType type, string md5s, string luafile) + public static string GetRawArgsForType(ScriptType type, string md5s, string luafile) { - if (type == ScriptGenerator.ScriptType.Client) { - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == true) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == true) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == false) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == false) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } - } else if (type == ScriptGenerator.ScriptType.Server) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSServer(" + GlobalVars.RobloxPort + "," + GlobalVars.PlayerLimit + "," + md5s + "); " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : ""); - } else if (type == ScriptGenerator.ScriptType.Solo) { - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == true) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == true) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'Player'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == false) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(0,'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == false) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(0,'Player'," + GlobalVars.sololoadtext + ")"; - } else { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); _G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } - } else if (type == ScriptGenerator.ScriptType.Studio) { - return LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "');"; - } else { - return ""; + switch (type) + { + case ScriptType.Client: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "'); _G.CSConnect(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" + + GlobalVars.IP + "'," + + GlobalVars.RobloxPort + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + GlobalVars.loadtext + "," + + md5s + ",'" + + GlobalVars.PlayerTripcode + "')"; + case ScriptType.Server: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "'); _G.CSServer(" + + GlobalVars.RobloxPort + "," + + GlobalVars.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.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + GlobalVars.sololoadtext + ")"; + case ScriptType.Studio: + return LauncherFuncs.ChangeGameSettings() + + " dofile('" + luafile + "');"; + default: + return ""; } } - public static string GetRawArgsFromTag(string tag, string endtag, string md5s, string luafile) + public static string GetRawArgsFromTag(string tag, string md5s, string luafile) { - return GetRawArgsForType(GetTypeFromTag(tag, endtag), md5s, luafile); + return GetRawArgsForType(GetTypeFromTag(tag), md5s, luafile); } public static int ConvertIconStringToInt() { - if (GlobalVars.Custom_Icon_Offline == "BC") { - return 1; - } else if (GlobalVars.Custom_Icon_Offline == "TBC") { - return 2; - } else if (GlobalVars.Custom_Icon_Offline == "OBC") { - return 3; - } else if (GlobalVars.Custom_Icon_Offline == "NBC") { - return 0; + switch (GlobalVars.Custom_Icon_Offline) + { + case "BC:": + return 1; + case "TBC:": + return 2; + case "OBC:": + return 3; + case "NBC:": + default: + return 0; } - - return 0; } public static string GetFolderAndMapName(string source, string seperator) @@ -123,7 +127,7 @@ public class ClientScript public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe) { if (GlobalVars.SelectedClientInfo.Fix2007) { - ScriptGenerator.GenerateScriptForClient(GetTypeFromTag(tag, endtag)); + ScriptGenerator.GenerateScriptForClient(GetTypeFromTag(tag)); } string extractedCode = GetArgsFromTag(code, tag, endtag); @@ -177,7 +181,7 @@ public class ClientScript .Replace("%extra%", GlobalVars.Custom_Extra) .Replace("%extrad%", GlobalVars.extraGameDir + GlobalVars.Custom_Extra) .Replace("%hat4d%", GlobalVars.hatGameDir + GlobalVars.Custom_Extra) - .Replace("%args%", GetRawArgsFromTag(tag, endtag, md5s, luafile)) + .Replace("%args%", GetRawArgsFromTag(tag, md5s, luafile)) .Replace("%facews%", GlobalVars.WebServer_FaceDir + GlobalVars.Custom_Face_Offline) .Replace("%headws%", GlobalVars.WebServer_HeadDir + GlobalVars.Custom_Head_Offline) .Replace("%tshirtws%", GlobalVars.Custom_T_Shirt_Offline.Contains("http://") ? GlobalVars.Custom_T_Shirt_Offline : GlobalVars.WebServer_TShirtDir + GlobalVars.Custom_T_Shirt_Offline) diff --git a/NovetusLauncher/NovetusFuncs/GlobalVars.cs b/NovetusLauncher/NovetusFuncs/GlobalVars.cs index 1825ffb..8ca88ba 100644 --- a/NovetusLauncher/NovetusFuncs/GlobalVars.cs +++ b/NovetusLauncher/NovetusFuncs/GlobalVars.cs @@ -236,8 +236,8 @@ public static class GlobalVars public static bool ReShadeFPSDisplay = false; public static bool ReShadePerformanceMode = false; //video - public static int GraphicsMode = 1; - public static int QualityLevel = 5; + public static GraphicsMode GraphicsMode = GraphicsMode.OpenGL; + public static QualityLevel QualityLevel = QualityLevel.Ultra; public static string MultiLine(params string[] args) { diff --git a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs index 4b00c67..ee3c230 100644 --- a/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/LauncherFuncs.cs @@ -7,27 +7,41 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; -using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Reflection; -using System.Threading; + +public enum LauncherState +{ + InLauncher = 0, + InMPGame = 1, + InSoloGame = 2, + InStudio = 3, + InCustomization = 4, + InEasterEggGame = 5, + LoadingURI = 6 +} + +public enum QualityLevel +{ + VeryLow = 1, + Low = 2, + Medium = 3, + High = 4, + Ultra = 5 +} + +public enum GraphicsMode +{ + None = 0, + OpenGL = 1, + DirectX = 2 +} public class LauncherFuncs { - public enum LauncherState - { - InLauncher = 0, - InMPGame = 1, - InSoloGame = 2, - InStudio = 3, - InCustomization = 4, - InEasterEggGame = 5, - LoadingURI = 6 - } - public LauncherFuncs() { } @@ -84,6 +98,68 @@ public class LauncherFuncs } } + 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 void Config(string cfgpath, bool write) { if (write) @@ -107,9 +183,9 @@ public class LauncherFuncs ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString()); ini.IniWriteValue(section, "MapPath", GlobalVars.MapPath.ToString()); ini.IniWriteValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString()); - ini.IniWriteValue(section, "GraphicsMode", GlobalVars.GraphicsMode.ToString()); + ini.IniWriteValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.GraphicsMode).ToString()); ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString()); - ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString()); + ini.IniWriteValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.QualityLevel).ToString()); ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString()); } else @@ -138,9 +214,9 @@ public class LauncherFuncs Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString()); Decryptline14 = ini.IniReadValue(section, "MapPath", GlobalVars.MapPath.ToString()); Decryptline15 = ini.IniReadValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString()); - Decryptline16 = ini.IniReadValue(section, "GraphicsMode", GlobalVars.GraphicsMode.ToString()); + Decryptline16 = ini.IniReadValue(section, "GraphicsMode", GetIntForGraphicsMode(GlobalVars.GraphicsMode).ToString()); Decryptline17 = ini.IniReadValue(section, "ReShade", GlobalVars.ReShade.ToString()); - Decryptline20 = ini.IniReadValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString()); + Decryptline20 = ini.IniReadValue(section, "QualityLevel", GetIntForQualityLevel(GlobalVars.QualityLevel).ToString()); Decryptline21 = ini.IniReadValue(section, "OldLayout", GlobalVars.OldLayout.ToString()); try @@ -197,15 +273,13 @@ public class LauncherFuncs GlobalVars.MapPath = Decryptline14; GlobalVars.MapPathSnip = Decryptline15; int iline16 = Convert.ToInt32(Decryptline16); - GlobalVars.GraphicsMode = iline16; + GlobalVars.GraphicsMode = GetGraphicsModeForInt(iline16); bool bline17 = Convert.ToBoolean(Decryptline17); GlobalVars.ReShade = bline17; int iline20 = Convert.ToInt32(Decryptline20); - GlobalVars.QualityLevel = iline20; + GlobalVars.QualityLevel = GetQualityLevelForInt(iline20); bool bline21 = Convert.ToBoolean(Decryptline21); GlobalVars.OldLayout = bline21; - //bool bline22 = Convert.ToBoolean(Decryptline22); - //GlobalVars.UDP = bline22; } catch (Exception) { @@ -394,27 +468,29 @@ public class LauncherFuncs int PerformanceMode = GlobalVars.ReShadePerformanceMode ? 1 : 0; Decryptline4 = ini.IniReadValue(section, "PerformanceMode", PerformanceMode.ToString()); - if (setglobals) { try { - if (Convert.ToInt32(Decryptline2) == 1 && Convert.ToInt32(Decryptline3) == 1) + switch(Convert.ToInt32(Decryptline2)) { - GlobalVars.ReShadeFPSDisplay = true; - } - else if (Convert.ToInt32(Decryptline2) == 0 && Convert.ToInt32(Decryptline3) == 0) - { - GlobalVars.ReShadeFPSDisplay = false; + case int showFPSLine when showFPSLine == 1 && Convert.ToInt32(Decryptline3) == 1: + GlobalVars.ReShadeFPSDisplay = true; + break; + case int showFPSLine when showFPSLine == 0 && Convert.ToInt32(Decryptline3) == 0: + default: + GlobalVars.ReShadeFPSDisplay = false; + break; } - if (Convert.ToInt32(Decryptline4) == 1) + switch (Convert.ToInt32(Decryptline4)) { - GlobalVars.ReShadePerformanceMode = true; - } - else if (Convert.ToInt32(Decryptline4) == 0) - { - GlobalVars.ReShadePerformanceMode = false; + case 1: + GlobalVars.ReShadePerformanceMode = true; + break; + default: + GlobalVars.ReShadePerformanceMode = false; + break; } } catch (Exception) @@ -492,9 +568,9 @@ public class LauncherFuncs GlobalVars.DiscordPresence = true; GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap; GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap; - GlobalVars.GraphicsMode = 1; + GlobalVars.GraphicsMode = GraphicsMode.OpenGL; GlobalVars.ReShade = false; - GlobalVars.QualityLevel = 5; + GlobalVars.QualityLevel = QualityLevel.Ultra; GlobalVars.OldLayout = false; ResetCustomizationValues(); } @@ -633,24 +709,49 @@ public class LauncherFuncs { CryptoRandom random = new CryptoRandom(); int randomID = 0; - int randIDmode = random.Next(0, 7); - if (randIDmode == 0) { - randomID = random.Next(0, 99); - } else if (randIDmode == 1) { - randomID = random.Next(0, 999); - } else if (randIDmode == 2) { - randomID = random.Next(0, 9999); - } else if (randIDmode == 3) { - randomID = random.Next(0, 99999); - } else if (randIDmode == 4) { - randomID = random.Next(0, 999999); - } else if (randIDmode == 5) { - randomID = random.Next(0, 9999999); - } else if (randIDmode == 6) { - randomID = random.Next(0, 99999999); - } else if (randIDmode == 7) { - randomID = random.Next(); - } + int randIDmode = random.Next(0, 8); + int idlimit = 0; + + switch (randIDmode) + { + case 0: + idlimit = 9; + break; + case 1: + idlimit = 99; + break; + case 2: + idlimit = 999; + break; + case 3: + idlimit = 9999; + break; + case 4: + idlimit = 99999; + break; + case 5: + idlimit = 999999; + break; + case 6: + idlimit = 9999999; + break; + case 7: + idlimit = 99999999; + break; + case 8: + default: + break; + } + + if (idlimit > 0) + { + randomID = random.Next(0, idlimit); + } + else + { + randomID = random.Next(); + } + //2147483647 is max id. GlobalVars.UserID = randomID; } @@ -762,67 +863,70 @@ public class LauncherFuncs if (!GlobalVars.SelectedClientInfo.NoGraphicsOptions) { - if (GlobalVars.GraphicsMode == 1) + switch (GlobalVars.GraphicsMode) { - result += "xpcall( function() settings().Rendering.graphicsMode = 2 end, function( err ) settings().Rendering.graphicsMode = 4 end );"; - } - else if (GlobalVars.GraphicsMode == 2) - { - result += "pcall(function() settings().Rendering.graphicsMode = 3 end);"; + case GraphicsMode.OpenGL: + result += "xpcall( function() settings().Rendering.graphicsMode = 2 end, function( err ) settings().Rendering.graphicsMode = 4 end );"; + break; + case GraphicsMode.DirectX: + result += "pcall(function() settings().Rendering.graphicsMode = 3 end);"; + break; + default: + break; } } //default values are ultra settings int MeshDetail = 100; int ShadingQuality = 100; - int QualityLevel = 19; + int GFXQualityLevel = 19; int MaterialQuality = 3; int AASamples = 8; int Bevels = 1; int Shadows_2008 = 1; bool Shadows_2007 = true; - if (GlobalVars.QualityLevel == 1) //very low + switch (GlobalVars.QualityLevel) { - MeshDetail = 50; - ShadingQuality = 50; - QualityLevel = 1; - MaterialQuality = 1; - AASamples = 1; - Bevels = 2; - Shadows_2008 = 2; - Shadows_2007 = false; + case QualityLevel.VeryLow: + MeshDetail = 50; + ShadingQuality = 50; + GFXQualityLevel = 1; + MaterialQuality = 1; + AASamples = 1; + Bevels = 2; + Shadows_2008 = 2; + Shadows_2007 = false; + break; + case QualityLevel.Low: + MeshDetail = 50; + ShadingQuality = 50; + GFXQualityLevel = 5; + MaterialQuality = 1; + AASamples = 1; + Bevels = 2; + Shadows_2008 = 2; + Shadows_2007 = false; + break; + case QualityLevel.Medium: + MeshDetail = 50; + ShadingQuality = 50; + GFXQualityLevel = 10; + MaterialQuality = 2; + AASamples = 4; + Bevels = 2; + Shadows_2007 = false; + break; + case QualityLevel.High: + MeshDetail = 75; + ShadingQuality = 75; + GFXQualityLevel = 15; + AASamples = 4; + break; + case QualityLevel.Ultra: + default: + break; } - else if (GlobalVars.QualityLevel == 2) //low - { - MeshDetail = 50; - ShadingQuality = 50; - QualityLevel = 5; - MaterialQuality = 1; - AASamples = 1; - Bevels = 2; - Shadows_2008 = 2; - Shadows_2007 = false; - } - else if (GlobalVars.QualityLevel == 3) //medium - { - MeshDetail = 50; - ShadingQuality = 50; - QualityLevel = 10; - MaterialQuality = 2; - AASamples = 4; - Bevels = 2; - Shadows_2007 = false; - } - else if (GlobalVars.QualityLevel == 4) //high - { - MeshDetail = 75; - ShadingQuality = 75; - QualityLevel = 15; - AASamples = 4; - } - - //1 = very low, 2 = low, 3 = medium, 4 = high, 5 = ultra. result += " pcall(function() settings().Rendering.maxMeshDetail = " + MeshDetail.ToString() + " end);" + " pcall(function() settings().Rendering.maxShadingQuality = " + ShadingQuality.ToString() + " end);" @@ -843,7 +947,7 @@ public class LauncherFuncs + " pcall(function() settings().Rendering.Bevels = " + Bevels.ToString() + " end);" + " pcall(function() settings().Rendering.Shadow = " + Shadows_2008.ToString() + " end);" + " pcall(function() settings().Rendering.Shadows = " + Shadows_2007.ToString().ToLower() + " end);" - + " pcall(function() settings().Rendering.QualityLevel = " + QualityLevel.ToString() + " end);"; + + " pcall(function() settings().Rendering.QualityLevel = " + GFXQualityLevel.ToString() + " end);"; return result; } @@ -864,7 +968,7 @@ public class LauncherFuncs return luafile; } - public static string GetClientEXEDir(ScriptGenerator.ScriptType type) + public static string GetClientEXEDir(ScriptType type) { string rbxexe = ""; if (GlobalVars.SelectedClientInfo.LegacyMode) @@ -875,20 +979,20 @@ public class LauncherFuncs { switch (type) { - case ScriptGenerator.ScriptType.Client: + case ScriptType.Client: rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_client.exe"; break; - case ScriptGenerator.ScriptType.Server: + case ScriptType.Server: rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_server.exe"; break; - case ScriptGenerator.ScriptType.Studio: + case ScriptType.Studio: rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_studio.exe"; break; - case ScriptGenerator.ScriptType.Solo: - case ScriptGenerator.ScriptType.EasterEgg: + case ScriptType.Solo: + case ScriptType.EasterEgg: rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_solo.exe"; break; - case ScriptGenerator.ScriptType.None: + case ScriptType.None: default: rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; break; diff --git a/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs b/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs index f67f491..094da9f 100644 --- a/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs +++ b/NovetusLauncher/NovetusFuncs/ScriptGenerator.cs @@ -13,35 +13,27 @@ using System.IO; using System.Reflection; using System.Text.RegularExpressions; -/* - * so, in order for us to generate a good script, we have to: - * - specify the script header that gives us our setting adjustments - * - add player customization into the script - * - call the main script - * - call the function - * - * now, we have to call the funtion associated for the action, such as starting the main client or something - * we also need to make sure that when we add the option, we'll need to adapt map loading to work RBX2007 style for the clients using the script generator. - */ - +public enum ScriptType +{ + Client = 0, + Server = 1, + Solo = 2, + Studio = 3, + EasterEgg = 4, + None = 5 +} + public class ScriptGenerator { - public enum ScriptType - { - Client = 0, - Server = 1, - Solo = 2, - Studio = 3, - EasterEgg = 4, - None = 5 - } - public static string GetScriptFuncForType(ScriptType type) { string rbxexe = ""; - if (GlobalVars.SelectedClientInfo.LegacyMode == true) { + if (GlobalVars.SelectedClientInfo.LegacyMode == true) + { rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp.exe"; - } else { + } + else + { rbxexe = GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\RobloxApp_client.exe"; } @@ -49,60 +41,59 @@ public class ScriptGenerator string md5script = SecurityFuncs.CalculateMD5(GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua"); string md5exe = SecurityFuncs.CalculateMD5(rbxexe); string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; - if (type == ScriptType.Client) { - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == true) { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == true) { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == false) { - return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == false) { - return "_G.CSConnect(0,'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'Player'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } else { - return "_G.CSConnect(" + GlobalVars.UserID + ",'" + GlobalVars.IP + "'," + GlobalVars.RobloxPort + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.loadtext + "," + md5s + ",'" + GlobalVars.PlayerTripcode + "')"; - } - } else if (type == ScriptType.Server) { - return "_G.CSServer(" + GlobalVars.RobloxPort + "," + GlobalVars.PlayerLimit + "," + md5s + ")"; - } else if (type == ScriptType.Solo || type == ScriptType.EasterEgg) { - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == true) { - return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == true) { - return "_G.CSSolo(" + GlobalVars.UserID + ",'Player'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == true && GlobalVars.SelectedClientInfo.UsesID == false) { - return "_G.CSSolo(0,'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false && GlobalVars.SelectedClientInfo.UsesID == false) { - return "_G.CSSolo(0,'Player'," + GlobalVars.sololoadtext + ")"; - } else { - return "_G.CSSolo(" + GlobalVars.UserID + ",'" + GlobalVars.PlayerName + "'," + GlobalVars.sololoadtext + ")"; - } - } else if (type == ScriptType.Studio) { - return "_G.CSStudio()"; - } else { - return ""; + + switch (type) + { + case ScriptType.Client: + return "_G.CSConnect(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" + + GlobalVars.IP + "'," + + GlobalVars.RobloxPort + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + GlobalVars.loadtext + "," + + md5s + ",'" + + GlobalVars.PlayerTripcode + "')"; + case ScriptType.Server: + return "_G.CSServer(" + + GlobalVars.RobloxPort + "," + + GlobalVars.PlayerLimit + "," + + md5s + ")"; + case ScriptType.Solo: + case ScriptType.EasterEgg: + return "_G.CSSolo(" + + (GlobalVars.SelectedClientInfo.UsesID == true ? GlobalVars.UserID : 0) + ",'" + + (GlobalVars.SelectedClientInfo.UsesPlayerName == true ? GlobalVars.PlayerName : "Player") + "'," + + GlobalVars.sololoadtext + ")"; + case ScriptType.Studio: + return "_G.CSStudio()"; + default: + return ""; } } public static string GetNameForType(ScriptType type) { - if (type == ScriptType.Client) { - return "Client"; - } else if (type == ScriptType.Server) { - return "Server"; - } else if (type == ScriptType.Solo) { - return "Play Solo"; - } else if (type == ScriptType.Studio) { - return "Studio"; - } else if (type == ScriptType.EasterEgg) { - return "A message from Bitl"; - } else { - return ""; + 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, + //scriptcontents, LauncherFuncs.ChangeGameSettings(), "dofile('rbxasset://scripts/" + GlobalVars.ScriptName + ".lua')", GetScriptFuncForType(type), diff --git a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs b/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs index faadc92..82993e9 100644 --- a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs @@ -168,7 +168,7 @@ public class SecurityFuncs return new String(' ', random.Next(20)); } - public static void RenameWindow(Process exe, ScriptGenerator.ScriptType type, string mapname) + public static void RenameWindow(Process exe, ScriptType type, string mapname) { if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) { int time = 500; @@ -178,7 +178,7 @@ public class SecurityFuncs } } - private static void WorkerDoWork(Process exe, ScriptGenerator.ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname) + private static void WorkerDoWork(Process exe, ScriptType type, int time, BackgroundWorker worker, string clientname, string mapname) { if (exe.IsRunning() == true) { while (exe.IsRunning() == true) { @@ -188,14 +188,41 @@ public class SecurityFuncs worker.Dispose(); break; } - - if (type == ScriptGenerator.ScriptType.Client) { - SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) + " [" + GlobalVars.IP + ":" + GlobalVars.RobloxPort + "]" + RandomStringTitle()); - } else if (type == ScriptGenerator.ScriptType.Server || type == ScriptGenerator.ScriptType.Solo || type == ScriptGenerator.ScriptType.Studio) { - SetWindowText(exe.MainWindowHandle, "Novetus " + GlobalVars.Version + " - " + clientname + " " + ScriptGenerator.GetNameForType(type) + (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]") + RandomStringTitle()); - }else if (type == ScriptGenerator.ScriptType.EasterEgg) { - SetWindowText(exe.MainWindowHandle, ScriptGenerator.GetNameForType(type) + RandomStringTitle()); + + switch (type) + { + case ScriptType.Client: + SetWindowText(exe.MainWindowHandle, "Novetus " + + GlobalVars.Version + " - " + + clientname + " " + + ScriptGenerator.GetNameForType(type) + + " [" + GlobalVars.IP + ":" + GlobalVars.RobloxPort + "]" + + RandomStringTitle()); + break; + case ScriptType.Server: + case ScriptType.Solo: + SetWindowText(exe.MainWindowHandle, "Novetus " + + GlobalVars.Version + " - " + + clientname + " " + + ScriptGenerator.GetNameForType(type) + + (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]") + + RandomStringTitle()); + break; + case ScriptType.Studio: + SetWindowText(exe.MainWindowHandle, "Novetus Studio " + + GlobalVars.Version + " - " + + clientname + " " + + ScriptGenerator.GetNameForType(type) + + (string.IsNullOrWhiteSpace(mapname) ? " [Place1]" : " [" + mapname + "]") + + RandomStringTitle()); + break; + case ScriptType.EasterEgg: + default: + SetWindowText(exe.MainWindowHandle, ScriptGenerator.GetNameForType(type) + + RandomStringTitle()); + break; } + Thread.Sleep(time); } } else { diff --git a/NovetusLauncher/NovetusFuncs/SplashReader.cs b/NovetusLauncher/NovetusFuncs/SplashReader.cs index 916e44e..23e950b 100644 --- a/NovetusLauncher/NovetusFuncs/SplashReader.cs +++ b/NovetusLauncher/NovetusFuncs/SplashReader.cs @@ -38,37 +38,54 @@ public static class SplashReader return formattedsplash; } - private static bool IsTheSameDay(DateTime date1, DateTime date2) - { - return (date1.Month == date2.Month && date1.Day == date2.Day); - } - public static string GetSplash() { DateTime today = DateTime.Now; string splash = ""; - if (IsTheSameDay(today, new DateTime(today.Year, 12, 24)) || IsTheSameDay(today, new DateTime(today.Year, 12, 25))) { - splash = "Merry Christmas!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 12, 31)) || IsTheSameDay(today, new DateTime(today.Year, 1, 1))) { - splash = "Happy New Year!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 10, 31))) { - splash = "Happy Halloween!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 6, 10))) { - splash = "Happy Birthday, Bitl!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 8, 27))) { - splash = "Happy Birthday, ROBLOX!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 10, 27))) { - splash = "Happy Birthday, Novetus!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 10, 9))) { - splash = "Happy Leif Erikson Day! HINGA DINGA DURGEN!"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 4, 20))) { - splash = "4/20 lol"; - } else if (IsTheSameDay(today, new DateTime(today.Year, 2, 11))) { - splash = "RIP Erik Cassel"; - } else { - splash = RandomSplash(); - } + 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; } diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs index c54eb26..d11e554 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization.cs @@ -142,215 +142,110 @@ namespace NovetusLauncher //clothing if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://")) { - if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_T_Shirt_Offline) { - textBox12.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox3.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox12.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox3.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox12.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox3.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox12.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox3.SelectedItem = "Roblox"; + break; } } if (GlobalVars.Custom_Shirt_Offline.Contains("http://")) { - if (GlobalVars.Custom_Shirt_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_Shirt_Offline) { - textBox11.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox2.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_Shirt_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox11.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox2.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox11.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox2.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox11.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox2.SelectedItem = "Roblox"; + break; } } if (GlobalVars.Custom_Pants_Offline.Contains("http://")) { - if (GlobalVars.Custom_Pants_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_Pants_Offline) { - textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox1.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_Pants_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox1.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox1.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox1.SelectedItem = "Roblox"; + break; } } //discord - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InCustomization, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.Map); LauncherFuncs.ReloadLoadtextValue(); } void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { - if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage1"])//your specific tabname + switch (tabControl1.SelectedTab) { - panel3.Location = new Point(110, 359); - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage7"]) - { - panel3.Location = new Point(110, 359); - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); + case TabPage pg1 when pg1 == tabControl1.TabPages["tabPage1"]: + panel3.Location = new Point(110, 359); + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + break; + case TabPage pg7 when pg7 == tabControl1.TabPages["tabPage7"]: + panel3.Location = new Point(110, 359); + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - try - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); - pictureBox10.Image = icon1; - } - catch (Exception) when (!Env.Debugging) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); - pictureBox10.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])//your specific tabname - { - //hats - panel3.Location = new Point(110, 239); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox1.Items.Add(file.Name); - listBox2.Items.Add(file.Name); - listBox3.Items.Add(file.Name); - } - listBox1.SelectedItem = GlobalVars.Custom_Hat1ID_Offline; - listBox2.SelectedItem = GlobalVars.Custom_Hat2ID_Offline; - listBox3.SelectedItem = GlobalVars.Custom_Hat3ID_Offline; - listBox1.Enabled = true; - listBox2.Enabled = true; - listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + try { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + pictureBox10.Image = icon1; } - else + catch (Exception) when (!Env.Debugging) { - textBox2.Text = GlobalVars.Custom_Hat1ID_Offline; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + pictureBox10.Image = icon1; } + break; + case TabPage pg2 when pg2 == tabControl1.TabPages["tabPage2"]: + //hats + panel3.Location = new Point(110, 239); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (Directory.Exists(GlobalVars.hatdir)) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox3.Text = GlobalVars.Custom_Hat2ID_Offline; - } - - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt")) - { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox4.Text = GlobalVars.Custom_Hat3ID_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage3"])//your specific tabname - { - //faces - panel3.Location = new Point(110, 359); - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.facedir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox4.Items.Add(file.Name); - } - listBox4.SelectedItem = GlobalVars.Custom_Face_Offline; - listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + ".png"); - pictureBox4.Image = icon1; - - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt")) - { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox6.Text = GlobalVars.Custom_Face_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage4"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.tshirtdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -359,94 +254,246 @@ namespace NovetusLauncher continue; } - listBox5.Items.Add(file.Name); + listBox1.Items.Add(file.Name); + listBox2.Items.Add(file.Name); + listBox3.Items.Add(file.Name); } - listBox5.SelectedItem = GlobalVars.Custom_T_Shirt_Offline; - listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + ".png"); + listBox1.SelectedItem = GlobalVars.Custom_Hat1ID_Offline; + listBox2.SelectedItem = GlobalVars.Custom_Hat2ID_Offline; + listBox3.SelectedItem = GlobalVars.Custom_Hat3ID_Offline; + listBox1.Enabled = true; + listBox2.Enabled = true; + listBox3.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox1.Image = icon1; + Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox2.Image = icon2; + Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox3.Image = icon3; + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox2.Text = GlobalVars.Custom_Hat1ID_Offline; + } + + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox3.Text = GlobalVars.Custom_Hat2ID_Offline; + } + + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox4.Text = GlobalVars.Custom_Hat3ID_Offline; + } + } + break; + case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: + //faces + panel3.Location = new Point(110, 359); + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.facedir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox4.Items.Add(file.Name); + } + listBox4.SelectedItem = GlobalVars.Custom_Face_Offline; + listBox4.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + ".png"); + pictureBox4.Image = icon1; + + if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox6.Text = GlobalVars.Custom_Face_Offline; + } + } + break; + case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + + try + { + if (Directory.Exists(GlobalVars.tshirtdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox5.Items.Add(file.Name); + } + listBox5.SelectedItem = GlobalVars.Custom_T_Shirt_Offline; + listBox5.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + ".png"); + pictureBox5.Image = icon1; + + if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox7.Text = GlobalVars.Custom_T_Shirt_Offline; + } + } + } + catch (Exception) + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; + } + break; + case TabPage pg5 when pg5 == tabControl1.TabPages["tabPage5"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + try + { + if (Directory.Exists(GlobalVars.shirtdir)) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox7.Text = GlobalVars.Custom_T_Shirt_Offline; + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox6.Items.Add(file.Name); + } + listBox6.SelectedItem = GlobalVars.Custom_Shirt_Offline; + listBox6.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + ".png"); + pictureBox6.Image = icon1; + + if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox8.Text = GlobalVars.Custom_Shirt_Offline; + } } } - } - catch (Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); - pictureBox5.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage5"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.shirtdir)) + catch (Exception) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach (FileInfo file in Files) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox6.Items.Add(file.Name); - } - listBox6.SelectedItem = GlobalVars.Custom_Shirt_Offline; - listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; + } + break; + case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + try + { + if (Directory.Exists(GlobalVars.pantsdir)) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox8.Text = GlobalVars.Custom_Shirt_Offline; + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox7.Items.Add(file.Name); + } + listBox7.SelectedItem = GlobalVars.Custom_Pants_Offline; + listBox7.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + ".png"); + pictureBox7.Image = icon1; + + if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox9.Text = GlobalVars.Custom_Pants_Offline; + } } } - } - catch (Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); - pictureBox6.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage6"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.pantsdir)) + catch (Exception) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); + pictureBox7.Image = icon1; + } + break; + case TabPage pg8 when pg8 == tabControl1.TabPages["tabPage8"]: + //faces + panel3.Location = new Point(110, 359); + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.headdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -455,158 +502,122 @@ namespace NovetusLauncher continue; } - listBox7.Items.Add(file.Name); + listBox8.Items.Add(file.Name); } - listBox7.SelectedItem = GlobalVars.Custom_Pants_Offline; - listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + ".png"); - pictureBox7.Image = icon1; + listBox8.SelectedItem = GlobalVars.Custom_Head_Offline; + listBox8.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + ".png"); + pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt"); } else { - textBox9.Text = GlobalVars.Custom_Pants_Offline; + textBox5.Text = GlobalVars.Custom_Head_Offline; } } - } - catch (Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); - pictureBox7.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage8"])//your specific tabname - { - //faces - panel3.Location = new Point(110, 359); - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.headdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox8.Items.Add(file.Name); - } - listBox8.SelectedItem = GlobalVars.Custom_Head_Offline; - listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + ".png"); - pictureBox8.Image = icon1; + break; + case TabPage pg9 when pg9 == tabControl1.TabPages["tabPage9"]: + //faces + panel3.Location = new Point(110, 359); + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (Directory.Exists(GlobalVars.extradir)) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox5.Text = GlobalVars.Custom_Head_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage9"])//your specific tabname - { - //faces - panel3.Location = new Point(110, 359); - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - - if (Directory.Exists(GlobalVars.extradir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - - if (GlobalVars.Custom_Extra_ShowHats == true) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - if (file.Name.Equals("NoHat.rbxm")) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - } - - listBox9.SelectedItem = GlobalVars.Custom_Extra; - listBox9.Enabled = true; - try - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) - { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox10.Text = GlobalVars.Custom_Extra; - } - } - catch(Exception) when (!Env.Debugging) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + + if (GlobalVars.Custom_Extra_ShowHats == true) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + if (file.Name.Equals("NoHat.rbxm")) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + } + + listBox9.SelectedItem = GlobalVars.Custom_Extra; + listBox9.Enabled = true; + try + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.Custom_Extra; } } - } - } + catch (Exception) when (!Env.Debugging) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox10.Text = GlobalVars.Custom_Extra; + } + } + } + break; + default: + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + break; + } } void CharacterCustomizationClose(object sender, CancelEventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); LauncherFuncs.ReloadLoadtextValue(); } @@ -1151,92 +1162,56 @@ namespace NovetusLauncher return Color.FromArgb(A,R,G,B); } - - void ChangeColorOfPart(int ColorID, Color ButtonColor) - { - if (SelectedPart == "Head") - { - GlobalVars.HeadColorID = ColorID; - GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); - button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); - } - else if (SelectedPart == "Torso") - { - GlobalVars.TorsoColorID = ColorID; - GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); - button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); - } - else if (SelectedPart == "Right Arm") - { - GlobalVars.RightArmColorID = ColorID; - GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); - button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); - } - else if (SelectedPart == "Left Arm") - { - GlobalVars.LeftArmColorID = ColorID; - GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); - button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); - } - else if (SelectedPart == "Right Leg") - { - GlobalVars.RightLegColorID = ColorID; - GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); - button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); - } - else if (SelectedPart == "Left Leg") - { - GlobalVars.LeftLegColorID = ColorID; - GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); - button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); - } - } - - void ChangeColorOfPart(string part, int ColorID, Color ButtonColor) - { - if (part == "Head") - { - GlobalVars.HeadColorID = ColorID; - GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); - button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); - } - else if (part == "Torso") - { - GlobalVars.TorsoColorID = ColorID; - GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); - button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); - } - else if (part == "Right Arm") - { - GlobalVars.RightArmColorID = ColorID; - GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); - button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); - } - else if (part == "Left Arm") - { - GlobalVars.LeftArmColorID = ColorID; - GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); - button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); - } - else if (part == "Right Leg") - { - GlobalVars.RightLegColorID = ColorID; - GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); - button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); - } - else if (part == "Left Leg") - { - GlobalVars.LeftLegColorID = ColorID; - GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); - button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); - } - } void ChangeColorOfPart(int ColorID) { ChangeColorOfPart(ColorID, PartColorList.Find(x => x.ColorID == ColorID).ButtonColor); } + void ChangeColorOfPart(int ColorID, Color ButtonColor) + { + ChangeColorOfPart(SelectedPart, ColorID, ButtonColor); + } + + void ChangeColorOfPart(string part, int ColorID, Color ButtonColor) + { + switch (part) + { + case "Head": + GlobalVars.HeadColorID = ColorID; + GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); + button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); + break; + case "Torso": + GlobalVars.TorsoColorID = ColorID; + GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); + button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); + break; + case "Right Arm": + GlobalVars.RightArmColorID = ColorID; + GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); + button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); + break; + case "Left Arm": + GlobalVars.LeftArmColorID = ColorID; + GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); + button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); + break; + case "Right Leg": + GlobalVars.RightLegColorID = ColorID; + GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); + button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); + break; + case "Left Leg": + GlobalVars.LeftLegColorID = ColorID; + GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); + button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); + break; + default: + break; + } + } + void Button7Click(object sender, EventArgs e) { ChangeColorOfPart(1); @@ -1415,31 +1390,30 @@ namespace NovetusLauncher { int RandomColor = rand.Next(PartColorList.Count); - if (i == 1) - { - ChangeColorOfPart("Head", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 2) - { - ChangeColorOfPart("Torso", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 3) - { - ChangeColorOfPart("Left Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + switch (i) + { + case 1: + ChangeColorOfPart("Head", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 2: + ChangeColorOfPart("Torso", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 3: + ChangeColorOfPart("Left Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 4: + ChangeColorOfPart("Right Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 5: + ChangeColorOfPart("Left Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 6: + ChangeColorOfPart("Right Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + default: + break; } - else if (i == 4) - { - ChangeColorOfPart("Right Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 5) - { - ChangeColorOfPart("Left Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 6) - { - ChangeColorOfPart("Right Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - } + } } void Button40Click(object sender, EventArgs e) @@ -1647,85 +1621,88 @@ namespace NovetusLauncher void CheckBox1CheckedChanged(object sender, EventArgs e) { - if (checkBox1.Checked == true) - { - GlobalVars.Custom_Extra_ShowHats = true; - - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - if (file.Name.Equals("NoHat.rbxm")) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - } - else if (checkBox1.Checked == false) - { - GlobalVars.Custom_Extra_ShowHats = false; - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.extradir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - - listBox9.SelectedItem = "NoExtra.rbxm"; - try - { - GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - GlobalVars.Custom_Extra_SelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + switch (checkBox1.Checked) + { + case true: + GlobalVars.Custom_Extra_ShowHats = true; + + if (Directory.Exists(GlobalVars.hatdir)) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox10.Text = GlobalVars.Custom_Extra; - } - } - catch(Exception) when (!Env.Debugging) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - GlobalVars.Custom_Extra_SelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + if (file.Name.Equals(String.Empty)) + { + continue; + } + + if (file.Name.Equals("NoHat.rbxm")) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + break; + case false: + GlobalVars.Custom_Extra_ShowHats = false; + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.extradir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + + listBox9.SelectedItem = "NoExtra.rbxm"; + try + { + GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + GlobalVars.Custom_Extra_SelectionIsHat = false; + if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.Custom_Extra; } } - } - } + catch (Exception) when (!Env.Debugging) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + GlobalVars.Custom_Extra_SelectionIsHat = true; + if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox10.Text = GlobalVars.Custom_Extra; + } + } + } + break; + default: + break; + } } private void button60_Click(object sender, EventArgs e) diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs index 97c3345..ac165bc 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization/CharacterCustomization_legacy.cs @@ -140,211 +140,107 @@ namespace NovetusLauncher //clothing if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://")) { - if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_T_Shirt_Offline) { - textBox11.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox2.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_T_Shirt_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox12.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox2.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox11.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox2.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox11.Text = GlobalVars.Custom_T_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox2.SelectedItem = "Roblox"; + break; } } if (GlobalVars.Custom_Shirt_Offline.Contains("http://")) { - if (GlobalVars.Custom_Shirt_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_Shirt_Offline) { - textBox12.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox1.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_Shirt_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox12.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox1.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox12.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox1.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox12.Text = GlobalVars.Custom_Shirt_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox1.SelectedItem = "Roblox"; + break; } } if (GlobalVars.Custom_Pants_Offline.Contains("http://")) { - if (GlobalVars.Custom_Pants_Offline.Contains("http://finobe.com/asset/?id=")) + switch (GlobalVars.Custom_Pants_Offline) { - textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://finobe.com/asset/?id=", ""); - comboBox3.SelectedItem = "Finobe"; - } - else if (GlobalVars.Custom_Pants_Offline.Contains("http://www.roblox.com/asset/?id=")) - { - textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://www.roblox.com/asset/?id=", ""); - comboBox3.SelectedItem = "Roblox"; + case string finobe when finobe.Contains("http://finobe.com/asset/?id="): + textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://finobe.com/asset/?id=", ""); + comboBox3.SelectedItem = "Finobe"; + break; + case string roblox when roblox.Contains("http://www.roblox.com/asset/?id="): + default: + textBox13.Text = GlobalVars.Custom_Pants_Offline.Replace("http://www.roblox.com/asset/?id=", ""); + comboBox3.SelectedItem = "Roblox"; + break; } } //discord - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InCustomization, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InCustomization, GlobalVars.Map); LauncherFuncs.ReloadLoadtextValue(); } - - void tabControl1_SelectedIndexChanged(object sender, EventArgs e) - { - if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage1"])//your specific tabname + + void tabControl1_SelectedIndexChanged(object sender, EventArgs e) + { + switch (tabControl1.SelectedTab) { - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage7"]) - { - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); + case TabPage pg1 when pg1 == tabControl1.TabPages["tabPage1"]: + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + break; + case TabPage pg7 when pg7 == tabControl1.TabPages["tabPage7"]: + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - try - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); - pictureBox10.Image = icon1; - } - catch (Exception) when (!Env.Debugging) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); - pictureBox10.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])//your specific tabname - { - //hats - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox1.Items.Add(file.Name); - listBox2.Items.Add(file.Name); - listBox3.Items.Add(file.Name); - } - listBox1.SelectedItem = GlobalVars.Custom_Hat1ID_Offline; - listBox2.SelectedItem = GlobalVars.Custom_Hat2ID_Offline; - listBox3.SelectedItem = GlobalVars.Custom_Hat3ID_Offline; - listBox1.Enabled = true; - listBox2.Enabled = true; - listBox3.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox1.Image = icon1; - Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox2.Image = icon2; - Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + ".png"); - pictureBox3.Image = icon3; - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + try { - textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradirIcons + "\\" + GlobalVars.PlayerName + ".png"); + pictureBox10.Image = icon1; } - else + catch (Exception) when (!Env.Debugging) { - textBox2.Text = GlobalVars.Custom_Hat1ID_Offline; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); + pictureBox10.Image = icon1; } + break; + case TabPage pg2 when pg2 == tabControl1.TabPages["tabPage2"]: + //hats + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (Directory.Exists(GlobalVars.hatdir)) { - textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox3.Text = GlobalVars.Custom_Hat2ID_Offline; - } - - if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt")) - { - textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox4.Text = GlobalVars.Custom_Hat3ID_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage3"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.facedir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox4.Items.Add(file.Name); - } - listBox4.SelectedItem = GlobalVars.Custom_Face_Offline; - listBox4.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + ".png"); - pictureBox4.Image = icon1; - - if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt")) - { - textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox6.Text = GlobalVars.Custom_Face_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage4"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.tshirtdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -353,94 +249,244 @@ namespace NovetusLauncher continue; } - listBox5.Items.Add(file.Name); + listBox1.Items.Add(file.Name); + listBox2.Items.Add(file.Name); + listBox3.Items.Add(file.Name); } - listBox5.SelectedItem = GlobalVars.Custom_T_Shirt_Offline; - listBox5.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + ".png"); + listBox1.SelectedItem = GlobalVars.Custom_Hat1ID_Offline; + listBox2.SelectedItem = GlobalVars.Custom_Hat2ID_Offline; + listBox3.SelectedItem = GlobalVars.Custom_Hat3ID_Offline; + listBox1.Enabled = true; + listBox2.Enabled = true; + listBox3.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox1.Image = icon1; + Image icon2 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox2.Image = icon2; + Image icon3 = LauncherFuncs.LoadImage(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + ".png"); + pictureBox3.Image = icon3; + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox2.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat1ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox2.Text = GlobalVars.Custom_Hat1ID_Offline; + } + + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox3.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat2ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox3.Text = GlobalVars.Custom_Hat2ID_Offline; + } + + if (File.Exists(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox4.Text = File.ReadAllText(GlobalVars.hatdir + @"\\" + GlobalVars.Custom_Hat3ID_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox4.Text = GlobalVars.Custom_Hat3ID_Offline; + } + } + break; + case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.facedir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.facedir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox4.Items.Add(file.Name); + } + listBox4.SelectedItem = GlobalVars.Custom_Face_Offline; + listBox4.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + ".png"); + pictureBox4.Image = icon1; + + if (File.Exists(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox6.Text = File.ReadAllText(GlobalVars.facedir + @"\\" + GlobalVars.Custom_Face_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox6.Text = GlobalVars.Custom_Face_Offline; + } + } + break; + case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + + try + { + if (Directory.Exists(GlobalVars.tshirtdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.tshirtdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox5.Items.Add(file.Name); + } + listBox5.SelectedItem = GlobalVars.Custom_T_Shirt_Offline; + listBox5.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + ".png"); + pictureBox5.Image = icon1; + + if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox7.Text = GlobalVars.Custom_T_Shirt_Offline; + } + } + } + catch (Exception) + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); pictureBox5.Image = icon1; + } + break; + case TabPage pg5 when pg5 == tabControl1.TabPages["tabPage5"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + try + { + if (Directory.Exists(GlobalVars.shirtdir)) { - textBox7.Text = File.ReadAllText(GlobalVars.tshirtdir + @"\\" + GlobalVars.Custom_T_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox7.Text = GlobalVars.Custom_T_Shirt_Offline; + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox6.Items.Add(file.Name); + } + listBox6.SelectedItem = GlobalVars.Custom_Shirt_Offline; + listBox6.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + ".png"); + pictureBox6.Image = icon1; + + if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox8.Text = GlobalVars.Custom_Shirt_Offline; + } } } - } - catch (Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.tshirtdir + @"\\NoTShirt.png"); - pictureBox5.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage5"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.shirtdir)) + catch (Exception) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.shirtdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach (FileInfo file in Files) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox6.Items.Add(file.Name); - } - listBox6.SelectedItem = GlobalVars.Custom_Shirt_Offline; - listBox6.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + ".png"); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); pictureBox6.Image = icon1; + } + break; + case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); - if (File.Exists(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt")) + try + { + if (Directory.Exists(GlobalVars.pantsdir)) { - textBox8.Text = File.ReadAllText(GlobalVars.shirtdir + @"\\" + GlobalVars.Custom_Shirt_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox8.Text = GlobalVars.Custom_Shirt_Offline; + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox7.Items.Add(file.Name); + } + listBox7.SelectedItem = GlobalVars.Custom_Pants_Offline; + listBox7.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + ".png"); + pictureBox7.Image = icon1; + + if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt")) + { + textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox9.Text = GlobalVars.Custom_Pants_Offline; + } } } - } - catch(Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.shirtdir + @"\\NoShirt.png"); - pictureBox6.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage6"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox8.Items.Clear(); - listBox9.Items.Clear(); - - try - { - if (Directory.Exists(GlobalVars.pantsdir)) + catch (Exception) { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.pantsdir); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); + pictureBox7.Image = icon1; + } + break; + case TabPage pg8 when pg8 == tabControl1.TabPages["tabPage8"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.headdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); FileInfo[] Files = dinfo.GetFiles("*.rbxm"); foreach (FileInfo file in Files) { @@ -449,156 +495,121 @@ namespace NovetusLauncher continue; } - listBox7.Items.Add(file.Name); + listBox8.Items.Add(file.Name); } - listBox7.SelectedItem = GlobalVars.Custom_Pants_Offline; - listBox7.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + ".png"); - pictureBox7.Image = icon1; + listBox8.SelectedItem = GlobalVars.Custom_Head_Offline; + listBox8.Enabled = true; + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + ".png"); + pictureBox8.Image = icon1; - if (File.Exists(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt")) { - textBox9.Text = File.ReadAllText(GlobalVars.pantsdir + @"\\" + GlobalVars.Custom_Pants_Offline.Replace(".rbxm", "") + "_desc.txt"); + textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt"); } else { - textBox9.Text = GlobalVars.Custom_Pants_Offline; + textBox5.Text = GlobalVars.Custom_Head_Offline; } } - } - catch (Exception) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.pantsdir + @"\\NoPants.png"); - pictureBox7.Image = icon1; - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage8"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.headdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.headdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox8.Items.Add(file.Name); - } - listBox8.SelectedItem = GlobalVars.Custom_Head_Offline; - listBox8.Enabled = true; - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + ".png"); - pictureBox8.Image = icon1; + break; + case TabPage pg9 when pg9 == tabControl1.TabPages["tabPage9"]: + //faces + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); - if (File.Exists(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt")) + if (Directory.Exists(GlobalVars.extradir)) { - textBox5.Text = File.ReadAllText(GlobalVars.headdir + @"\\" + GlobalVars.Custom_Head_Offline.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox5.Text = GlobalVars.Custom_Head_Offline; - } - } - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage9"])//your specific tabname - { - //faces - listBox1.Items.Clear(); - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - listBox5.Items.Clear(); - listBox6.Items.Clear(); - listBox7.Items.Clear(); - listBox8.Items.Clear(); - - if (Directory.Exists(GlobalVars.extradir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - - if (GlobalVars.Custom_Extra_ShowHats == true) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - if (file.Name.Equals("NoHat.rbxm")) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - } - - listBox9.SelectedItem = GlobalVars.Custom_Extra; - listBox9.Enabled = true; - try - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) - { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox10.Text = GlobalVars.Custom_Extra; - } - } - catch(Exception) when (!Env.Debugging) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + + if (GlobalVars.Custom_Extra_ShowHats == true) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + if (file.Name.Equals("NoHat.rbxm")) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + } + + listBox9.SelectedItem = GlobalVars.Custom_Extra; + listBox9.Enabled = true; + try + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.Custom_Extra; } } - } - } - } - - void CharacterCustomizationClose(object sender, CancelEventArgs e) + catch (Exception) when (!Env.Debugging) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox10.Text = GlobalVars.Custom_Extra; + } + } + } + break; + default: + listBox1.Items.Clear(); + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + listBox5.Items.Clear(); + listBox6.Items.Clear(); + listBox7.Items.Clear(); + listBox8.Items.Clear(); + listBox9.Items.Clear(); + break; + } + } + + void CharacterCustomizationClose(object sender, CancelEventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); LauncherFuncs.ReloadLoadtextValue(); } @@ -1143,92 +1154,56 @@ namespace NovetusLauncher return Color.FromArgb(A,R,G,B); } - - void ChangeColorOfPart(int ColorID, Color ButtonColor) - { - if (SelectedPart == "Head") - { - GlobalVars.HeadColorID = ColorID; - GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); - button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); - } - else if (SelectedPart == "Torso") - { - GlobalVars.TorsoColorID = ColorID; - GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); - button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); - } - else if (SelectedPart == "Right Arm") - { - GlobalVars.RightArmColorID = ColorID; - GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); - button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); - } - else if (SelectedPart == "Left Arm") - { - GlobalVars.LeftArmColorID = ColorID; - GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); - button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); - } - else if (SelectedPart == "Right Leg") - { - GlobalVars.RightLegColorID = ColorID; - GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); - button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); - } - else if (SelectedPart == "Left Leg") - { - GlobalVars.LeftLegColorID = ColorID; - GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); - button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); - } - } - - void ChangeColorOfPart(string part, int ColorID, Color ButtonColor) - { - if (part == "Head") - { - GlobalVars.HeadColorID = ColorID; - GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); - button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); - } - else if (part == "Torso") - { - GlobalVars.TorsoColorID = ColorID; - GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); - button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); - } - else if (part == "Right Arm") - { - GlobalVars.RightArmColorID = ColorID; - GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); - button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); - } - else if (part == "Left Arm") - { - GlobalVars.LeftArmColorID = ColorID; - GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); - button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); - } - else if (part == "Right Leg") - { - GlobalVars.RightLegColorID = ColorID; - GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); - button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); - } - else if (part == "Left Leg") - { - GlobalVars.LeftLegColorID = ColorID; - GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); - button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); - } - } void ChangeColorOfPart(int ColorID) { ChangeColorOfPart(ColorID, PartColorList.Find(x => x.ColorID == ColorID).ButtonColor); } + void ChangeColorOfPart(int ColorID, Color ButtonColor) + { + ChangeColorOfPart(SelectedPart, ColorID, ButtonColor); + } + + void ChangeColorOfPart(string part, int ColorID, Color ButtonColor) + { + switch (part) + { + case "Head": + GlobalVars.HeadColorID = ColorID; + GlobalVars.ColorMenu_HeadColor = ButtonColor.ToString(); + button1.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor); + break; + case "Torso": + GlobalVars.TorsoColorID = ColorID; + GlobalVars.ColorMenu_TorsoColor = ButtonColor.ToString(); + button2.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor); + break; + case "Right Arm": + GlobalVars.RightArmColorID = ColorID; + GlobalVars.ColorMenu_RightArmColor = ButtonColor.ToString(); + button3.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor); + break; + case "Left Arm": + GlobalVars.LeftArmColorID = ColorID; + GlobalVars.ColorMenu_LeftArmColor = ButtonColor.ToString(); + button4.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor); + break; + case "Right Leg": + GlobalVars.RightLegColorID = ColorID; + GlobalVars.ColorMenu_RightLegColor = ButtonColor.ToString(); + button5.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor); + break; + case "Left Leg": + GlobalVars.LeftLegColorID = ColorID; + GlobalVars.ColorMenu_LeftLegColor = ButtonColor.ToString(); + button6.BackColor = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor); + break; + default: + break; + } + } + void Button7Click(object sender, EventArgs e) { ChangeColorOfPart(1); @@ -1400,41 +1375,40 @@ namespace NovetusLauncher } void Button39Click(object sender, EventArgs e) - { + { Random rand = new Random(); - for (int i=1; i <= 6; i++) - { - int RandomColor = rand.Next(PartColorList.Count); + for (int i = 1; i <= 6; i++) + { + int RandomColor = rand.Next(PartColorList.Count); - if (i == 1) - { - ChangeColorOfPart("Head", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 2) - { - ChangeColorOfPart("Torso", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 3) - { - ChangeColorOfPart("Left Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + switch (i) + { + case 1: + ChangeColorOfPart("Head", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 2: + ChangeColorOfPart("Torso", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 3: + ChangeColorOfPart("Left Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 4: + ChangeColorOfPart("Right Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 5: + ChangeColorOfPart("Left Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + case 6: + ChangeColorOfPart("Right Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); + break; + default: + break; } - else if (i == 4) - { - ChangeColorOfPart("Right Arm", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 5) - { - ChangeColorOfPart("Left Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - else if (i == 6) - { - ChangeColorOfPart("Right Leg", PartColorList[RandomColor].ColorID, PartColorList[RandomColor].ButtonColor); - } - } - } - - void Button40Click(object sender, EventArgs e) + } + } + + void Button40Click(object sender, EventArgs e) { GlobalVars.HeadColorID = 24; GlobalVars.TorsoColorID = 23; @@ -1636,89 +1610,92 @@ namespace NovetusLauncher } } } - - void CheckBox1CheckedChanged(object sender, EventArgs e) - { - if (checkBox1.Checked == true) - { - GlobalVars.Custom_Extra_ShowHats = true; - - if (Directory.Exists(GlobalVars.hatdir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - if (file.Name.Equals("NoHat.rbxm")) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - } - else if (checkBox1.Checked == false) - { - GlobalVars.Custom_Extra_ShowHats = false; - listBox9.Items.Clear(); - - if (Directory.Exists(GlobalVars.extradir)) - { - DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); - FileInfo[] Files = dinfo.GetFiles("*.rbxm"); - foreach( FileInfo file in Files ) - { - if (file.Name.Equals(String.Empty)) - { - continue; - } - - listBox9.Items.Add(file.Name); - } - } - - listBox9.SelectedItem = "NoExtra.rbxm"; - try - { - GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - GlobalVars.Custom_Extra_SelectionIsHat = false; - if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + + void CheckBox1CheckedChanged(object sender, EventArgs e) + { + switch (checkBox1.Checked) + { + case true: + GlobalVars.Custom_Extra_ShowHats = true; + + if (Directory.Exists(GlobalVars.hatdir)) { - textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); - } - else - { - textBox10.Text = GlobalVars.Custom_Extra; - } - } - catch(Exception) when (!Env.Debugging) - { - if (Directory.Exists(GlobalVars.hatdir)) - { - GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); - Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); - pictureBox9.Image = icon1; - GlobalVars.Custom_Extra_SelectionIsHat = true; - if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) { - textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + if (file.Name.Equals(String.Empty)) + { + continue; + } + + if (file.Name.Equals("NoHat.rbxm")) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + break; + case false: + GlobalVars.Custom_Extra_ShowHats = false; + listBox9.Items.Clear(); + + if (Directory.Exists(GlobalVars.extradir)) + { + DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.extradir); + FileInfo[] Files = dinfo.GetFiles("*.rbxm"); + foreach (FileInfo file in Files) + { + if (file.Name.Equals(String.Empty)) + { + continue; + } + + listBox9.Items.Add(file.Name); + } + } + + listBox9.SelectedItem = "NoExtra.rbxm"; + try + { + GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + GlobalVars.Custom_Extra_SelectionIsHat = false; + if (File.Exists(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); } else { textBox10.Text = GlobalVars.Custom_Extra; } } - } - } - } + catch (Exception) when (!Env.Debugging) + { + if (Directory.Exists(GlobalVars.hatdir)) + { + GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); + Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); + pictureBox9.Image = icon1; + GlobalVars.Custom_Extra_SelectionIsHat = true; + if (File.Exists(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt")) + { + textBox10.Text = File.ReadAllText(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + "_desc.txt"); + } + else + { + textBox10.Text = GlobalVars.Custom_Extra; + } + } + } + break; + default: + break; + } + } private void button60_Click(object sender, EventArgs e) { diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs index 832e9a8..661b4d4 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm.cs @@ -167,7 +167,7 @@ namespace NovetusLauncher handlers.requestCallback += RequestCallback; DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "", true); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true); } } #endregion @@ -219,109 +219,107 @@ namespace NovetusLauncher async void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { - if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])//your specific tabname - { - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - //since we are async, DO THESE first or we'll clear out random stuff. - textBox3.Text = "Loading..."; - string IP = await SecurityFuncs.GetExternalIPAddressAsync(); - textBox3.Text = ""; - string[] lines1 = { - SecurityFuncs.Base64Encode(IP), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) - }; - string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); - string[] lines2 = { - SecurityFuncs.Base64Encode("localhost"), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) - }; - string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); - string[] text = { - "Client: " + GlobalVars.SelectedClient, - "IP: " + IP, - "Port: " + GlobalVars.RobloxPort.ToString(), - "Map: " + GlobalVars.Map, - "Players: " + GlobalVars.PlayerLimit, - "Version: Novetus " + GlobalVars.Version, - "Online URI Link:", - URI, - "Local URI Link:", - URI2, - GlobalVars.IsWebServerOn == true ? "Web Server URL:" : "", - GlobalVars.IsWebServerOn == true ? "http://" + IP + ":" + GlobalVars.WebServer.Port.ToString() : "", - GlobalVars.IsWebServerOn == true ? "Local Web Server URL:" : "", - GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" - }; + switch (tabControl1.SelectedTab) + { + case TabPage pg2 when pg2 == tabControl1.TabPages["tabPage2"]: + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + //since we are async, DO THESE first or we'll clear out random stuff. + textBox3.Text = "Loading..."; + string IP = await SecurityFuncs.GetExternalIPAddressAsync(); + textBox3.Text = ""; + string[] lines1 = { + SecurityFuncs.Base64Encode(IP), + SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + }; + string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); + string[] lines2 = { + SecurityFuncs.Base64Encode("localhost"), + SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + }; + string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); + string[] text = { + "Client: " + GlobalVars.SelectedClient, + "IP: " + IP, + "Port: " + GlobalVars.RobloxPort.ToString(), + "Map: " + GlobalVars.Map, + "Players: " + GlobalVars.PlayerLimit, + "Version: Novetus " + GlobalVars.Version, + "Online URI Link:", + URI, + "Local URI Link:", + URI2, + GlobalVars.IsWebServerOn == true ? "Web Server URL:" : "", + GlobalVars.IsWebServerOn == true ? "http://" + IP + ":" + GlobalVars.WebServer.Port.ToString() : "", + GlobalVars.IsWebServerOn == true ? "Local Web Server URL:" : "", + GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" + }; - foreach (string str in text) - { - if (!string.IsNullOrWhiteSpace(str)) - { - textBox3.AppendText(str); - textBox3.AppendText(Environment.NewLine); - } - } - textBox3.SelectionStart = 0; - textBox3.ScrollToCaret(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage4"])//your specific tabname - { - string mapdir = GlobalVars.MapsDir; - TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); - TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); - treeView1.Focus(); - textBox3.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage3"])//your specific tabname - { - string clientdir = GlobalVars.ClientDir; - DirectoryInfo dinfo = new DirectoryInfo(clientdir); - DirectoryInfo[] Dirs = dinfo.GetDirectories(); - foreach( DirectoryInfo dir in Dirs ) - { - listBox2.Items.Add(dir.Name); - } - listBox2.SelectedItem = GlobalVars.SelectedClient; - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage6"])//your specific tabname - { - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); - listBox3.Items.AddRange(lines_server); - listBox4.Items.AddRange(lines_ports); - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox2.Items.Clear(); - } - else - { - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } + foreach (string str in text) + { + if (!string.IsNullOrWhiteSpace(str)) + { + textBox3.AppendText(str); + textBox3.AppendText(Environment.NewLine); + } + } + textBox3.SelectionStart = 0; + textBox3.ScrollToCaret(); + break; + case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: + string mapdir = GlobalVars.MapsDir; + TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); + TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.Focus(); + textBox3.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: + string clientdir = GlobalVars.ClientDir; + DirectoryInfo dinfo = new DirectoryInfo(clientdir); + DirectoryInfo[] Dirs = dinfo.GetDirectories(); + foreach (DirectoryInfo dir in Dirs) + { + listBox2.Items.Add(dir.Name); + } + listBox2.SelectedItem = GlobalVars.SelectedClient; + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: + string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + listBox3.Items.AddRange(lines_server); + listBox4.Items.AddRange(lines_ports); + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox2.Items.Clear(); + break; + default: + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + } } void Button1Click(object sender, EventArgs e) @@ -516,53 +514,44 @@ namespace NovetusLauncher label28.Text = GlobalVars.Map; treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); treeView1.Focus(); - //GlobalVars.Map = treeView1.SelectedNode.Text.ToString(); - // GlobalVars.MapPath = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); label37.Text = GlobalVars.IP; label38.Text = GlobalVars.RobloxPort.ToString(); - /* - if (GlobalVars.UDP == false && GlobalVars.UPnP == true) - { - checkBox4.Checked = GlobalVars.UPnP; - } - else if (GlobalVars.UDP == true && GlobalVars.UPnP == false) - { - checkBox8.Checked = GlobalVars.UDP; - }*/ checkBox2.Checked = GlobalVars.DiscordPresence; checkBox5.Checked = GlobalVars.ReShade; checkBox6.Checked = GlobalVars.ReShadeFPSDisplay; checkBox7.Checked = GlobalVars.ReShadePerformanceMode; - if (GlobalVars.GraphicsMode == 1) + + switch (GlobalVars.GraphicsMode) { - comboBox1.SelectedIndex = 0; - } - else if (GlobalVars.GraphicsMode == 2) - { - comboBox1.SelectedIndex = 1; + case GraphicsMode.DirectX: + comboBox1.SelectedIndex = 1; + break; + case GraphicsMode.OpenGL: + default: + comboBox1.SelectedIndex = 0; + break; } - if (GlobalVars.QualityLevel == 1) + switch (GlobalVars.QualityLevel) { - comboBox2.SelectedIndex = 0; - } - else if (GlobalVars.QualityLevel == 2) - { - comboBox2.SelectedIndex = 1; - } - else if (GlobalVars.QualityLevel == 3) - { - comboBox2.SelectedIndex = 2; - } - else if (GlobalVars.QualityLevel == 4) - { - comboBox2.SelectedIndex = 3; - } - else if (GlobalVars.QualityLevel == 5) - { - comboBox2.SelectedIndex = 4; + case QualityLevel.VeryLow: + comboBox2.SelectedIndex = 0; + break; + case QualityLevel.Low: + comboBox2.SelectedIndex = 1; + break; + case QualityLevel.Medium: + comboBox2.SelectedIndex = 2; + break; + case QualityLevel.High: + comboBox2.SelectedIndex = 3; + break; + case QualityLevel.Ultra: + default: + comboBox2.SelectedIndex = 4; + break; } ConsolePrint("Config loaded.", 3); @@ -596,30 +585,32 @@ namespace NovetusLauncher { LauncherFuncs.ReadClientValues(clientpath); - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true) - { - textBox2.Enabled = true; - } - else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false) - { - textBox2.Enabled = false; + switch (GlobalVars.SelectedClientInfo.UsesPlayerName) + { + case true: + textBox2.Enabled = true; + break; + case false: + textBox2.Enabled = false; + break; } - if (GlobalVars.SelectedClientInfo.UsesID == true) + switch (GlobalVars.SelectedClientInfo.UsesID) { - textBox5.Enabled = true; - button4.Enabled = true; - if (GlobalVars.IP.Equals("localhost")) - { - checkBox3.Enabled = true; - } - } - else if (GlobalVars.SelectedClientInfo.UsesID == false) - { - textBox5.Enabled = false; - button4.Enabled = false; - checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + case true: + textBox5.Enabled = true; + button4.Enabled = true; + if (GlobalVars.IP.Equals("localhost")) + { + checkBox3.Enabled = true; + } + break; + case false: + textBox5.Enabled = false; + button4.Enabled = false; + checkBox3.Enabled = false; + GlobalVars.LocalPlayMode = false; + break; } if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning)) @@ -660,14 +651,7 @@ namespace NovetusLauncher void CheckBox1CheckedChanged(object sender, EventArgs e) { - if (checkBox1.Checked == true) - { - GlobalVars.CloseOnLaunch = true; - } - else if (checkBox1.Checked == false) - { - GlobalVars.CloseOnLaunch = false; - } + GlobalVars.CloseOnLaunch = checkBox1.Checked; } void Button4Click(object sender, EventArgs e) @@ -690,19 +674,12 @@ namespace NovetusLauncher { GlobalVars.SelectedClient = listBox2.SelectedItem.ToString(); ReadClientValues(GlobalVars.SelectedClient); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); } void CheckBox3CheckedChanged(object sender, EventArgs e) { - if (checkBox3.Checked == true) - { - GlobalVars.LocalPlayMode = true; - } - else if (checkBox3.Checked == false) - { - GlobalVars.LocalPlayMode = false; - } + GlobalVars.LocalPlayMode = checkBox3.Checked; } void TextBox5TextChanged(object sender, EventArgs e) @@ -860,39 +837,38 @@ namespace NovetusLauncher void ConsolePrint(string text, int type) { richTextBox1.AppendText("[" + DateTime.Now.ToShortTimeString() + "] - ", Color.White); - if (type == 1) - { - richTextBox1.AppendText(text, Color.White); - } - else if (type == 2) - { - richTextBox1.AppendText(text, Color.Red); - } - else if (type == 3) - { - richTextBox1.AppendText(text, Color.Lime); - } - else if (type == 4) - { - richTextBox1.AppendText(text, Color.Aqua); - } - else if (type == 5) - { - richTextBox1.AppendText(text, Color.Yellow); - } - else if (type == 6) - { - richTextBox1.AppendText(text, Color.LightSalmon); - } - richTextBox1.AppendText(Environment.NewLine); + switch (type) + { + case 2: + richTextBox1.AppendText(text, Color.Red); + break; + case 3: + richTextBox1.AppendText(text, Color.Lime); + break; + case 4: + richTextBox1.AppendText(text, Color.Aqua); + break; + case 5: + richTextBox1.AppendText(text, Color.Yellow); + break; + case 6: + richTextBox1.AppendText(text, Color.LightSalmon); + break; + case 1: + default: + richTextBox1.AppendText(text, Color.White); + break; + } + + richTextBox1.AppendText(Environment.NewLine); } //Rewrite these into one function. Preferably global. void StartClient() { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Client); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Client); string quote = "\""; string args = ""; @@ -900,11 +876,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Client); + ScriptGenerator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } @@ -964,13 +940,13 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.Map); } void ClientExited(object sender, EventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); if (GlobalVars.CloseOnLaunch == true) { Visible = true; @@ -987,7 +963,7 @@ namespace NovetusLauncher void EasterEggExited(object sender, EventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); label12.Text = LocalVars.prevsplash; if (GlobalVars.CloseOnLaunch == true) { @@ -998,7 +974,7 @@ namespace NovetusLauncher void StartSolo() { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Solo); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Solo); string mapfile = GlobalVars.MapPath; string quote = "\""; string args = ""; @@ -1006,11 +982,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Solo) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Solo); + ScriptGenerator.GenerateScriptForClient(ScriptType.Solo); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -1029,8 +1005,8 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.Map); } catch (Exception ex) when (!Env.Debugging) { @@ -1042,7 +1018,7 @@ namespace NovetusLauncher void StartServer(bool no3d) { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Server); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Server); string mapfile = GlobalVars.MapPath; string quote = "\""; string args = ""; @@ -1050,11 +1026,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Server); + ScriptGenerator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -1081,7 +1057,7 @@ namespace NovetusLauncher client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); } catch (Exception ex) when (!Env.Debugging) { @@ -1093,7 +1069,7 @@ namespace NovetusLauncher void StartStudio(bool nomap) { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Studio); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Studio); string mapfile = (nomap ? "" : GlobalVars.MapPath); string mapname = (nomap ? "" : GlobalVars.Map); string quote = "\""; @@ -1102,11 +1078,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Studio) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Studio); + ScriptGenerator.GenerateScriptForClient(ScriptType.Studio); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -1125,8 +1101,8 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname); + SecurityFuncs.RenameWindow(client, ScriptType.Studio, mapname); + LauncherFuncs.UpdateRichPresence(LauncherState.InStudio, mapname); } catch (Exception ex) when (!Env.Debugging) { @@ -1139,7 +1115,7 @@ namespace NovetusLauncher { label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.EasterEgg); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); string mapfile = GlobalVars.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; @@ -1147,11 +1123,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.EasterEgg) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.EasterEgg); + ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -1170,8 +1146,8 @@ namespace NovetusLauncher client.Start(); client.Exited += new EventHandler(EasterEggExited); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, ""); + SecurityFuncs.RenameWindow(client, ScriptType.EasterEgg, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InEasterEggGame, ""); } catch (Exception ex) when (!Env.Debugging) { @@ -1601,16 +1577,7 @@ namespace NovetusLauncher void CheckBox4CheckedChanged(object sender, EventArgs e) { - if (checkBox4.Checked == true) - { - GlobalVars.UPnP = true; - //checkBox8.Checked = false; - } - else if (checkBox4.Checked == false) - { - GlobalVars.UPnP = false; - //checkBox8.Checked = GlobalVars.UDP; - } + GlobalVars.UPnP = checkBox4.Checked; } void CheckBox4Click(object sender, EventArgs e) @@ -1679,17 +1646,9 @@ namespace NovetusLauncher private void checkBox2_CheckedChanged(object sender, EventArgs e) { - if (checkBox2.Checked == true && GlobalVars.DiscordPresence == false) - { - GlobalVars.DiscordPresence = true; - MessageBox.Show("Restart the launcher to apply changes."); - } - else if (checkBox2.Checked == false && GlobalVars.DiscordPresence == true) - { - GlobalVars.DiscordPresence = false; - MessageBox.Show("Restart the launcher to apply changes."); - } - } + checkBox2.Checked = GlobalVars.DiscordPresence; + MessageBox.Show("Restart the launcher to apply changes."); + } private void button27_Click(object sender, EventArgs e) { @@ -1742,104 +1701,83 @@ namespace NovetusLauncher { LocalVars.Clicks += 1; - if (LocalVars.Clicks == 1) + switch(LocalVars.Clicks) { - label12.Text = "Hi " + GlobalVars.PlayerName + "!"; - } - else if (LocalVars.Clicks == 3) - { - label12.Text = "How are you doing today?"; - } - else if (LocalVars.Clicks == 6) - { - label12.Text = "I just wanted to say something."; - } - else if (LocalVars.Clicks == 9) - { - label12.Text = "Just wait a little on the last click, OK?"; - } - else if (LocalVars.Clicks == 10) - { - WriteConfigValues(); - StartEasterEgg(); + case 1: + label12.Text = "Hi " + GlobalVars.PlayerName + "!"; + break; + case 3: + label12.Text = "How are you doing today?"; + break; + case 6: + label12.Text = "I just wanted to say something."; + break; + case 9: + label12.Text = "Just wait a little on the last click, OK?"; + break; + case 10: + WriteConfigValues(); + StartEasterEgg(); - if (GlobalVars.CloseOnLaunch == true) - { - Visible = false; - } + if (GlobalVars.CloseOnLaunch == true) + { + Visible = false; + } + break; + default: + break; } } } private void checkBox5_CheckedChanged(object sender, EventArgs e) { - if (checkBox5.Checked == true) - { - GlobalVars.ReShade = true; - } - else if (checkBox5.Checked == false) - { - GlobalVars.ReShade = false; - } + GlobalVars.ReShade = checkBox5.Checked; } private void checkBox6_CheckedChanged(object sender, EventArgs e) { - if (checkBox6.Checked == true) - { - GlobalVars.ReShadeFPSDisplay = true; - } - else if (checkBox6.Checked == false) - { - GlobalVars.ReShadeFPSDisplay = false; - } + GlobalVars.ReShadeFPSDisplay = checkBox6.Checked; } private void checkBox7_CheckedChanged(object sender, EventArgs e) { - if (checkBox7.Checked == true) - { - GlobalVars.ReShadePerformanceMode = true; - } - else if (checkBox7.Checked == false) - { - GlobalVars.ReShadePerformanceMode = false; - } + GlobalVars.ReShadePerformanceMode = checkBox7.Checked; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox1.SelectedIndex == 0) + switch (comboBox1.SelectedIndex) { - GlobalVars.GraphicsMode = 1; - } - else if (comboBox1.SelectedIndex == 1) - { - GlobalVars.GraphicsMode = 2; + case 1: + GlobalVars.GraphicsMode = GraphicsMode.DirectX; + break; + default: + GlobalVars.GraphicsMode = GraphicsMode.OpenGL; + break; } } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox2.SelectedIndex == 0) + switch (comboBox2.SelectedIndex) { - GlobalVars.QualityLevel = 1; - } - else if (comboBox2.SelectedIndex == 1) - { - GlobalVars.QualityLevel = 2; - } - else if (comboBox2.SelectedIndex == 2) - { - GlobalVars.QualityLevel = 3; - } - else if (comboBox2.SelectedIndex == 3) - { - GlobalVars.QualityLevel = 4; - } - else if (comboBox2.SelectedIndex == 4) - { - GlobalVars.QualityLevel = 5; + case 0: + GlobalVars.QualityLevel = QualityLevel.VeryLow; + break; + case 1: + GlobalVars.QualityLevel = QualityLevel.Low; + break; + case 2: + GlobalVars.QualityLevel = QualityLevel.Medium; + break; + case 3: + GlobalVars.QualityLevel = QualityLevel.High; + break; + case 4: + default: + GlobalVars.QualityLevel = QualityLevel.Ultra; + break; } } @@ -1849,20 +1787,5 @@ namespace NovetusLauncher WriteConfigValues(); Application.Restart(); } - - /* - private void checkBox8_CheckedChanged(object sender, EventArgs e) - { - if (checkBox8.Checked == true) - { - GlobalVars.UDP = true; - checkBox4.Checked = false; - } - else if (checkBox8.Checked == false) - { - GlobalVars.UDP = false; - checkBox4.Checked = GlobalVars.UPnP; - } - }*/ } } diff --git a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs index 57a305d..1303212 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm/MainForm_legacy.cs @@ -166,7 +166,7 @@ namespace NovetusLauncher handlers.requestCallback += RequestCallback; DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "", true); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, "", true); } } #endregion @@ -218,109 +218,107 @@ namespace NovetusLauncher async void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { - if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])//your specific tabname - { - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - //since we are async, DO THESE first or we'll clear out random stuff. - textBox3.Text = "Loading..."; - string IP = await SecurityFuncs.GetExternalIPAddressAsync(); - textBox3.Text = ""; - string[] lines1 = { - SecurityFuncs.Base64Encode(IP), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) - }; - string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); - string[] lines2 = { - SecurityFuncs.Base64Encode("localhost"), - SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), - SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) - }; - string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); - string[] text = { - "Client: " + GlobalVars.SelectedClient, - "IP: " + IP, - "Port: " + GlobalVars.RobloxPort.ToString(), - "Map: " + GlobalVars.Map, - "Players: " + GlobalVars.PlayerLimit, - "Version: Novetus " + GlobalVars.Version, - "Online URI Link:", - URI, - "Local URI Link:", - URI2, - GlobalVars.IsWebServerOn == true ? "Web Server URL:" : "", - GlobalVars.IsWebServerOn == true ? "http://" + IP + ":" + GlobalVars.WebServer.Port.ToString() : "", - GlobalVars.IsWebServerOn == true ? "Local Web Server URL:" : "", - GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" - }; + switch (tabControl1.SelectedTab) + { + case TabPage pg2 when pg2 == tabControl1.TabPages["tabPage2"]: + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + //since we are async, DO THESE first or we'll clear out random stuff. + textBox3.Text = "Loading..."; + string IP = await SecurityFuncs.GetExternalIPAddressAsync(); + textBox3.Text = ""; + string[] lines1 = { + SecurityFuncs.Base64Encode(IP), + SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + }; + string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); + string[] lines2 = { + SecurityFuncs.Base64Encode("localhost"), + SecurityFuncs.Base64Encode(GlobalVars.RobloxPort.ToString()), + SecurityFuncs.Base64Encode(GlobalVars.SelectedClient) + }; + string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); + string[] text = { + "Client: " + GlobalVars.SelectedClient, + "IP: " + IP, + "Port: " + GlobalVars.RobloxPort.ToString(), + "Map: " + GlobalVars.Map, + "Players: " + GlobalVars.PlayerLimit, + "Version: Novetus " + GlobalVars.Version, + "Online URI Link:", + URI, + "Local URI Link:", + URI2, + GlobalVars.IsWebServerOn == true ? "Web Server URL:" : "", + GlobalVars.IsWebServerOn == true ? "http://" + IP + ":" + GlobalVars.WebServer.Port.ToString() : "", + GlobalVars.IsWebServerOn == true ? "Local Web Server URL:" : "", + GlobalVars.IsWebServerOn == true ? GlobalVars.LocalWebServerURI : "" + }; - foreach (string str in text) - { - if (!string.IsNullOrWhiteSpace(str)) - { - textBox3.AppendText(str); - textBox3.AppendText(Environment.NewLine); - } - } - textBox3.SelectionStart = 0; - textBox3.ScrollToCaret(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage4"])//your specific tabname - { - string mapdir = GlobalVars.MapsDir; - TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); - TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes); - treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); - treeView1.Focus(); - textBox3.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage3"])//your specific tabname - { - string clientdir = GlobalVars.ClientDir; - DirectoryInfo dinfo = new DirectoryInfo(clientdir); - DirectoryInfo[] Dirs = dinfo.GetDirectories(); - foreach( DirectoryInfo dir in Dirs ) - { - listBox2.Items.Add(dir.Name); - } - listBox2.SelectedItem = GlobalVars.SelectedClient; - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } - else if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage6"])//your specific tabname - { - string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); - string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); - listBox3.Items.AddRange(lines_server); - listBox4.Items.AddRange(lines_ports); - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox2.Items.Clear(); - } - else - { - treeView1.Nodes.Clear(); - _fieldsTreeCache.Nodes.Clear(); - textBox4.Text = ""; - textBox3.Text = ""; - listBox2.Items.Clear(); - listBox3.Items.Clear(); - listBox4.Items.Clear(); - } + foreach (string str in text) + { + if (!string.IsNullOrWhiteSpace(str)) + { + textBox3.AppendText(str); + textBox3.AppendText(Environment.NewLine); + } + } + textBox3.SelectionStart = 0; + textBox3.ScrollToCaret(); + break; + case TabPage pg4 when pg4 == tabControl1.TabPages["tabPage4"]: + string mapdir = GlobalVars.MapsDir; + TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl"); + TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes); + treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); + treeView1.Focus(); + textBox3.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + case TabPage pg3 when pg3 == tabControl1.TabPages["tabPage3"]: + string clientdir = GlobalVars.ClientDir; + DirectoryInfo dinfo = new DirectoryInfo(clientdir); + DirectoryInfo[] Dirs = dinfo.GetDirectories(); + foreach (DirectoryInfo dir in Dirs) + { + listBox2.Items.Add(dir.Name); + } + listBox2.SelectedItem = GlobalVars.SelectedClient; + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + case TabPage pg6 when pg6 == tabControl1.TabPages["tabPage6"]: + string[] lines_server = File.ReadAllLines(GlobalVars.ConfigDir + "\\servers.txt"); + string[] lines_ports = File.ReadAllLines(GlobalVars.ConfigDir + "\\ports.txt"); + listBox3.Items.AddRange(lines_server); + listBox4.Items.AddRange(lines_ports); + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox2.Items.Clear(); + break; + default: + treeView1.Nodes.Clear(); + _fieldsTreeCache.Nodes.Clear(); + textBox4.Text = ""; + textBox3.Text = ""; + listBox2.Items.Clear(); + listBox3.Items.Clear(); + listBox4.Items.Clear(); + break; + } } void Button1Click(object sender, EventArgs e) @@ -515,21 +513,10 @@ namespace NovetusLauncher label28.Text = GlobalVars.Map; treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.Map, treeView1.Nodes); treeView1.Focus(); - //GlobalVars.Map = treeView1.SelectedNode.Text.ToString(); - // GlobalVars.MapPath = treeView1.SelectedNode.FullPath.ToString().Replace(@"\", @"\\"); numericUpDown1.Value = Convert.ToDecimal(GlobalVars.RobloxPort); numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort); label37.Text = GlobalVars.IP; label38.Text = GlobalVars.RobloxPort.ToString(); - /* - if (GlobalVars.UDP == false && GlobalVars.UPnP == true) - { - checkBox4.Checked = GlobalVars.UPnP; - } - else if (GlobalVars.UDP == true && GlobalVars.UPnP == false) - { - checkBox8.Checked = GlobalVars.UDP; - }*/ checkBox2.Checked = GlobalVars.DiscordPresence; ConsolePrint("Config loaded.", 3); @@ -563,30 +550,32 @@ namespace NovetusLauncher { LauncherFuncs.ReadClientValues(clientpath); - if (GlobalVars.SelectedClientInfo.UsesPlayerName == true) - { - textBox2.Enabled = true; - } - else if (GlobalVars.SelectedClientInfo.UsesPlayerName == false) - { - textBox2.Enabled = false; + switch (GlobalVars.SelectedClientInfo.UsesPlayerName) + { + case true: + textBox2.Enabled = true; + break; + case false: + textBox2.Enabled = false; + break; } - if (GlobalVars.SelectedClientInfo.UsesID == true) + switch (GlobalVars.SelectedClientInfo.UsesID) { - textBox5.Enabled = true; - button4.Enabled = true; - if (GlobalVars.IP.Equals("localhost")) - { - checkBox3.Enabled = true; - } - } - else if (GlobalVars.SelectedClientInfo.UsesID == false) - { - textBox5.Enabled = false; - button4.Enabled = false; - checkBox3.Enabled = false; - GlobalVars.LocalPlayMode = false; + case true: + textBox5.Enabled = true; + button4.Enabled = true; + if (GlobalVars.IP.Equals("localhost")) + { + checkBox3.Enabled = true; + } + break; + case false: + textBox5.Enabled = false; + button4.Enabled = false; + checkBox3.Enabled = false; + GlobalVars.LocalPlayMode = false; + break; } if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning)) @@ -624,19 +613,12 @@ namespace NovetusLauncher GlobalVars.LocalPlayMode = false; label37.Text = GlobalVars.IP; } - + void CheckBox1CheckedChanged(object sender, EventArgs e) { - if (checkBox1.Checked == true) - { - GlobalVars.CloseOnLaunch = true; - } - else if (checkBox1.Checked == false) - { - GlobalVars.CloseOnLaunch = false; - } + GlobalVars.CloseOnLaunch = checkBox1.Checked; } - + void Button4Click(object sender, EventArgs e) { GeneratePlayerID(); @@ -657,21 +639,14 @@ namespace NovetusLauncher { GlobalVars.SelectedClient = listBox2.SelectedItem.ToString(); ReadClientValues(GlobalVars.SelectedClient); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); } - + void CheckBox3CheckedChanged(object sender, EventArgs e) { - if (checkBox3.Checked == true) - { - GlobalVars.LocalPlayMode = true; - } - else if (checkBox3.Checked == false) - { - GlobalVars.LocalPlayMode = false; - } + GlobalVars.LocalPlayMode = checkBox3.Checked; } - + void TextBox5TextChanged(object sender, EventArgs e) { int parsedValue; @@ -823,43 +798,42 @@ namespace NovetusLauncher WriteConfigValues(); ReadConfigValues(); } - + void ConsolePrint(string text, int type) { richTextBox1.AppendText("[" + DateTime.Now.ToShortTimeString() + "] - ", Color.White); - if (type == 1) - { - richTextBox1.AppendText(text, Color.White); - } - else if (type == 2) - { - richTextBox1.AppendText(text, Color.Red); - } - else if (type == 3) - { - richTextBox1.AppendText(text, Color.Lime); - } - else if (type == 4) - { - richTextBox1.AppendText(text, Color.Aqua); - } - else if (type == 5) - { - richTextBox1.AppendText(text, Color.Yellow); - } - else if (type == 6) - { - richTextBox1.AppendText(text, Color.LightSalmon); - } - richTextBox1.AppendText(Environment.NewLine); + switch (type) + { + case 2: + richTextBox1.AppendText(text, Color.Red); + break; + case 3: + richTextBox1.AppendText(text, Color.Lime); + break; + case 4: + richTextBox1.AppendText(text, Color.Aqua); + break; + case 5: + richTextBox1.AppendText(text, Color.Yellow); + break; + case 6: + richTextBox1.AppendText(text, Color.LightSalmon); + break; + case 1: + default: + richTextBox1.AppendText(text, Color.White); + break; + } + + richTextBox1.AppendText(Environment.NewLine); } - + //Rewrite these into one function. Preferably global. void StartClient() { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Client); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Client); string quote = "\""; string args = ""; @@ -867,11 +841,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Client); + ScriptGenerator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } @@ -931,13 +905,13 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Client, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, GlobalVars.Map); } void ClientExited(object sender, EventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); if (GlobalVars.CloseOnLaunch == true) { Visible = true; @@ -954,7 +928,7 @@ namespace NovetusLauncher void EasterEggExited(object sender, EventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); label12.Text = LocalVars.prevsplash; if (GlobalVars.CloseOnLaunch == true) { @@ -965,7 +939,7 @@ namespace NovetusLauncher void StartSolo() { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Solo); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Solo); string mapfile = GlobalVars.MapPath; string quote = "\""; string args = ""; @@ -973,11 +947,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Solo) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Solo) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Solo); + ScriptGenerator.GenerateScriptForClient(ScriptType.Solo); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -996,8 +970,8 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Solo, GlobalVars.Map); + LauncherFuncs.UpdateRichPresence(LauncherState.InSoloGame, GlobalVars.Map); } catch (Exception ex) when (!Env.Debugging) { @@ -1009,7 +983,7 @@ namespace NovetusLauncher void StartServer(bool no3d) { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Server); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Server); string mapfile = GlobalVars.MapPath; string quote = "\""; string args = ""; @@ -1017,11 +991,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Server) + "; " + (!string.IsNullOrWhiteSpace(GlobalVars.AddonScriptPath) ? LauncherFuncs.ChangeGameSettings() + " dofile('" + GlobalVars.AddonScriptPath + "');" : "") + quote + (no3d ? " -no3d" : ""); } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Server); + ScriptGenerator.GenerateScriptForClient(ScriptType.Server); args = "-script " + quote + luafile + quote + (no3d ? " -no3d" : "") + " " + quote + mapfile + quote; } } @@ -1048,7 +1022,7 @@ namespace NovetusLauncher client.Exited += new EventHandler(ServerExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map); + SecurityFuncs.RenameWindow(client, ScriptType.Server, GlobalVars.Map); } catch (Exception ex) when (!Env.Debugging) { @@ -1060,7 +1034,7 @@ namespace NovetusLauncher void StartStudio(bool nomap) { string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.Studio); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.Studio); string mapfile = (nomap ? "" : GlobalVars.MapPath); string mapname = (nomap ? "" : GlobalVars.Map); string quote = "\""; @@ -1069,11 +1043,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Studio) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Studio) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Studio); + ScriptGenerator.GenerateScriptForClient(ScriptType.Studio); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -1092,8 +1066,8 @@ namespace NovetusLauncher client.Exited += new EventHandler(ClientExited); client.Start(); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname); + SecurityFuncs.RenameWindow(client, ScriptType.Studio, mapname); + LauncherFuncs.UpdateRichPresence(LauncherState.InStudio, mapname); } catch (Exception ex) when (!Env.Debugging) { @@ -1106,7 +1080,7 @@ namespace NovetusLauncher { label12.Text = "<3"; string luafile = LauncherFuncs.GetLuaFileName(); - string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptGenerator.ScriptType.EasterEgg); + string rbxexe = LauncherFuncs.GetClientEXEDir(ScriptType.EasterEgg); string mapfile = GlobalVars.ConfigDirData + "\\Appreciation.rbxl"; string quote = "\""; string args = ""; @@ -1114,11 +1088,11 @@ namespace NovetusLauncher { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.EasterEgg) + quote; + args = quote + mapfile + "\" -script \"" + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.EasterEgg) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.EasterEgg); + ScriptGenerator.GenerateScriptForClient(ScriptType.EasterEgg); args = "-script " + quote + luafile + quote + " " + quote + mapfile + quote; } } @@ -1137,8 +1111,8 @@ namespace NovetusLauncher client.Start(); client.Exited += new EventHandler(EasterEggExited); client.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, ""); + SecurityFuncs.RenameWindow(client, ScriptType.EasterEgg, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InEasterEggGame, ""); } catch (Exception ex) when (!Env.Debugging) { @@ -1568,16 +1542,7 @@ namespace NovetusLauncher void CheckBox4CheckedChanged(object sender, EventArgs e) { - if (checkBox4.Checked == true) - { - GlobalVars.UPnP = true; - //checkBox8.Checked = false; - } - else if (checkBox4.Checked == false) - { - GlobalVars.UPnP = false; - //checkBox8.Checked = GlobalVars.UDP; - } + GlobalVars.UPnP = checkBox4.Checked; } void CheckBox4Click(object sender, EventArgs e) @@ -1644,21 +1609,13 @@ namespace NovetusLauncher } } - private void checkBox2_CheckedChanged(object sender, EventArgs e) - { - if (checkBox2.Checked == true && GlobalVars.DiscordPresence == false) - { - GlobalVars.DiscordPresence = true; - MessageBox.Show("Restart the launcher to apply changes."); - } - else if (checkBox2.Checked == false && GlobalVars.DiscordPresence == true) - { - GlobalVars.DiscordPresence = false; - MessageBox.Show("Restart the launcher to apply changes."); - } - } + private void checkBox2_CheckedChanged(object sender, EventArgs e) + { + checkBox2.Checked = GlobalVars.DiscordPresence; + MessageBox.Show("Restart the launcher to apply changes."); + } - private void button27_Click(object sender, EventArgs e) + private void button27_Click(object sender, EventArgs e) { tabControl1.SelectedTab = tabPage1; } @@ -1703,42 +1660,40 @@ namespace NovetusLauncher LoadLauncher(); } - private void label8_Click(object sender, EventArgs e) - { - if (LocalVars.Clicks < 10) - { - LocalVars.Clicks += 1; + private void label8_Click(object sender, EventArgs e) + { + if (LocalVars.Clicks < 10) + { + LocalVars.Clicks += 1; - if (LocalVars.Clicks == 1) - { - label12.Text = "Hi " + GlobalVars.PlayerName + "!"; - } - else if (LocalVars.Clicks == 3) - { - label12.Text = "How are you doing today?"; - } - else if (LocalVars.Clicks == 6) - { - label12.Text = "I just wanted to say something."; - } - else if (LocalVars.Clicks == 9) - { - label12.Text = "Just wait a little on the last click, OK?"; - } - else if (LocalVars.Clicks == 10) - { - WriteConfigValues(); - StartEasterEgg(); + switch (LocalVars.Clicks) + { + case 1: + label12.Text = "Hi " + GlobalVars.PlayerName + "!"; + break; + case 3: + label12.Text = "How are you doing today?"; + break; + case 6: + label12.Text = "I just wanted to say something."; + break; + case 9: + label12.Text = "Just wait a little on the last click, OK?"; + break; + case 10: + WriteConfigValues(); + StartEasterEgg(); - if (GlobalVars.CloseOnLaunch == true) - { - Visible = false; - } - } - } - } - - + if (GlobalVars.CloseOnLaunch == true) + { + Visible = false; + } + break; + default: + break; + } + } + } void SettingsButtonClick(object sender, EventArgs e) { @@ -1773,20 +1728,5 @@ namespace NovetusLauncher WriteConfigValues(); Application.Restart(); } - - /* - private void checkBox8_CheckedChanged(object sender, EventArgs e) - { - if (checkBox8.Checked == true) - { - GlobalVars.UDP = true; - checkBox4.Checked = false; - } - else if (checkBox8.Checked == false) - { - GlobalVars.UDP = false; - checkBox4.Checked = GlobalVars.UPnP; - } - }*/ } } diff --git a/NovetusLauncher/NovetusLauncher/NovetusSettings.cs b/NovetusLauncher/NovetusLauncher/NovetusSettings.cs index 94db435..078072c 100644 --- a/NovetusLauncher/NovetusLauncher/NovetusSettings.cs +++ b/NovetusLauncher/NovetusLauncher/NovetusSettings.cs @@ -22,106 +22,87 @@ namespace NovetusLauncher checkBox5.Checked = GlobalVars.ReShade; checkBox6.Checked = GlobalVars.ReShadeFPSDisplay; checkBox7.Checked = GlobalVars.ReShadePerformanceMode; - if (GlobalVars.GraphicsMode == 1) + + switch (GlobalVars.GraphicsMode) { - comboBox1.SelectedIndex = 0; - } - else if (GlobalVars.GraphicsMode == 2) - { - comboBox1.SelectedIndex = 1; + case GraphicsMode.DirectX: + comboBox1.SelectedIndex = 1; + break; + case GraphicsMode.OpenGL: + default: + comboBox1.SelectedIndex = 0; + break; } - if (GlobalVars.QualityLevel == 1) + switch (GlobalVars.QualityLevel) { - comboBox2.SelectedIndex = 0; - } - else if (GlobalVars.QualityLevel == 2) - { - comboBox2.SelectedIndex = 1; - } - else if (GlobalVars.QualityLevel == 3) - { - comboBox2.SelectedIndex = 2; - } - else if (GlobalVars.QualityLevel == 4) - { - comboBox2.SelectedIndex = 3; - } - else if (GlobalVars.QualityLevel == 5) - { - comboBox2.SelectedIndex = 4; + case QualityLevel.VeryLow: + comboBox2.SelectedIndex = 0; + break; + case QualityLevel.Low: + comboBox2.SelectedIndex = 1; + break; + case QualityLevel.Medium: + comboBox2.SelectedIndex = 2; + break; + case QualityLevel.High: + comboBox2.SelectedIndex = 3; + break; + case QualityLevel.Ultra: + default: + comboBox2.SelectedIndex = 4; + break; } } private void checkBox5_CheckedChanged(object sender, EventArgs e) { - if (checkBox5.Checked == true) - { - GlobalVars.ReShade = true; - } - else if (checkBox5.Checked == false) - { - GlobalVars.ReShade = false; - } + GlobalVars.ReShade = checkBox5.Checked; } private void checkBox6_CheckedChanged(object sender, EventArgs e) { - if (checkBox6.Checked == true) - { - GlobalVars.ReShadeFPSDisplay = true; - } - else if (checkBox6.Checked == false) - { - GlobalVars.ReShadeFPSDisplay = false; - } + GlobalVars.ReShadeFPSDisplay = checkBox6.Checked; } private void checkBox7_CheckedChanged(object sender, EventArgs e) { - if (checkBox7.Checked == true) - { - GlobalVars.ReShadePerformanceMode = true; - } - else if (checkBox7.Checked == false) - { - GlobalVars.ReShadePerformanceMode = false; - } + GlobalVars.ReShadePerformanceMode = checkBox7.Checked; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox1.SelectedIndex == 0) + switch (comboBox1.SelectedIndex) { - GlobalVars.GraphicsMode = 1; - } - else if (comboBox1.SelectedIndex == 1) - { - GlobalVars.GraphicsMode = 2; + case 1: + GlobalVars.GraphicsMode = GraphicsMode.DirectX; + break; + default: + GlobalVars.GraphicsMode = GraphicsMode.OpenGL; + break; } } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox2.SelectedIndex == 0) + switch (comboBox2.SelectedIndex) { - GlobalVars.QualityLevel = 1; - } - else if (comboBox2.SelectedIndex == 1) - { - GlobalVars.QualityLevel = 2; - } - else if (comboBox2.SelectedIndex == 2) - { - GlobalVars.QualityLevel = 3; - } - else if (comboBox2.SelectedIndex == 3) - { - GlobalVars.QualityLevel = 4; - } - else if (comboBox2.SelectedIndex == 4) - { - GlobalVars.QualityLevel = 5; + case 0: + GlobalVars.QualityLevel = QualityLevel.VeryLow; + break; + case 1: + GlobalVars.QualityLevel = QualityLevel.Low; + break; + case 2: + GlobalVars.QualityLevel = QualityLevel.Medium; + break; + case 3: + GlobalVars.QualityLevel = QualityLevel.High; + break; + case 4: + default: + GlobalVars.QualityLevel = QualityLevel.Ultra; + break; } } diff --git a/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs b/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs index 6c44937..9c97086 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/ItemMaker.cs @@ -84,26 +84,25 @@ namespace NovetusLauncher void ComboBox1SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox1.SelectedIndex == 0) + switch (comboBox1.SelectedIndex) { - url = "http://www.roblox.com/asset?id="; - isWebSite = false; + case 1: + url = "http://assetgame.roblox.com/asset/?id="; + isWebSite = false; + break; + case 2: + url = "https://www.roblox.com/catalog/"; + isWebSite = true; + break; + case 3: + url = "https://www.roblox.com/library/"; + isWebSite = true; + break; + default: + url = "http://www.roblox.com/asset?id="; + isWebSite = false; + break; } - else if (comboBox1.SelectedIndex == 1) - { - url = "http://assetgame.roblox.com/asset/?id="; - isWebSite = false; - } - else if (comboBox1.SelectedIndex == 2) - { - url = "https://www.roblox.com/catalog/"; - isWebSite = true; - } - else if (comboBox1.SelectedIndex == 3) - { - url = "https://www.roblox.com/library/"; - isWebSite = true; - } } void ItemMakerLoad(object sender, EventArgs e) @@ -120,15 +119,8 @@ namespace NovetusLauncher comboBox1.SelectedItem = "http://www.roblox.com/"; isWebSite = false; - - if (GlobalVars.DisabledHelp == true) - { - checkBox1.Checked = true; - } - else if (GlobalVars.DisabledHelp == false) - { - checkBox1.Checked = false; - } + + checkBox1.Checked = GlobalVars.DisabledHelp; } void ItemMakerClose(object sender, CancelEventArgs e) @@ -138,14 +130,7 @@ namespace NovetusLauncher void CheckBox1CheckedChanged(object sender, EventArgs e) { - if (checkBox1.Checked == true) - { - GlobalVars.DisabledHelp = true; - } - else if (checkBox1.Checked == false) - { - GlobalVars.DisabledHelp = false; - } + GlobalVars.DisabledHelp = checkBox1.Checked; } } } diff --git a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.Designer.cs b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.Designer.cs index 81ad3c3..4a26a55 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.Designer.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.Designer.cs @@ -71,7 +71,7 @@ this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(260, 95); this.listBox1.TabIndex = 14; - this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); + this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_SelectedIndexChanged); // // NovetusSDK // diff --git a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs index ae6fc35..9c53e79 100644 --- a/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs +++ b/NovetusLauncher/NovetusLauncher/SDK/NovetusSDK.cs @@ -40,56 +40,50 @@ namespace NovetusLauncher private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { - if (listBox1.SelectedIndex == 0) + switch (listBox1.SelectedIndex) { - ItemMaker im = new ItemMaker(); - im.Show(); - } - else if (listBox1.SelectedIndex == 1) - { - ClientinfoEditor cie = new ClientinfoEditor(); - cie.Show(); - } - else if (listBox1.SelectedIndex == 2) - { - ClientScriptDocumentation csd = new ClientScriptDocumentation(); - csd.Show(); - } - else if (listBox1.SelectedIndex == 3) - { - AssetLocalizer al = new AssetLocalizer(); - al.Show(); - } - else if (listBox1.SelectedIndex == 4) - { - SplashTester st = new SplashTester(); - st.Show(); - } - else if (listBox1.SelectedIndex == 5) - { - Obj2MeshV1GUI obj = new Obj2MeshV1GUI(); - obj.Show(); - } - else if (listBox1.SelectedIndex == 6) - { - Process proc = new Process(); - proc.StartInfo.FileName = GlobalVars.ConfigDirData + "\\RSG.exe"; - proc.StartInfo.CreateNoWindow = false; - proc.StartInfo.UseShellExecute = false; - proc.Start(); - } - else if (listBox1.SelectedIndex == 7) - { - Process proc = new Process(); - proc.StartInfo.FileName = GlobalVars.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; - proc.StartInfo.CreateNoWindow = false; - proc.StartInfo.UseShellExecute = false; - proc.Start(); - } - else if (listBox1.SelectedIndex == 8) - { - DiogenesEditor dio = new DiogenesEditor(); - dio.Show(); + case 1: + ClientinfoEditor cie = new ClientinfoEditor(); + cie.Show(); + break; + case 2: + ClientScriptDocumentation csd = new ClientScriptDocumentation(); + csd.Show(); + break; + case 3: + AssetLocalizer al = new AssetLocalizer(); + al.Show(); + break; + case 4: + SplashTester st = new SplashTester(); + st.Show(); + break; + case 5: + Obj2MeshV1GUI obj = new Obj2MeshV1GUI(); + obj.Show(); + break; + case 6: + Process proc = new Process(); + proc.StartInfo.FileName = GlobalVars.ConfigDirData + "\\RSG.exe"; + proc.StartInfo.CreateNoWindow = false; + proc.StartInfo.UseShellExecute = false; + proc.Start(); + break; + case 7: + Process proc2 = new Process(); + proc2.StartInfo.FileName = GlobalVars.ConfigDirData + "\\Roblox_Legacy_Place_Converter.exe"; + proc2.StartInfo.CreateNoWindow = false; + proc2.StartInfo.UseShellExecute = false; + proc2.Start(); + break; + case 8: + DiogenesEditor dio = new DiogenesEditor(); + dio.Show(); + break; + default: + ItemMaker im = new ItemMaker(); + im.Show(); + break; } } } diff --git a/NovetusLauncher/NovetusURI/URI/LoaderForm.cs b/NovetusLauncher/NovetusURI/URI/LoaderForm.cs index af36a80..c854219 100644 --- a/NovetusLauncher/NovetusURI/URI/LoaderForm.cs +++ b/NovetusLauncher/NovetusURI/URI/LoaderForm.cs @@ -78,7 +78,7 @@ namespace NovetusURI handlers.requestCallback += RequestCallback; DiscordRpc.Initialize(GlobalVars.appid, ref handlers, true, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.LoadingURI, "", true); + LauncherFuncs.UpdateRichPresence(LauncherState.LoadingURI, "", true); } } @@ -118,11 +118,11 @@ namespace NovetusURI { if (!GlobalVars.SelectedClientInfo.Fix2007) { - args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptGenerator.ScriptType.Client) + quote; + args = "-script " + quote + LauncherFuncs.ChangeGameSettings() + " dofile('" + luafile + "'); " + ScriptGenerator.GetScriptFuncForType(ScriptType.Client) + quote; } else { - ScriptGenerator.GenerateScriptForClient(ScriptGenerator.ScriptType.Client); + ScriptGenerator.GenerateScriptForClient(ScriptType.Client); args = "-script " + quote + luafile + quote; } } @@ -177,14 +177,14 @@ namespace NovetusURI clientproc.Exited += new EventHandler(ClientExited); clientproc.Start(); clientproc.PriorityClass = ProcessPriorityClass.RealTime; - SecurityFuncs.RenameWindow(clientproc, ScriptGenerator.ScriptType.Client, ""); - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, ""); + SecurityFuncs.RenameWindow(clientproc, ScriptType.Client, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InMPGame, ""); this.Visible = false; } void ClientExited(object sender, EventArgs e) { - LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, ""); + LauncherFuncs.UpdateRichPresence(LauncherState.InLauncher, ""); this.Close(); }