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
using NLog;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
#endregion
@ -13,77 +8,12 @@ namespace Novetus.ClientScriptTester
#region ClientScript Tester
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>
/// The main entry point for the application.
/// </summary>
[STAThread]
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.SetCompatibleTextRenderingDefault(false);

View File

@ -34,9 +34,6 @@
<ApplicationIcon>NovetusIcon.ico</ApplicationIcon>
</PropertyGroup>
<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.Configuration" />
<Reference Include="System.Core" />
@ -76,7 +73,6 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<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.Windows.Forms;
using NLog;
using System.Threading;
#endregion
namespace NovetusCMD
@ -25,6 +26,7 @@ namespace NovetusCMD
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2);
GlobalFuncs.LogExceptions(ex);
}
}
}
@ -42,7 +44,8 @@ namespace NovetusCMD
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2);
}
GlobalFuncs.LogExceptions(ex);
}
}
}
@ -59,7 +62,8 @@ namespace NovetusCMD
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2);
}
GlobalFuncs.LogExceptions(ex);
}
}
}
@ -76,7 +80,8 @@ namespace NovetusCMD
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2);
}
GlobalFuncs.LogExceptions(ex);
}
}
private static void DeviceLost(object sender, DeviceEventArgs args)
@ -92,7 +97,8 @@ namespace NovetusCMD
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2);
}
GlobalFuncs.LogExceptions(ex);
}
}
#endregion
@ -120,18 +126,6 @@ namespace NovetusCMD
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"));
};
LoadCMDArgs(args);
if (!LocalVars.PrintHelp)
@ -175,8 +169,8 @@ namespace NovetusCMD
LocalFuncs.CommandInfo();
}
Console.ReadKey();
}
Console.ReadKey();
}
static void ProgramClose(object sender, EventArgs e)
{

View File

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

View File

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

View File

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

View File

@ -56,6 +56,9 @@ public class IconLoader
catch (Exception ex)
{
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);
return temp.ToString();
}
catch (Exception)
catch (Exception ex)
{
IniWriteValue(Section, Key, DefaultValue);
#if URI || LAUNCHER || CMD
GlobalFuncs.LogExceptions(ex);
#endif
return IniReadValue(Section, Key);
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,9 @@ using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
#endregion
@ -13,9 +16,14 @@ public class AddonLoader
private readonly OpenFileDialog openFileDialog1;
private string installOutcome = "";
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()
{
FileName = "Select an addon .zip file",
@ -39,32 +47,44 @@ public class AddonLoader
fileListDisplay = number;
}
public void LoadAddon()
public async Task LoadAddon()
{
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
{
int filecount = 0;
StringBuilder filelistbuilder = new StringBuilder();
StringBuilder filelistcutdown = new StringBuilder();
using (Stream str = openFileDialog1.OpenFile())
{
using (var zipFile = ZipFile.Read(str))
{
zipFile.ExtractProgress += ExtractProgress;
ZipEntry[] entries = zipFile.Entries.ToArray();
foreach (ZipEntry entry in entries)
{
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)
{
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)
{
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
{
@ -81,9 +101,39 @@ public class AddonLoader
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
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

View File

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

View File

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

View File

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

View File

@ -63,6 +63,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to initialize UPnP. Reason - " + ex.Message, 2, ConsoleBox);
}
}
@ -80,6 +81,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to open port mapping. Reason - " + ex.Message, 2, ConsoleBox);
}
}
@ -97,6 +99,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to close port mapping. Reason - " + ex.Message, 2, ConsoleBox);
}
}
@ -114,6 +117,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to register device. Reason - " + ex.Message, 2, ConsoleBox);
}
}
@ -130,6 +134,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
GlobalFuncs.ConsolePrint("UPnP: Unable to disconnect device. Reason - " + ex.Message, 2, ConsoleBox);
}
}
@ -503,8 +508,9 @@ namespace NovetusLauncher
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);
}
}
@ -798,20 +804,21 @@ namespace NovetusLauncher
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode;
}
public void InstallAddon()
public async void InstallAddon()
{
AddonLoader addon = new AddonLoader();
AddonLoader addon = new AddonLoader(ConsoleBox);
addon.setFileListDisplay(10);
try
{
addon.LoadAddon();
await addon.LoadAddon();
if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
{
GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 3, ConsoleBox);
}
}
catch (Exception)
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
if (!string.IsNullOrWhiteSpace(addon.getInstallOutcome()))
{
GlobalFuncs.ConsolePrint("AddonLoader - " + addon.getInstallOutcome(), 2, ConsoleBox);
@ -1102,6 +1109,7 @@ namespace NovetusLauncher
}
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);
success = false;
}

View File

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

View File

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

View File

@ -75,8 +75,9 @@ public partial class ItemCreationSDK : Form
{
icon.LoadImage();
}
catch (Exception)
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
}
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))
@ -890,6 +891,7 @@ public partial class ItemCreationSDK : Form
}
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);
success = false;
}
@ -1041,6 +1043,7 @@ public partial class ItemCreationSDK : Form
}
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);
success = false;
}

View File

@ -72,6 +72,7 @@ namespace NovetusLauncher
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
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);
}
}
catch (Exception)
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
}
}
@ -119,9 +121,9 @@ namespace NovetusLauncher
selectedServer = ServerListView.Items[intselectedindex].Index;
}
}
catch (Exception)
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
}
}

View File

@ -1,6 +1,7 @@
#region Usings
using NLog;
using System;
using System.Threading;
using System.Windows.Forms;
#endregion
@ -17,21 +18,9 @@ namespace NovetusLauncher
{
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" };
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
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.SetCompatibleTextRenderingDefault(false);
@ -40,7 +29,7 @@ namespace NovetusLauncher
if (args.Length == 0)
{
switch (GlobalVars.UserConfiguration.LauncherStyle)
{
{
case Settings.Style.Compact:
Application.Run(new LauncherFormCompact());
break;

View File

@ -25,6 +25,7 @@ namespace NovetusURI
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
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 System;
using System.IO;
using System.Threading;
using System.Windows.Forms;
#endregion
@ -21,18 +22,6 @@ namespace NovetusURI
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.SetCompatibleTextRenderingDefault(false);
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);