From 2ef7260714f119e41b01b83c4aef5087aedb59f7 Mon Sep 17 00:00:00 2001 From: Bitl Date: Tue, 12 Nov 2019 19:00:56 -0700 Subject: [PATCH] error fixes. imporoved debug error detection. --- NovetusLauncher/NovetusCMD/Program.cs | 32 ++++---- NovetusLauncher/NovetusFuncs/AddonLoader.cs | 2 +- NovetusLauncher/NovetusFuncs/ClientScript.cs | 2 +- .../NovetusFuncs/CodeExtensions.cs | 4 +- NovetusLauncher/NovetusFuncs/Downloader.cs | 6 +- NovetusLauncher/NovetusFuncs/GlobalVars.cs | 9 ++ NovetusLauncher/NovetusFuncs/IconLoader.cs | 2 +- .../NovetusFuncs/RobloxXMLLocalizer.cs | 66 ++++++++++++--- NovetusLauncher/NovetusFuncs/SecurityFuncs.cs | 2 +- NovetusLauncher/NovetusFuncs/SplashReader.cs | 4 +- .../NovetusFuncs/TreeNodeHelper.cs | 2 +- NovetusLauncher/NovetusFuncs/WebServer.cs | 4 +- .../AssetLocalizer.Designer.cs | 8 +- .../NovetusLauncher/AssetLocalizer.cs | 45 ++++++++-- .../NovetusLauncher/CharacterCustomization.cs | 32 ++++---- NovetusLauncher/NovetusLauncher/ItemMaker.cs | 8 +- NovetusLauncher/NovetusLauncher/LoaderForm.cs | 4 +- NovetusLauncher/NovetusLauncher/MainForm.cs | 82 +++++++++++-------- .../NovetusLauncher/NovetusSDK.Designer.cs | 4 +- 19 files changed, 207 insertions(+), 111 deletions(-) diff --git a/NovetusLauncher/NovetusCMD/Program.cs b/NovetusLauncher/NovetusCMD/Program.cs index 82b5e15..21681dc 100644 --- a/NovetusLauncher/NovetusCMD/Program.cs +++ b/NovetusLauncher/NovetusCMD/Program.cs @@ -25,8 +25,8 @@ namespace NovetusCMD UPnP.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); } } @@ -41,8 +41,8 @@ namespace NovetusCMD UPnP.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); } } @@ -57,8 +57,8 @@ namespace NovetusCMD UPnP.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); } } @@ -75,8 +75,8 @@ namespace NovetusCMD StartUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); StartUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); } } @@ -92,8 +92,8 @@ namespace NovetusCMD StopUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); StopUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); } } @@ -107,8 +107,8 @@ namespace NovetusCMD GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.DataPath, GlobalVars.WebServer_Port); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); } } @@ -127,8 +127,8 @@ namespace NovetusCMD ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); GlobalVars.WebServer.Stop(); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); } } @@ -350,8 +350,8 @@ namespace NovetusCMD client.Start(); SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2); } } diff --git a/NovetusLauncher/NovetusFuncs/AddonLoader.cs b/NovetusLauncher/NovetusFuncs/AddonLoader.cs index 8acccc3..e2747b8 100644 --- a/NovetusLauncher/NovetusFuncs/AddonLoader.cs +++ b/NovetusLauncher/NovetusFuncs/AddonLoader.cs @@ -74,7 +74,7 @@ public class AddonLoader installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist; } } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { installOutcome = "Error when installing addon: " + ex.Message; } diff --git a/NovetusLauncher/NovetusFuncs/ClientScript.cs b/NovetusLauncher/NovetusFuncs/ClientScript.cs index 61a9391..2a1b259 100644 --- a/NovetusLauncher/NovetusFuncs/ClientScript.cs +++ b/NovetusLauncher/NovetusFuncs/ClientScript.cs @@ -105,7 +105,7 @@ public class ClientScript } else { return ""; } - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { return ""; } } diff --git a/NovetusLauncher/NovetusFuncs/CodeExtensions.cs b/NovetusLauncher/NovetusFuncs/CodeExtensions.cs index 82502bb..c0e3d35 100644 --- a/NovetusLauncher/NovetusFuncs/CodeExtensions.cs +++ b/NovetusLauncher/NovetusFuncs/CodeExtensions.cs @@ -33,9 +33,9 @@ public static class ProcessExtensions { try { Process.GetProcessById(process.Id); - } catch (InvalidOperationException) { + } catch (InvalidOperationException) when (!Env.Debugging) { return false; - } catch (ArgumentException) { + } catch (ArgumentException) when (!Env.Debugging) { return false; } return true; diff --git a/NovetusLauncher/NovetusFuncs/Downloader.cs b/NovetusLauncher/NovetusFuncs/Downloader.cs index 3fd25ef..abb4c25 100644 --- a/NovetusLauncher/NovetusFuncs/Downloader.cs +++ b/NovetusLauncher/NovetusFuncs/Downloader.cs @@ -48,7 +48,7 @@ class Downloader int read = DownloadFile(fileURL, fullpath); downloadOutcome = "File " + outputfilename + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { downloadOutcome = "Error when downloading file: " + ex.Message; } @@ -73,7 +73,7 @@ class Downloader int read = DownloadFile(fileURL, saveFileDialog1.FileName); downloadOutcome = "File " + Path.GetFileName(saveFileDialog1.FileName) + " downloaded! " + read + " bytes written! " + downloadOutcomeAddText + downloadOutcomeException; } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { downloadOutcome = "Error when downloading file: " + ex.Message; } @@ -142,7 +142,7 @@ class Downloader } } } - catch (Exception e) + catch (Exception e) when (!Env.Debugging) { downloadOutcomeException = " Exception detected: " + e.Message; } diff --git a/NovetusLauncher/NovetusFuncs/GlobalVars.cs b/NovetusLauncher/NovetusFuncs/GlobalVars.cs index bd592b8..323a034 100644 --- a/NovetusLauncher/NovetusFuncs/GlobalVars.cs +++ b/NovetusLauncher/NovetusFuncs/GlobalVars.cs @@ -11,6 +11,15 @@ using System; using System.IO; using System.Reflection; +public static class Env +{ +#if DEBUG + public static readonly bool Debugging = true; +#else + public static readonly bool Debugging = false; +#endif +} + public static class GlobalVars { public static readonly string RootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); diff --git a/NovetusLauncher/NovetusFuncs/IconLoader.cs b/NovetusLauncher/NovetusFuncs/IconLoader.cs index 3a5cf89..b087995 100644 --- a/NovetusLauncher/NovetusFuncs/IconLoader.cs +++ b/NovetusLauncher/NovetusFuncs/IconLoader.cs @@ -55,7 +55,7 @@ public class IconLoader installOutcome = "Icon " + openFileDialog1.SafeFileName + " installed!"; } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { installOutcome = "Error when installing icon: " + ex.Message; } diff --git a/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs b/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs index 4b9c3ee..af8c1c0 100644 --- a/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs +++ b/NovetusLauncher/NovetusFuncs/RobloxXMLLocalizer.cs @@ -14,7 +14,8 @@ public static class RobloxXMLLocalizer public enum DLType { //RBXL and RBXM - XML, + RBXL, + RBXM, //Items Hat, Head, @@ -39,17 +40,53 @@ public static class RobloxXMLLocalizer switch (type) { - case DLType.XML: + case DLType.RBXL: + //backup the original copy + try + { + File.Copy(path, path.Replace(".rbxl", " BAK.rbxl")); + } + catch(Exception) when (!Env.Debugging) + { + + } //meshes DownloadFromNodes(path, GlobalVars.Fonts); DownloadFromNodes(path, GlobalVars.Fonts, 1, 1, 1, 1); //skybox DownloadFromNodes(path, GlobalVars.Sky); - DownloadFromNodes(path, GlobalVars.Sky, 0, 1, 0, 0); - DownloadFromNodes(path, GlobalVars.Sky, 0, 2, 0, 0); - DownloadFromNodes(path, GlobalVars.Sky, 0, 3, 0, 0); - DownloadFromNodes(path, GlobalVars.Sky, 0, 4, 0, 0); - DownloadFromNodes(path, GlobalVars.Sky, 0, 5, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 1, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 2, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 3, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 4, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 5, 0, 0, 0); + //decal + DownloadFromNodes(path, GlobalVars.Decal); + //texture + DownloadFromNodes(path, GlobalVars.Texture); + //tools and hopperbin + DownloadFromNodes(path, GlobalVars.Tool); + DownloadFromNodes(path, GlobalVars.HopperBin); + //sound + DownloadFromNodes(path, GlobalVars.Sound); + //gui + DownloadFromNodes(path, GlobalVars.ImageLabel); + //clothing + DownloadFromNodes(path, GlobalVars.Shirt); + DownloadFromNodes(path, GlobalVars.ShirtGraphic); + DownloadFromNodes(path, GlobalVars.Pants); + break; + case DLType.RBXM: + //meshes + DownloadFromNodes(path, GlobalVars.Fonts); + DownloadFromNodes(path, GlobalVars.Fonts, 1, 1, 1, 1); + //skybox + DownloadFromNodes(path, GlobalVars.Sky); + DownloadFromNodes(path, GlobalVars.Sky, 1, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 2, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 3, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 4, 0, 0, 0); + DownloadFromNodes(path, GlobalVars.Sky, 5, 0, 0, 0); //decal DownloadFromNodes(path, GlobalVars.Decal); //texture @@ -139,17 +176,20 @@ public static class RobloxXMLLocalizer //do whatever with your value string url = item3.Value; DownloadFilesFromNode(url, outputPath, fileext); - string[] substrings = url.Split('='); - item3.Value = inGameDir + substrings[1] + fileext; + if (url.Contains('=')) + { + string[] substrings = url.Split('='); + item3.Value = inGameDir + substrings[1] + fileext; + } } } } } } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { - MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { @@ -171,9 +211,9 @@ public static class RobloxXMLLocalizer { download.InitDownload(path, fileext); } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { - MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } diff --git a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs b/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs index cb18711..292669d 100644 --- a/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs +++ b/NovetusLauncher/NovetusFuncs/SecurityFuncs.cs @@ -193,7 +193,7 @@ public class SecurityFuncs { ipAddress = wc.DownloadString("http://ipv4.icanhazip.com/"); } - catch (Exception) + catch (Exception) when (!Env.Debugging) { ipAddress = "localhost" + Environment.NewLine; } diff --git a/NovetusLauncher/NovetusFuncs/SplashReader.cs b/NovetusLauncher/NovetusFuncs/SplashReader.cs index cbdb7e9..92fefa7 100644 --- a/NovetusLauncher/NovetusFuncs/SplashReader.cs +++ b/NovetusLauncher/NovetusFuncs/SplashReader.cs @@ -19,10 +19,10 @@ public static class SplashReader try { splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)]; - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { try { splash = splashes[0]; - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { splash = "missingno"; return splash; } diff --git a/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs b/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs index e2ab67f..9419350 100644 --- a/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs +++ b/NovetusLauncher/NovetusFuncs/TreeNodeHelper.cs @@ -59,7 +59,7 @@ public static class TreeNodeHelper } else { return ""; } - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { return ""; } } diff --git a/NovetusLauncher/NovetusFuncs/WebServer.cs b/NovetusLauncher/NovetusFuncs/WebServer.cs index a1d167a..e1932f0 100644 --- a/NovetusLauncher/NovetusFuncs/WebServer.cs +++ b/NovetusLauncher/NovetusFuncs/WebServer.cs @@ -149,7 +149,7 @@ public class SimpleHTTPServer try { HttpListenerContext context = _listener.GetContext(); Process(context); - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { } } @@ -221,7 +221,7 @@ public class SimpleHTTPServer context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Flush(); } - } catch (Exception) { + } catch (Exception) when (!Env.Debugging) { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; } diff --git a/NovetusLauncher/NovetusLauncher/AssetLocalizer.Designer.cs b/NovetusLauncher/NovetusLauncher/AssetLocalizer.Designer.cs index b72bb4f..6191694 100644 --- a/NovetusLauncher/NovetusLauncher/AssetLocalizer.Designer.cs +++ b/NovetusLauncher/NovetusLauncher/AssetLocalizer.Designer.cs @@ -48,7 +48,8 @@ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; this.comboBox1.Items.AddRange(new object[] { - "RBXL/RBXM", + "RBXL", + "RBXM", "Hat", "Head", "Face", @@ -61,7 +62,7 @@ this.comboBox1.TabIndex = 1; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // - // PlaceLocalizer + // AssetLocalizer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -71,8 +72,9 @@ this.Controls.Add(this.button1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "PlaceLocalizer"; + this.Name = "AssetLocalizer"; this.Text = "Novetus Asset Localizer"; + this.Load += new System.EventHandler(this.AssetLocalizer_Load); this.ResumeLayout(false); } diff --git a/NovetusLauncher/NovetusLauncher/AssetLocalizer.cs b/NovetusLauncher/NovetusLauncher/AssetLocalizer.cs index 319c262..83cfb8c 100644 --- a/NovetusLauncher/NovetusLauncher/AssetLocalizer.cs +++ b/NovetusLauncher/NovetusLauncher/AssetLocalizer.cs @@ -25,9 +25,9 @@ namespace NovetusLauncher { RobloxXMLLocalizer.LoadRBXFile(currentType); } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { - MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset Localizer | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -35,32 +35,61 @@ namespace NovetusLauncher { if (comboBox1.SelectedIndex == 0) { - currentType = RobloxXMLLocalizer.DLType.XML; + currentType = RobloxXMLLocalizer.DLType.RBXL; } else if (comboBox1.SelectedIndex == 1) { - currentType = RobloxXMLLocalizer.DLType.Hat; + currentType = RobloxXMLLocalizer.DLType.RBXM; } else if (comboBox1.SelectedIndex == 2) { - currentType = RobloxXMLLocalizer.DLType.Head; + currentType = RobloxXMLLocalizer.DLType.Hat; } else if (comboBox1.SelectedIndex == 3) { - currentType = RobloxXMLLocalizer.DLType.Face; + currentType = RobloxXMLLocalizer.DLType.Head; } else if (comboBox1.SelectedIndex == 4) { - currentType = RobloxXMLLocalizer.DLType.TShirt; + currentType = RobloxXMLLocalizer.DLType.Face; } else if (comboBox1.SelectedIndex == 5) { - currentType = RobloxXMLLocalizer.DLType.Shirt; + currentType = RobloxXMLLocalizer.DLType.TShirt; } else if (comboBox1.SelectedIndex == 6) + { + currentType = RobloxXMLLocalizer.DLType.Shirt; + } + else if (comboBox1.SelectedIndex == 7) { currentType = RobloxXMLLocalizer.DLType.Pants; } } + + private void AssetLocalizer_Load(object sender, EventArgs e) + { + comboBox1.SelectedItem = "RBXL"; + + if (!System.IO.Directory.Exists(GlobalVars.AssetCacheDirFonts)) + { + System.IO.Directory.CreateDirectory(GlobalVars.AssetCacheDirFonts); + } + + if (!System.IO.Directory.Exists(GlobalVars.AssetCacheDirSky)) + { + System.IO.Directory.CreateDirectory(GlobalVars.AssetCacheDirSky); + } + + if (!System.IO.Directory.Exists(GlobalVars.AssetCacheDirSounds)) + { + System.IO.Directory.CreateDirectory(GlobalVars.AssetCacheDirSounds); + } + + if (!System.IO.Directory.Exists(GlobalVars.AssetCacheDirTexturesGUI)) + { + System.IO.Directory.CreateDirectory(GlobalVars.AssetCacheDirTexturesGUI); + } + } } } diff --git a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs index 85ecdd6..70ceccf 100644 --- a/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs +++ b/NovetusLauncher/NovetusLauncher/CharacterCustomization.cs @@ -174,7 +174,7 @@ namespace NovetusLauncher Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\icons\\" + GlobalVars.PlayerName + ".png"); pictureBox10.Image = icon1; } - catch (Exception) + catch (Exception) when (!Env.Debugging) { Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; @@ -431,8 +431,8 @@ namespace NovetusLauncher Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); pictureBox9.Image = icon1; } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { if (Directory.Exists(GlobalVars.hatdir)) { Image icon1 = LauncherFuncs.LoadImage(GlobalVars.hatdir + "\\" + GlobalVars.Custom_Extra.Replace(".rbxm", "") + ".png"); @@ -1086,8 +1086,8 @@ namespace NovetusLauncher client.StartInfo.Arguments = args; client.Start(); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { DialogResult result2 = MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -1135,8 +1135,8 @@ namespace NovetusLauncher pictureBox9.Image = icon1; GlobalVars.Custom_Extra_SelectionIsHat = false; } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { if (Directory.Exists(GlobalVars.hatdir)) { GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); @@ -1162,8 +1162,8 @@ namespace NovetusLauncher pictureBox9.Image = icon1; GlobalVars.Custom_Extra_SelectionIsHat = false; } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { if (Directory.Exists(GlobalVars.hatdir)) { GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); @@ -1187,8 +1187,8 @@ namespace NovetusLauncher pictureBox9.Image = icon1; GlobalVars.Custom_Extra_SelectionIsHat = false; } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { if (Directory.Exists(GlobalVars.hatdir)) { GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); @@ -1254,8 +1254,8 @@ namespace NovetusLauncher pictureBox9.Image = icon1; GlobalVars.Custom_Extra_SelectionIsHat = false; } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { if (Directory.Exists(GlobalVars.hatdir)) { GlobalVars.Custom_Extra = listBox9.SelectedItem.ToString(); @@ -1274,7 +1274,7 @@ namespace NovetusLauncher { icon.LoadImage(); } - catch (Exception) + catch (Exception) when (!Env.Debugging) { } @@ -1288,7 +1288,7 @@ namespace NovetusLauncher Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\icons\\" + GlobalVars.PlayerName + ".png"); pictureBox10.Image = icon1; } - catch (Exception) + catch (Exception) when (!Env.Debugging) { Image icon1 = LauncherFuncs.LoadImage(GlobalVars.extradir + "\\NoExtra.png"); pictureBox10.Image = icon1; @@ -1383,7 +1383,7 @@ namespace NovetusLauncher GlobalVars.CharacterID = ""; } } - catch(Exception ex) + catch(Exception ex) when (!Env.Debugging) { MessageBox.Show("Could not generate charapp. Error: " + ex.Message); textBox1.Text = ""; diff --git a/NovetusLauncher/NovetusLauncher/ItemMaker.cs b/NovetusLauncher/NovetusLauncher/ItemMaker.cs index 1c1d9a8..df241dc 100644 --- a/NovetusLauncher/NovetusLauncher/ItemMaker.cs +++ b/NovetusLauncher/NovetusLauncher/ItemMaker.cs @@ -55,7 +55,7 @@ namespace NovetusLauncher string helptext = "In order for the item to work in Novetus, you'll need to find an icon for your item (it must be a .png file), then name it the same name as your item.\n\nIf you want to create a local (offline) item, you'll have to download the meshes/textures from the links in the rbxm file, then replace the links in the file pointing to where they are using rbxasset://. Look at the directory in the 'shareddata/charcustom' folder that best suits your item type, then look at the rbxm for any one of the items. If you get a corrupted file, change the URL using the drop down box."; download.InitDownload((!GlobalVars.DisabledHelp) ? helptext : ""); } - catch (Exception ex) + catch (Exception ex) when (!Env.Debugging) { MessageBox.Show("Error: Unable to download the file. " +ex.Message, "Novetus Item SDK | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -76,8 +76,8 @@ namespace NovetusLauncher } } } - catch(Exception) - { + catch(Exception) when (!Env.Debugging) + { MessageBox.Show("Error: Unable to download the file. Try using a different file name or ID.","Novetus Item SDK | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -118,7 +118,7 @@ namespace NovetusLauncher LauncherFuncs.ReadConfigValues(cfgpath); } - comboBox1.SelectedIndex = 0; + comboBox1.SelectedItem = "http://www.roblox.com/"; isWebSite = false; if (GlobalVars.DisabledHelp == true) diff --git a/NovetusLauncher/NovetusLauncher/LoaderForm.cs b/NovetusLauncher/NovetusLauncher/LoaderForm.cs index 397204e..0835b5c 100644 --- a/NovetusLauncher/NovetusLauncher/LoaderForm.cs +++ b/NovetusLauncher/NovetusLauncher/LoaderForm.cs @@ -124,8 +124,8 @@ namespace NovetusLauncher LaunchClient(rbxexe,args); } } - catch (Exception) - { + catch (Exception) when (!Env.Debugging) + { label1.Text = "The client has been detected as modified."; } } diff --git a/NovetusLauncher/NovetusLauncher/MainForm.cs b/NovetusLauncher/NovetusLauncher/MainForm.cs index e7c7cec..240cbb8 100644 --- a/NovetusLauncher/NovetusLauncher/MainForm.cs +++ b/NovetusLauncher/NovetusLauncher/MainForm.cs @@ -48,8 +48,8 @@ namespace NovetusLauncher UPnP.InitUPnP(DeviceFound,DeviceLost); ConsolePrint("UPnP: Service initialized", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); } } @@ -64,8 +64,8 @@ namespace NovetusLauncher UPnP.StartUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); } } @@ -80,8 +80,8 @@ namespace NovetusLauncher UPnP.StopUPnP(device,protocol,port); ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); } } @@ -98,8 +98,8 @@ namespace NovetusLauncher StartUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); StartUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); } } @@ -115,8 +115,8 @@ namespace NovetusLauncher StopUPnP(device, Protocol.Udp, GlobalVars.WebServer_Port); StopUPnP(device, Protocol.Tcp, GlobalVars.WebServer_Port); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); } } @@ -176,8 +176,8 @@ namespace NovetusLauncher GlobalVars.WebServer = new SimpleHTTPServer(GlobalVars.DataPath, GlobalVars.WebServer_Port); ConsolePrint("WebServer: Server is running on port: " + GlobalVars.WebServer.Port.ToString(), 3); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Failed to launch WebServer. Some features may not function. (" + ex.Message + ")", 2); label17.Visible = false; } @@ -198,8 +198,8 @@ namespace NovetusLauncher ConsolePrint("WebServer: Server has stopped on port: " + GlobalVars.WebServer.Port.ToString(), 2); GlobalVars.WebServer.Stop(); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Failed to stop WebServer. Some features may not function. (" + ex.Message + ")", 2); } } @@ -831,8 +831,8 @@ namespace NovetusLauncher OpenClient(rbxexe,args); } } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2); DialogResult result2 = MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -921,8 +921,8 @@ namespace NovetusLauncher GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Solo Game"; DiscordRpc.UpdatePresence(ref GlobalVars.presence); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2); DialogResult result2 = MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -987,8 +987,8 @@ namespace NovetusLauncher client.Start(); SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2); DialogResult result2 = MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1057,8 +1057,8 @@ namespace NovetusLauncher GlobalVars.presence.largeImageText = GlobalVars.PlayerName + " | In " + GlobalVars.SelectedClient + " Studio"; DiscordRpc.UpdatePresence(ref GlobalVars.presence); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 2 - Failed to launch Novetus. (" + ex.Message + ")", 2); DialogResult result2 = MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1170,7 +1170,15 @@ namespace NovetusLauncher { LoadItemSDK(); } - else if (string.Compare(command,"charcustom",true, CultureInfo.InvariantCulture) == 0) + else if (string.Compare(command, "assetlocalizer", true, CultureInfo.InvariantCulture) == 0) + { + LoadAssetLocalizer(); + } + else if (string.Compare(command, "sdk assetlocalizer", true, CultureInfo.InvariantCulture) == 0) + { + LoadAssetLocalizer(); + } + else if (string.Compare(command,"charcustom",true, CultureInfo.InvariantCulture) == 0) { CharacterCustomization cc = new CharacterCustomization(); cc.Show(); @@ -1210,8 +1218,8 @@ namespace NovetusLauncher StopWebServer(); StartWebServer(); } - catch(Exception ex) - { + catch(Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); } } @@ -1245,8 +1253,8 @@ namespace NovetusLauncher StopWebServer(); StartWebServer(); } - catch(Exception ex) - { + catch(Exception ex) when (!Env.Debugging) + { ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2); } } @@ -1276,6 +1284,13 @@ namespace NovetusLauncher ConsolePrint("Novetus Client SDK Loaded.", 4); } + void LoadAssetLocalizer() + { + AssetLocalizer al = new AssetLocalizer(); + al.Show(); + ConsolePrint("Novetus Asset Localizer Loaded.", 4); + } + void LoadLauncher() { NovetusSDK im = new NovetusSDK(); @@ -1300,7 +1315,8 @@ namespace NovetusLauncher ConsolePrint("-- sdk | Launches the Novetus SDK Launcher", 4); ConsolePrint("= clientinfo | Launches the Novetus Client SDK", 4); ConsolePrint("= itemmaker | Launches the Novetus Item SDK", 4); - } + ConsolePrint("= assetlocalizer | Launches the Novetus Asset Localizer", 4); + } else if (page == 3) { ConsolePrint("Help: webserver", 3); @@ -1323,7 +1339,8 @@ namespace NovetusLauncher ConsolePrint("-- sdk | Launches the Novetus SDK Launcher", 4); ConsolePrint("-- clientinfo | Launches the Novetus Client SDK", 4); ConsolePrint("-- itemmaker | Launches the Novetus Item SDK", 4); - ConsolePrint("---------", 1); + ConsolePrint("-- assetlocalizer | Launches the Novetus Asset Localizer", 4); + ConsolePrint("---------", 1); ConsolePrint("= config", 3); ConsolePrint("-- save | Saves the config file", 4); ConsolePrint("-- load | Reloads the config file", 4); @@ -1348,8 +1365,8 @@ namespace NovetusLauncher ConsolePrint("URI Successfully Installed!", 3); DialogResult result1 = MessageBox.Show("URI Successfully Installed!","Novetus - Install URI", MessageBoxButtons.OK, MessageBoxIcon.Information); } - catch (Exception ex) - { + catch (Exception ex) when (!Env.Debugging) + { ConsolePrint("ERROR 5 - Failed to install URI. (" + ex.Message + ")", 2); DialogResult result2 = MessageBox.Show("Failed to install URI. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1446,7 +1463,6 @@ namespace NovetusLauncher void Button6Click(object sender, EventArgs e) { - DialogResult result = MessageBox.Show("If you want to install a place into a folder, add the name of the folder as a prefix with a '-' seperator to your map's name. (Ex. [2008 - ]Thrillvile) If you want to put your place in the roor maps folder, remove ANY prefix in the map's name if it has any. Maps won't load in the root folder if they have a prefix. Maps with a prefix that's different from the folder's name will not load as well.","Novetus - Open Maps Folder", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.Cancel) return; @@ -1495,7 +1511,7 @@ namespace NovetusLauncher ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 3); } } - catch (Exception) + catch (Exception) when (!Env.Debugging) { if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome())) { diff --git a/NovetusLauncher/NovetusLauncher/NovetusSDK.Designer.cs b/NovetusLauncher/NovetusLauncher/NovetusSDK.Designer.cs index 42a64ae..d465b31 100644 --- a/NovetusLauncher/NovetusLauncher/NovetusSDK.Designer.cs +++ b/NovetusLauncher/NovetusLauncher/NovetusSDK.Designer.cs @@ -47,7 +47,7 @@ // // label1 // - this.label1.Location = new System.Drawing.Point(12, 194); + this.label1.Location = new System.Drawing.Point(12, 168); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(260, 16); this.label1.TabIndex = 12; @@ -73,7 +73,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.ClientSize = new System.Drawing.Size(284, 219); + this.ClientSize = new System.Drawing.Size(284, 193); this.Controls.Add(this.listBox1); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox2);