1.3 pre-release 4 commit

This commit is contained in:
Bitl 2021-09-12 18:38:58 -07:00
parent 2b9b914539
commit a9732201f5
25 changed files with 273 additions and 199 deletions

View File

@ -1,10 +1,5 @@
#region Usings #region Usings
using NLog;
using System; using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -13,77 +8,12 @@ namespace Novetus.ClientScriptTester
#region ClientScript Tester #region ClientScript Tester
static class ClientScriptTester static class ClientScriptTester
{ {
#region Exeption Helpers
//https://github.com/AlexMelw/EasySharp/blob/master/NHelpers/ExceptionsDealing/Extensions/ExceptionExtensions.cs
/// <summary>
/// Gets the entire stack trace consisting of exception's footprints (File, Method, LineNumber)
/// </summary>
/// <param name="exception">Source <see cref="Exception" /></param>
/// <returns>
/// <see cref="string" /> that represents the entire stack trace consisting of exception's footprints (File,
/// Method, LineNumber)
/// </returns>
public static string GetExceptionFootprints(this Exception exception)
{
StackTrace stackTrace = new StackTrace(exception, true);
StackFrame[] frames = stackTrace.GetFrames();
if (ReferenceEquals(frames, null))
{
return string.Empty;
}
var traceStringBuilder = new StringBuilder();
for (var i = 0; i < frames.Length; i++)
{
StackFrame frame = frames[i];
if (frame.GetFileLineNumber() < 1)
continue;
traceStringBuilder.AppendLine($"File: {frame.GetFileName()}");
traceStringBuilder.AppendLine($"Method: {frame.GetMethod().Name}");
traceStringBuilder.AppendLine($"LineNumber: {frame.GetFileLineNumber()}");
if (i == frames.Length - 1)
break;
traceStringBuilder.AppendLine(" ---> ");
}
string stackTraceFootprints = traceStringBuilder.ToString();
if (string.IsNullOrWhiteSpace(stackTraceFootprints))
return "NO DETECTED FOOTPRINTS";
return stackTraceFootprints;
}
#endregion
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
var config = new NLog.Config.LoggingConfiguration();
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = Assembly.GetExecutingAssembly().Location + "\\Tester-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
LogManager.Configuration = config;
//https://stackify.com/csharp-catch-all-exceptions/
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
Logger log = LogManager.GetCurrentClassLogger();
log.Error("EXEPTION THROWN: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.Message) ? eventArgs.Exception.Message : "N/A"));
log.Error("EXCEPTION INFO: " + (eventArgs.Exception != null ? eventArgs.Exception.ToString() : "N/A"));
log.Error("INNER EXCEPTION: " + (eventArgs.Exception.InnerException != null ? eventArgs.Exception.InnerException.ToString() : "N/A"));
log.Error("STACK TRACE: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.StackTrace) ? eventArgs.Exception.StackTrace : "N/A"));
log.Error("TARGET SITE: " + (eventArgs.Exception.TargetSite != null ? eventArgs.Exception.TargetSite.ToString() : "N/A"));
log.Error("FOOTPRINTS: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.GetExceptionFootprints()) ? eventArgs.Exception.GetExceptionFootprints() : "N/A"));
};
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);

View File

@ -34,9 +34,6 @@
<ApplicationIcon>NovetusIcon.ico</ApplicationIcon> <ApplicationIcon>NovetusIcon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.2\lib\net40-client\NLog.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -76,7 +73,6 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.2" targetFramework="net40" />
</packages>

View File

@ -5,6 +5,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using NLog; using NLog;
using System.Threading;
#endregion #endregion
namespace NovetusCMD namespace NovetusCMD
@ -25,6 +26,7 @@ namespace NovetusCMD
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2); GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
GlobalFuncs.LogExceptions(ex);
} }
} }
} }
@ -42,7 +44,8 @@ namespace NovetusCMD
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2); GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2);
} GlobalFuncs.LogExceptions(ex);
}
} }
} }
@ -59,7 +62,8 @@ namespace NovetusCMD
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2); GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2);
} GlobalFuncs.LogExceptions(ex);
}
} }
} }
@ -76,7 +80,8 @@ namespace NovetusCMD
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2); GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2);
} GlobalFuncs.LogExceptions(ex);
}
} }
private static void DeviceLost(object sender, DeviceEventArgs args) private static void DeviceLost(object sender, DeviceEventArgs args)
@ -92,7 +97,8 @@ namespace NovetusCMD
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2); GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2);
} GlobalFuncs.LogExceptions(ex);
}
} }
#endregion #endregion
@ -120,18 +126,6 @@ namespace NovetusCMD
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile); config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
LogManager.Configuration = config; LogManager.Configuration = config;
//https://stackify.com/csharp-catch-all-exceptions/
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
Logger log = LogManager.GetCurrentClassLogger();
log.Error("EXEPTION THROWN: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.Message) ? eventArgs.Exception.Message : "N/A"));
log.Error("EXCEPTION INFO: " + (eventArgs.Exception != null ? eventArgs.Exception.ToString() : "N/A"));
log.Error("INNER EXCEPTION: " + (eventArgs.Exception.InnerException != null ? eventArgs.Exception.InnerException.ToString() : "N/A"));
log.Error("STACK TRACE: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.StackTrace) ? eventArgs.Exception.StackTrace : "N/A"));
log.Error("TARGET SITE: " + (eventArgs.Exception.TargetSite != null ? eventArgs.Exception.TargetSite.ToString() : "N/A"));
log.Error("FOOTPRINTS: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.GetExceptionFootprints()) ? eventArgs.Exception.GetExceptionFootprints() : "N/A"));
};
LoadCMDArgs(args); LoadCMDArgs(args);
if (!LocalVars.PrintHelp) if (!LocalVars.PrintHelp)
@ -175,8 +169,8 @@ namespace NovetusCMD
LocalFuncs.CommandInfo(); LocalFuncs.CommandInfo();
} }
Console.ReadKey(); Console.ReadKey();
} }
static void ProgramClose(object sender, EventArgs e) static void ProgramClose(object sender, EventArgs e)
{ {

View File

@ -58,8 +58,9 @@ class CharacterCustomizationShared
goto Failure; goto Failure;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
goto Failure; goto Failure;
} }
@ -671,8 +672,9 @@ class CharacterCustomizationShared
{ {
box.SelectedItem = item; box.SelectedItem = item;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
box.SelectedItem = defaultitem + ".rbxm"; box.SelectedItem = defaultitem + ".rbxm";
} }
@ -724,8 +726,9 @@ class CharacterCustomizationShared
{ {
GlobalFuncs.ChangeGameSettings("2011E"); GlobalFuncs.ChangeGameSettings("2011E");
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
string luafile = "rbxasset://scripts\\\\CSView.lua"; string luafile = "rbxasset://scripts\\\\CSView.lua";
string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl";
@ -743,6 +746,7 @@ class CharacterCustomizationShared
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalFuncs.LogExceptions(ex);
} }
} }
#endregion #endregion

View File

@ -812,8 +812,9 @@ public partial class CharacterCustomizationCompact : Form
{ {
icon.LoadImage(); icon.LoadImage();
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome())) if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))

View File

@ -815,8 +815,9 @@ public partial class CharacterCustomizationExtended : Form
{ {
icon.LoadImage(); icon.LoadImage();
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome())) if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))

View File

@ -56,6 +56,9 @@ public class IconLoader
catch (Exception ex) catch (Exception ex)
{ {
installOutcome = "Error when installing icon: " + ex.Message; installOutcome = "Error when installing icon: " + ex.Message;
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
} }
} }
} }

View File

@ -57,9 +57,12 @@ public class INIFile
255, this.path); 255, this.path);
return temp.ToString(); return temp.ToString();
} }
catch (Exception) catch (Exception ex)
{ {
IniWriteValue(Section, Key, DefaultValue); IniWriteValue(Section, Key, DefaultValue);
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return IniReadValue(Section, Key); return IniReadValue(Section, Key);
} }
} }

View File

@ -1,5 +1,5 @@
#region Usings #region Usings
#if LAUNCHER || CMD #if LAUNCHER || CMD || URI
using NLog; using NLog;
#endif #endif
using System; using System;
@ -11,6 +11,7 @@ using System.IO;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
@ -100,8 +101,11 @@ public class GlobalFuncs
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
ReadInfoFile(infopath, other); ReadInfoFile(infopath, other);
} }
} }
@ -237,8 +241,11 @@ public class GlobalFuncs
GlobalVars.UserConfiguration.ServerBrowserServerAddress = SB_Address; GlobalVars.UserConfiguration.ServerBrowserServerAddress = SB_Address;
GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)Convert.ToInt32(priority); GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)Convert.ToInt32(priority);
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
Config(cfgpath, true); Config(cfgpath, true);
} }
} }
@ -374,8 +381,11 @@ public class GlobalFuncs
GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat); GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat);
GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra); GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra);
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
Customization(cfgpath, true); Customization(cfgpath, true);
} }
} }
@ -491,8 +501,11 @@ public class GlobalFuncs
break; break;
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
ReShadeValues(cfgpath, true, setglobals); ReShadeValues(cfgpath, true, setglobals);
} }
} }
@ -631,8 +644,11 @@ public class GlobalFuncs
image.SetPropertyItem(item); image.SetPropertyItem(item);
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
if (!string.IsNullOrWhiteSpace(fallbackFileFullName)) if (!string.IsNullOrWhiteSpace(fallbackFileFullName))
image = LoadImage(fallbackFileFullName); image = LoadImage(fallbackFileFullName);
} }
@ -1162,8 +1178,11 @@ public class GlobalFuncs
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
return; return;
} }
} }
@ -1249,8 +1268,11 @@ public class GlobalFuncs
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)); fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
doc = XDocument.Parse(fixedfile); doc = XDocument.Parse(fixedfile);
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
return; return;
} }
@ -1293,8 +1315,11 @@ public class GlobalFuncs
RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token); RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token);
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
return; return;
} }
finally finally
@ -1307,8 +1332,11 @@ public class GlobalFuncs
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
return; return;
} }
} }
@ -1529,6 +1557,9 @@ public class GlobalFuncs
#if URI || LAUNCHER #if URI || LAUNCHER
MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif #endif
} }
} }
@ -1557,7 +1588,7 @@ public class GlobalFuncs
} }
#if LAUNCHER #if LAUNCHER
public static void ConsolePrint(string text, int type, RichTextBox box) public static void ConsolePrint(string text, int type, RichTextBox box, bool noLog = false)
{ {
if (box == null) if (box == null)
return; return;
@ -1570,28 +1601,34 @@ public class GlobalFuncs
{ {
case 2: case 2:
box.AppendText(text, Color.Red); box.AppendText(text, Color.Red);
log.Error(text); if (!noLog)
log.Error(text);
break; break;
case 3: case 3:
box.AppendText(text, Color.Lime); box.AppendText(text, Color.Lime);
log.Info(text); if (!noLog)
log.Info(text);
break; break;
case 4: case 4:
box.AppendText(text, Color.Aqua); box.AppendText(text, Color.Aqua);
log.Info(text); if (!noLog)
log.Info(text);
break; break;
case 5: case 5:
box.AppendText(text, Color.Yellow); box.AppendText(text, Color.Yellow);
log.Warn(text); if (!noLog)
log.Warn(text);
break; break;
case 6: case 6:
box.AppendText(text, Color.LightSalmon); box.AppendText(text, Color.LightSalmon);
log.Info(text); if (!noLog)
log.Info(text);
break; break;
case 1: case 1:
default: default:
box.AppendText(text, Color.White); box.AppendText(text, Color.White);
log.Info(text); if (!noLog)
log.Info(text);
break; break;
} }
@ -1801,9 +1838,12 @@ public class GlobalFuncs
} }
} }
catch (Exception /* TODO: catch correct exception */) catch (Exception ex/* TODO: catch correct exception */)
{ {
// Swallow. Gulp! // Swallow. Gulp!
#if URI || LAUNCHER || CMD
LogExceptions(ex);
#endif
} }
} }
@ -1820,5 +1860,14 @@ public class GlobalFuncs
File.Move(path, pathWithoutFilename + "\\" + fileName); File.Move(path, pathWithoutFilename + "\\" + fileName);
} }
#if LAUNCHER || CMD || URI
public static void LogExceptions(Exception ex)
{
Logger log = LogManager.GetCurrentClassLogger();
log.Error("EXCEPTION|MESSAGE: " + (ex.Message != null ? ex.Message.ToString() : "N/A"));
log.Error("EXCEPTION|STACK TRACE: " + (!string.IsNullOrWhiteSpace(ex.StackTrace) ? ex.StackTrace : "N/A"));
}
#endif
} }
#endregion #endregion

View File

@ -141,8 +141,11 @@ public class ScriptFuncs
string result = code.Substring(pFrom, pTo - pFrom); string result = code.Substring(pFrom, pTo - pFrom);
return result; return result;
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return "%donothing%"; return "%donothing%";
} }
} }
@ -250,8 +253,11 @@ public class ScriptFuncs
return source; return source;
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return source; return source;
} }
} }

View File

@ -259,9 +259,12 @@ public class SecurityFuncs
string[] a3 = a2.Split('<'); string[] a3 = a2.Split('<');
ipAddress = a3[0]; ipAddress = a3[0];
} }
catch (Exception) catch (Exception ex)
{ {
ipAddress = "localhost"; #if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
ipAddress = "localhost";
} }
return ipAddress; return ipAddress;

View File

@ -62,8 +62,11 @@ public static class TreeNodeHelper
return ""; return "";
} }
} }
catch (Exception) catch (Exception ex)
{ {
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return ""; return "";
} }
} }

View File

@ -4,6 +4,9 @@ using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -13,9 +16,14 @@ public class AddonLoader
private readonly OpenFileDialog openFileDialog1; private readonly OpenFileDialog openFileDialog1;
private string installOutcome = ""; private string installOutcome = "";
private int fileListDisplay = 0; private int fileListDisplay = 0;
private RichTextBox consoleBox;
private CancellationTokenSource tokenSource;
private int pastPercentage = 0;
public AddonLoader() public AddonLoader(RichTextBox box)
{ {
Application.ApplicationExit += new EventHandler(OnApplicationExit);
consoleBox = box;
openFileDialog1 = new OpenFileDialog() openFileDialog1 = new OpenFileDialog()
{ {
FileName = "Select an addon .zip file", FileName = "Select an addon .zip file",
@ -39,32 +47,44 @@ public class AddonLoader
fileListDisplay = number; fileListDisplay = number;
} }
public void LoadAddon() public async Task LoadAddon()
{ {
if (openFileDialog1.ShowDialog() == DialogResult.OK) if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ {
MessageBox.Show("Your addon is loading. You will recieve a notification when it is installed. Please keep the launcher open. You can see the installation progress in the Console.", "Novetus - Addon Loading");
try try
{ {
int filecount = 0; int filecount = 0;
StringBuilder filelistbuilder = new StringBuilder(); StringBuilder filelistbuilder = new StringBuilder();
StringBuilder filelistcutdown = new StringBuilder();
using (Stream str = openFileDialog1.OpenFile()) using (Stream str = openFileDialog1.OpenFile())
{ {
using (var zipFile = ZipFile.Read(str)) using (var zipFile = ZipFile.Read(str))
{ {
zipFile.ExtractProgress += ExtractProgress;
ZipEntry[] entries = zipFile.Entries.ToArray(); ZipEntry[] entries = zipFile.Entries.ToArray();
foreach (ZipEntry entry in entries) foreach (ZipEntry entry in entries)
{ {
filelistbuilder.Append(!entry.IsDirectory ? (entry.FileName + " (" + entry.UncompressedSize + " KB)" + Environment.NewLine) : ""); filelistbuilder.Append(!entry.IsDirectory ? (entry.FileName + " (" + entry.UncompressedSize + " KB)" + Environment.NewLine) : "");
if (filecount < fileListDisplay)
{
filelistcutdown.Append(!entry.IsDirectory ? (entry.FileName + " (" + entry.UncompressedSize + " KB)" + Environment.NewLine) : "");
}
if (!entry.IsDirectory) if (!entry.IsDirectory)
{ {
filecount++; filecount++;
} }
} }
zipFile.ExtractAll(GlobalPaths.BasePath, ExtractExistingFileAction.OverwriteSilently); tokenSource = new CancellationTokenSource();
var token = tokenSource.Token;
await Task.Factory.StartNew(() => zipFile.ExtractAll(GlobalPaths.BasePath, ExtractExistingFileAction.OverwriteSilently), token);
zipFile.Dispose();
} }
} }
@ -72,7 +92,7 @@ public class AddonLoader
if (filecount > fileListDisplay) if (filecount > fileListDisplay)
{ {
installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelist + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!"; installOutcome = "Addon " + openFileDialog1.SafeFileName + " installed! " + filecount + " files copied!" + Environment.NewLine + "Files added/modified:" + Environment.NewLine + Environment.NewLine + filelistcutdown + Environment.NewLine + "and " + (filecount - fileListDisplay) + " more files!";
} }
else else
{ {
@ -81,9 +101,39 @@ public class AddonLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
installOutcome = "Error when installing addon: " + ex.Message; installOutcome = "Error when installing addon: " + ex.Message;
} }
} }
} }
//https://stackoverflow.com/questions/38948801/dotnetzip-display-progress-of-extraction
void ExtractProgress(object sender, ExtractProgressEventArgs e)
{
if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
{
double percentage = Math.Round(e.BytesTransferred / (0.01 * e.TotalBytesToTransfer), 2);
int intPercent = Convert.ToInt32(percentage);
if (intPercent % 25 == 0 && pastPercentage != intPercent)
{
GlobalFuncs.ConsolePrint("AddonLoader - Extracting: "
+ e.CurrentEntry.FileName + ". Progress: "
+ e.BytesTransferred + "/" + e.TotalBytesToTransfer
+ " (" + intPercent + "%)", 3, consoleBox, true);
pastPercentage = intPercent;
}
}
else if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
{
GlobalFuncs.ConsolePrint("AddonLoader - Extracting: " + e.CurrentEntry.FileName, 3, consoleBox);
}
}
public void OnApplicationExit(object sender, EventArgs e)
{
tokenSource.Cancel();
}
} }
#endregion #endregion

View File

@ -18,14 +18,17 @@ public static class SplashReader
{ {
splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)]; splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)];
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
try try
{ {
splash = splashes[0]; splash = splashes[0];
} }
catch (Exception) catch (Exception ex2)
{ {
GlobalFuncs.LogExceptions(ex2);
splash = "missingno"; splash = "missingno";
return splash; return splash;
} }

View File

@ -104,6 +104,7 @@ class Downloader
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
downloadOutcome = "Error when downloading file: " + ex.Message; downloadOutcome = "Error when downloading file: " + ex.Message;
} }
} }
@ -180,6 +181,7 @@ class Downloader
} }
catch (Exception e) catch (Exception e)
{ {
GlobalFuncs.LogExceptions(e);
if (e is WebException && bytesProcessed == 0) if (e is WebException && bytesProcessed == 0)
{ {
WebException ex = (WebException)e; WebException ex = (WebException)e;

View File

@ -61,8 +61,9 @@ namespace NovetusLauncher
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)); fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
doc = XDocument.Parse(fixedfile); doc = XDocument.Parse(fixedfile);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
return; return;
} }
@ -73,8 +74,9 @@ namespace NovetusLauncher
MeshDetail = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float)); MeshDetail = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxMeshDetail", XMLTypes.Float));
GraphicsMeshQuality.Value = MeshDetail; GraphicsMeshQuality.Value = MeshDetail;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsMeshQuality.Enabled = false; GraphicsMeshQuality.Enabled = false;
} }
@ -83,8 +85,9 @@ namespace NovetusLauncher
ShadingQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float)); ShadingQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "maxShadingQuality", XMLTypes.Float));
GraphicsShadingQuality.Value = ShadingQuality; GraphicsShadingQuality.Value = ShadingQuality;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsShadingQuality.Enabled = false; GraphicsShadingQuality.Enabled = false;
} }
@ -93,15 +96,17 @@ namespace NovetusLauncher
MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token)); MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "WoodQuality", XMLTypes.Token));
GraphicsMaterialQuality.SelectedIndex = MaterialQuality; GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
try try
{ {
MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token)); MaterialQuality = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "TrussDetail", XMLTypes.Token));
GraphicsMaterialQuality.SelectedIndex = MaterialQuality; GraphicsMaterialQuality.SelectedIndex = MaterialQuality;
} }
catch (Exception) catch (Exception ex2)
{ {
GlobalFuncs.LogExceptions(ex2);
GraphicsMaterialQuality.Enabled = false; GraphicsMaterialQuality.Enabled = false;
} }
} }
@ -111,8 +116,9 @@ namespace NovetusLauncher
AA = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token)); AA = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Antialiasing", XMLTypes.Token));
GraphicsAntiAliasing.SelectedIndex = AA; GraphicsAntiAliasing.SelectedIndex = AA;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsAntiAliasing.Enabled = false; GraphicsAntiAliasing.Enabled = false;
} }
@ -133,8 +139,9 @@ namespace NovetusLauncher
break; break;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsAASamples.Enabled = false; GraphicsAASamples.Enabled = false;
} }
@ -143,8 +150,9 @@ namespace NovetusLauncher
Bevels = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token)); Bevels = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Bevels", XMLTypes.Token));
GraphicsBevels.SelectedIndex = Bevels; GraphicsBevels.SelectedIndex = Bevels;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsBevels.Enabled = false; GraphicsBevels.Enabled = false;
} }
@ -153,8 +161,9 @@ namespace NovetusLauncher
Shadows_2008 = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token)); Shadows_2008 = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Shadow", XMLTypes.Token));
GraphicsShadows2008.SelectedIndex = Shadows_2008; GraphicsShadows2008.SelectedIndex = Shadows_2008;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsShadows2008.Enabled = false; GraphicsShadows2008.Enabled = false;
} }
@ -162,15 +171,17 @@ namespace NovetusLauncher
{ {
Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool)); Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool));
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
// try doing march 2007. // try doing march 2007.
try try
{ {
Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool)); Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool));
} }
catch (Exception) catch (Exception ex2)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsShadows2007.Enabled = false; GraphicsShadows2007.Enabled = false;
} }
} }
@ -202,8 +213,9 @@ namespace NovetusLauncher
Style2007FolderFinder.Enabled = false; Style2007FolderFinder.Enabled = false;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
Style2007.Enabled = false; Style2007.Enabled = false;
Style2007FolderFinder.Enabled = false; Style2007FolderFinder.Enabled = false;
} }
@ -213,8 +225,9 @@ namespace NovetusLauncher
QualityLevel = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token)); QualityLevel = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "QualityLevel", XMLTypes.Token));
GraphicsLevel.Value = QualityLevel; GraphicsLevel.Value = QualityLevel;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsLevel.Enabled = false; GraphicsLevel.Enabled = false;
} }
@ -239,8 +252,9 @@ namespace NovetusLauncher
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsFullscreenResolution.Enabled = false; GraphicsFullscreenResolution.Enabled = false;
} }
@ -265,8 +279,9 @@ namespace NovetusLauncher
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsWindowResolution.Enabled = false; GraphicsWindowResolution.Enabled = false;
} }
@ -275,8 +290,9 @@ namespace NovetusLauncher
ModernResolution = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Resolution", XMLTypes.Token)); ModernResolution = Convert.ToInt32(RobloxXML.GetRenderSettings(doc, "Resolution", XMLTypes.Token));
GraphicsModernResolution.SelectedIndex = ModernResolution; GraphicsModernResolution.SelectedIndex = ModernResolution;
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GraphicsModernResolution.Enabled = false; GraphicsModernResolution.Enabled = false;
} }
@ -476,8 +492,9 @@ namespace NovetusLauncher
return false; return false;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
return false; return false;
} }
} }

View File

@ -63,6 +63,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2, ConsoleBox); GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2, ConsoleBox);
} }
} }
@ -80,6 +81,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2, ConsoleBox); GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2, ConsoleBox);
} }
} }
@ -97,6 +99,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2, ConsoleBox); GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2, ConsoleBox);
} }
} }
@ -114,6 +117,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2, ConsoleBox); GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2, ConsoleBox);
} }
} }
@ -130,6 +134,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox); GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox);
} }
} }
@ -503,8 +508,9 @@ namespace NovetusLauncher
Tree.Select(); Tree.Select();
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The map '" + searchText + "' cannot be found. Please try another term.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The map '" + searchText + "' cannot be found. Please try another term.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -798,20 +804,21 @@ namespace NovetusLauncher
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode; PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode;
} }
public void InstallAddon() public async void InstallAddon()
{ {
AddonLoader addon = new AddonLoader(); AddonLoader addon = new AddonLoader(ConsoleBox);
addon.setFileListDisplay(10); addon.setFileListDisplay(10);
try try
{ {
addon.LoadAddon(); await addon.LoadAddon();
if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome())) if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
{ {
GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 3, ConsoleBox); GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 3, ConsoleBox);
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome())) if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
{ {
GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 2, ConsoleBox); GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 2, ConsoleBox);
@ -1102,6 +1109,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Novetus has experienced an error when adding your map file: " + ex.Message + "\n\nYour file has not been added. Please try again.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Novetus has experienced an error when adding your map file: " + ex.Message + "\n\nYour file has not been added. Please try again.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
success = false; success = false;
} }

View File

@ -115,6 +115,7 @@ public partial class AssetSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Error: Unable to download the file. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Error: Unable to download the file. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
@ -128,8 +129,9 @@ public partial class AssetSDK : Form
Process.Start(fullURL); Process.Start(fullURL);
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Error: Unable to download the file. Try using a different file name or ID.", "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Error: Unable to download the file. Try using a different file name or ID.", "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -149,8 +151,9 @@ public partial class AssetSDK : Form
{ {
download.InitDownloadNoDialog(download.GetFullDLPath()); download.InitDownloadNoDialog(download.GetFullDLPath());
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
} }
else else
@ -158,8 +161,9 @@ public partial class AssetSDK : Form
Process.Start(fullURL); Process.Start(fullURL);
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
} }
private void AssetDownloader_URLSelection_SelectedIndexChanged(object sender, EventArgs e) private void AssetDownloader_URLSelection_SelectedIndexChanged(object sender, EventArgs e)
@ -297,6 +301,7 @@ public partial class AssetSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -448,6 +453,7 @@ public partial class AssetSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
finally finally
@ -480,6 +486,7 @@ public partial class AssetSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
finally finally
@ -729,8 +736,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxl", " - BAK.rbxl"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxl", " - BAK.rbxl"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -794,8 +802,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -858,8 +867,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -887,8 +897,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -909,8 +920,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -930,8 +942,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -951,8 +964,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -972,8 +986,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -993,8 +1008,9 @@ public partial class AssetSDK : Form
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".lua", " BAK.lua"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".lua", " BAK.lua"), false);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
} }
} }
@ -1013,6 +1029,7 @@ public partial class AssetSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
finally finally

View File

@ -105,8 +105,9 @@ public partial class ClientinfoEditor : Form
label9.Text = "v2 (v" + GlobalVars.ProgramInformation.Version + ")"; label9.Text = "v2 (v" + GlobalVars.ProgramInformation.Version + ")";
ConvertedLine = SecurityFuncs.Base64DecodeNew(file); ConvertedLine = SecurityFuncs.Base64DecodeNew(file);
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
label9.Text = "v1 (v1.1)"; label9.Text = "v1 (v1.1)";
ConvertedLine = SecurityFuncs.Base64DecodeOld(file); ConvertedLine = SecurityFuncs.Base64DecodeOld(file);
} }
@ -131,8 +132,9 @@ public partial class ClientinfoEditor : Form
commandargsver2 = SecurityFuncs.Base64Decode(result[11]); commandargsver2 = SecurityFuncs.Base64Decode(result[11]);
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
if (!label9.Text.Equals("v1 (v1.1)")) if (!label9.Text.Equals("v1 (v1.1)"))
{ {
label9.Text = "v2 (v1.2 Snapshot 7440)"; label9.Text = "v2 (v1.2 Snapshot 7440)";
@ -187,8 +189,9 @@ public partial class ClientinfoEditor : Form
SelectedClientInfo.CommandLineArgs = commandargsver2; SelectedClientInfo.CommandLineArgs = commandargsver2;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
//Again, fake it. //Again, fake it.
SelectedClientInfo.ClientLoadOptions = Settings.ClientLoadOptions.Client_2008AndUp; SelectedClientInfo.ClientLoadOptions = Settings.ClientLoadOptions.Client_2008AndUp;
SelectedClientInfo.CommandLineArgs = cmdargsorclientoptions; SelectedClientInfo.CommandLineArgs = cmdargsorclientoptions;

View File

@ -75,8 +75,9 @@ public partial class ItemCreationSDK : Form
{ {
icon.LoadImage(); icon.LoadImage();
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome())) if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))
@ -890,6 +891,7 @@ public partial class ItemCreationSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message, "Novetus Item Creation SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message, "Novetus Item Creation SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
success = false; success = false;
} }
@ -1041,6 +1043,7 @@ public partial class ItemCreationSDK : Form
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message, "Novetus Item Creation SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The Item Creation SDK has experienced an error: " + ex.Message, "Novetus Item Creation SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
success = false; success = false;
} }

View File

@ -72,6 +72,7 @@ namespace NovetusLauncher
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Unable to load servers. (" + ex + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Unable to load servers. (" + ex + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -100,8 +101,9 @@ namespace NovetusLauncher
MessageBox.Show("Select a server before joining it.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Select a server before joining it.", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
} }
@ -119,9 +121,9 @@ namespace NovetusLauncher
selectedServer = ServerListView.Items[intselectedindex].Index; selectedServer = ServerListView.Items[intselectedindex].Index;
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
} }

View File

@ -1,6 +1,7 @@
#region Usings #region Usings
using NLog; using NLog;
using System; using System;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -17,21 +18,9 @@ namespace NovetusLauncher
{ {
var config = new NLog.Config.LoggingConfiguration(); var config = new NLog.Config.LoggingConfiguration();
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\Launcher-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" }; var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\Launcher-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile); config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
LogManager.Configuration = config; LogManager.Configuration = config;
//https://stackify.com/csharp-catch-all-exceptions/
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
Logger log = LogManager.GetCurrentClassLogger();
log.Error("EXEPTION THROWN: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.Message) ? eventArgs.Exception.Message : "N/A"));
log.Error("EXCEPTION INFO: " + (eventArgs.Exception != null ? eventArgs.Exception.ToString() : "N/A"));
log.Error("INNER EXCEPTION: " + (eventArgs.Exception.InnerException != null ? eventArgs.Exception.InnerException.ToString() : "N/A"));
log.Error("STACK TRACE: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.StackTrace) ? eventArgs.Exception.StackTrace : "N/A"));
log.Error("TARGET SITE: " + (eventArgs.Exception.TargetSite != null ? eventArgs.Exception.TargetSite.ToString() : "N/A"));
log.Error("FOOTPRINTS: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.GetExceptionFootprints()) ? eventArgs.Exception.GetExceptionFootprints() : "N/A"));
};
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
@ -40,7 +29,7 @@ namespace NovetusLauncher
if (args.Length == 0) if (args.Length == 0)
{ {
switch (GlobalVars.UserConfiguration.LauncherStyle) switch (GlobalVars.UserConfiguration.LauncherStyle)
{ {
case Settings.Style.Compact: case Settings.Style.Compact:
Application.Run(new LauncherFormCompact()); Application.Run(new LauncherFormCompact());
break; break;

View File

@ -25,6 +25,7 @@ namespace NovetusURI
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
form.Close(); form.Close();
} }
@ -68,8 +69,9 @@ namespace NovetusURI
} }
} }
} }
catch (Exception) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
} }
} }
} }

View File

@ -2,6 +2,7 @@
using NLog; using NLog;
using System; using System;
using System.IO; using System.IO;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -21,18 +22,6 @@ namespace NovetusURI
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile); config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
LogManager.Configuration = config; LogManager.Configuration = config;
//https://stackify.com/csharp-catch-all-exceptions/
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
Logger log = LogManager.GetCurrentClassLogger();
log.Error("EXEPTION THROWN: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.Message) ? eventArgs.Exception.Message : "N/A"));
log.Error("EXCEPTION INFO: " + (eventArgs.Exception != null ? eventArgs.Exception.ToString() : "N/A"));
log.Error("INNER EXCEPTION: " + (eventArgs.Exception.InnerException != null ? eventArgs.Exception.InnerException.ToString() : "N/A"));
log.Error("STACK TRACE: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.StackTrace) ? eventArgs.Exception.StackTrace : "N/A"));
log.Error("TARGET SITE: " + (eventArgs.Exception.TargetSite != null ? eventArgs.Exception.TargetSite.ToString() : "N/A"));
log.Error("FOOTPRINTS: " + (!string.IsNullOrWhiteSpace(eventArgs.Exception.GetExceptionFootprints()) ? eventArgs.Exception.GetExceptionFootprints() : "N/A"));
};
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);