fix logging
This commit is contained in:
parent
e3bfee0da4
commit
0468b36e4f
|
|
@ -1,4 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -13,15 +14,23 @@ namespace Novetus.Bootstrapper
|
||||||
{
|
{
|
||||||
public static void LaunchApplicationExt(string filePath, string appName, string args = "")
|
public static void LaunchApplicationExt(string filePath, string appName, string args = "")
|
||||||
{
|
{
|
||||||
Process client = new Process();
|
GlobalFuncs.LogPrint("Starting " + appName);
|
||||||
client.StartInfo.FileName = filePath + @"\\" + appName;
|
try
|
||||||
client.StartInfo.Arguments = args;
|
|
||||||
client.StartInfo.UseShellExecute = true;
|
|
||||||
if (SecurityFuncs.IsElevated)
|
|
||||||
{
|
{
|
||||||
client.StartInfo.Verb = "runas";
|
Process client = new Process();
|
||||||
|
client.StartInfo.FileName = filePath + @"\\" + appName;
|
||||||
|
client.StartInfo.Arguments = args;
|
||||||
|
client.StartInfo.UseShellExecute = true;
|
||||||
|
if (SecurityFuncs.IsElevated)
|
||||||
|
{
|
||||||
|
client.StartInfo.Verb = "runas";
|
||||||
|
}
|
||||||
|
client.Start();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
GlobalFuncs.LogExceptions(ex);
|
||||||
}
|
}
|
||||||
client.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LaunchApplication(string appName, string args = "")
|
public static void LaunchApplication(string appName, string args = "")
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,15 @@
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</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.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
|
@ -74,6 +81,7 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="app.manifest" />
|
<None Include="app.manifest" />
|
||||||
|
<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>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
@ -15,6 +16,12 @@ namespace Novetus.Bootstrapper
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
|
var config = new NLog.Config.LoggingConfiguration();
|
||||||
|
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = LocalPaths.FixedConfigDir + "\\Bootstrapper-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
|
||||||
|
config.AddRuleForAllLevels(logfile);
|
||||||
|
LogManager.Configuration = config;
|
||||||
|
|
||||||
Application.Run(new NovetusLaunchForm());
|
Application.Run(new NovetusLaunchForm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using NLog;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
@ -18,6 +19,7 @@ namespace Novetus.Bootstrapper
|
||||||
|
|
||||||
GlobalFuncs.ReadInfoFile(LocalPaths.InfoPath, true, LocalPaths.LauncherPath);
|
GlobalFuncs.ReadInfoFile(LocalPaths.InfoPath, true, LocalPaths.LauncherPath);
|
||||||
|
|
||||||
|
GlobalFuncs.LogPrint("Loading Font...");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PrivateFontCollection pfc = new PrivateFontCollection();
|
PrivateFontCollection pfc = new PrivateFontCollection();
|
||||||
|
|
@ -29,9 +31,11 @@ namespace Novetus.Bootstrapper
|
||||||
VersionLabel.Font = new Font(fam, VersionLabel.Font.Size);
|
VersionLabel.Font = new Font(fam, VersionLabel.Font.Size);
|
||||||
LaunchNovetusButton.Font = new Font(fam, VersionLabel.Font.Size);
|
LaunchNovetusButton.Font = new Font(fam, VersionLabel.Font.Size);
|
||||||
}
|
}
|
||||||
|
GlobalFuncs.LogPrint("Font Loaded");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogExceptions(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionLabel.Text = GlobalVars.ProgramInformation.Version.ToUpper();
|
VersionLabel.Text = GlobalVars.ProgramInformation.Version.ToUpper();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NLog" version="4.7.2" targetFramework="net40" />
|
||||||
|
</packages>
|
||||||
|
|
@ -145,7 +145,7 @@ namespace NovetusCMD
|
||||||
|
|
||||||
var config = new NLog.Config.LoggingConfiguration();
|
var config = new NLog.Config.LoggingConfiguration();
|
||||||
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\CMD-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
|
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\CMD-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
|
||||||
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
|
config.AddRuleForAllLevels(logfile);
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
|
|
||||||
LoadCMDArgs(args);
|
LoadCMDArgs(args);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class INIFile
|
||||||
255, this.path);
|
255, this.path);
|
||||||
return temp.ToString();
|
return temp.ToString();
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class PartColorLoader
|
||||||
group.Header = group.Header + " (" + group.Items.Count + ")";
|
group.Header = group.Header + " (" + group.Items.Count + ")";
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
@ -146,7 +146,7 @@ public class PartColorLoader
|
||||||
|
|
||||||
return Bmp;
|
return Bmp;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#region Usings
|
#region Usings
|
||||||
#if LAUNCHER || CMD || URI
|
#if LAUNCHER || CMD || URI || BASICLAUNCHER
|
||||||
using NLog;
|
using NLog;
|
||||||
#endif
|
#endif
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -106,7 +106,7 @@ 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;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -263,7 +263,7 @@ public class GlobalFuncs
|
||||||
Config(cfgpath, true);
|
Config(cfgpath, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -419,7 +419,7 @@ 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);
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -542,7 +542,7 @@ public class GlobalFuncs
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -572,7 +572,7 @@ public class GlobalFuncs
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -610,7 +610,7 @@ public class GlobalFuncs
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -676,7 +676,7 @@ public class GlobalFuncs
|
||||||
ReadClientValues(name, initial);
|
ReadClientValues(name, initial);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -938,7 +938,7 @@ public class GlobalFuncs
|
||||||
image.SetPropertyItem(item);
|
image.SetPropertyItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -972,7 +972,7 @@ public class GlobalFuncs
|
||||||
LoadClientValues(info, clientpath);
|
LoadClientValues(info, clientpath);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1505,7 +1505,7 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1571,7 +1571,7 @@ public class GlobalFuncs
|
||||||
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality,
|
ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality,
|
||||||
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution);
|
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel, WindowResolution, FullscreenResolution, ModernResolution);
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1610,7 +1610,7 @@ public class GlobalFuncs
|
||||||
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
|
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
|
||||||
doc = XDocument.Parse(fixedfile);
|
doc = XDocument.Parse(fixedfile);
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1660,7 +1660,7 @@ public class GlobalFuncs
|
||||||
RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token);
|
RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1680,7 +1680,7 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -1956,7 +1956,7 @@ public class GlobalFuncs
|
||||||
GlobalVars.ValidatedExtraFiles += 1;
|
GlobalVars.ValidatedExtraFiles += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -2097,7 +2097,7 @@ public class GlobalFuncs
|
||||||
|
|
||||||
GlobalVars.ValidatedExtraFiles = 0;
|
GlobalVars.ValidatedExtraFiles = 0;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
#else
|
#else
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
@ -2120,7 +2120,7 @@ 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
|
#endif
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -2184,40 +2184,38 @@ public class GlobalFuncs
|
||||||
|
|
||||||
box.AppendText("[" + DateTime.Now.ToShortTimeString() + "] - ", Color.White);
|
box.AppendText("[" + DateTime.Now.ToShortTimeString() + "] - ", Color.White);
|
||||||
|
|
||||||
Logger log = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
box.AppendText(text, Color.Red);
|
box.AppendText(text, Color.Red);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Error(text);
|
LogPrint(text, 2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
box.AppendText(text, Color.Lime);
|
box.AppendText(text, Color.Lime);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
box.AppendText(text, Color.Aqua);
|
box.AppendText(text, Color.Aqua);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
box.AppendText(text, Color.Yellow);
|
box.AppendText(text, Color.Yellow);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Warn(text);
|
LogPrint(text, 3);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
box.AppendText(text, Color.LightSalmon);
|
box.AppendText(text, Color.LightSalmon);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
box.AppendText(text, Color.White);
|
box.AppendText(text, Color.White);
|
||||||
if (!noLog)
|
if (!noLog)
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2231,30 +2229,28 @@ public class GlobalFuncs
|
||||||
ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White);
|
ConsoleText("[" + DateTime.Now.ToShortTimeString() + "] - ", ConsoleColor.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger log = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
ConsoleText(text, ConsoleColor.Red);
|
ConsoleText(text, ConsoleColor.Red);
|
||||||
log.Error(text);
|
LogPrint(text, 2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ConsoleText(text, ConsoleColor.Green);
|
ConsoleText(text, ConsoleColor.Green);
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
ConsoleText(text, ConsoleColor.Cyan);
|
ConsoleText(text, ConsoleColor.Cyan);
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ConsoleText(text, ConsoleColor.Yellow);
|
ConsoleText(text, ConsoleColor.Yellow);
|
||||||
log.Warn(text);
|
LogPrint(text, 3);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
ConsoleText(text, ConsoleColor.White);
|
ConsoleText(text, ConsoleColor.White);
|
||||||
log.Info(text);
|
LogPrint(text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2308,6 +2304,24 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public static void LogPrint(string text, int type = 1)
|
||||||
|
{
|
||||||
|
Logger log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
log.Error(text);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
log.Warn(text);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.Info(text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void CreateAssetCacheDirectories()
|
public static void CreateAssetCacheDirectories()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts))
|
if (!Directory.Exists(GlobalPaths.AssetCacheDirFonts))
|
||||||
|
|
@ -2417,7 +2431,7 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -2460,7 +2474,7 @@ public class GlobalFuncs
|
||||||
|
|
||||||
FixedFileMove(path, finalPath, File.Exists(finalPath));
|
FixedFileMove(path, finalPath, File.Exists(finalPath));
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
|
|
@ -2471,13 +2485,12 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LAUNCHER || CMD || URI
|
#if LAUNCHER || CMD || URI || BASICLAUNCHER
|
||||||
public static void LogExceptions(Exception ex)
|
public static void LogExceptions(Exception ex)
|
||||||
{
|
{
|
||||||
Logger log = LogManager.GetCurrentClassLogger();
|
LogPrint("EXCEPTION|MESSAGE: " + (ex.Message != null ? ex.Message.ToString() : "N/A"), 2);
|
||||||
log.Error("EXCEPTION|MESSAGE: " + (ex.Message != null ? ex.Message.ToString() : "N/A"));
|
LogPrint("EXCEPTION|STACK TRACE: " + (!string.IsNullOrWhiteSpace(ex.StackTrace) ? ex.StackTrace : "N/A"), 2);
|
||||||
log.Error("EXCEPTION|STACK TRACE: " + (!string.IsNullOrWhiteSpace(ex.StackTrace) ? ex.StackTrace : "N/A"));
|
LogPrint("EXCEPTION|ADDITIONAL INFO: " + (ex != null ? ex.ToString() : "N/A"), 2);
|
||||||
log.Error("EXCEPTION|ADDITIONAL INFO: " + (ex != null ? ex.ToString() : "N/A"));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2542,7 +2555,7 @@ public class GlobalFuncs
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
LogExceptions(ex);
|
LogExceptions(ex);
|
||||||
#endif
|
#endif
|
||||||
return "ERROR: " + ex.Message;
|
return "ERROR: " + ex.Message;
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ public class ScriptFuncs
|
||||||
string result = code.Substring(pFrom, pTo - pFrom);
|
string result = code.Substring(pFrom, pTo - pFrom);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
@ -221,7 +221,7 @@ public class ScriptFuncs
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ public class SecurityFuncs
|
||||||
{
|
{
|
||||||
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
|
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
|
||||||
}
|
}
|
||||||
#if URI || LAUNCHER || CMD
|
#if URI || LAUNCHER || CMD || BASICLAUNCHER
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
GlobalFuncs.LogExceptions(ex);
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ 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.AddRuleForAllLevels(logfile);
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
|
|
||||||
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
|
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ namespace NovetusURI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogPrint("Failed to register. (Error: Did not run as Administrator)", 2);
|
||||||
MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
form.Close();
|
form.Close();
|
||||||
}
|
}
|
||||||
|
|
@ -78,16 +79,23 @@ namespace NovetusURI
|
||||||
|
|
||||||
public static void SetupURIValues()
|
public static void SetupURIValues()
|
||||||
{
|
{
|
||||||
string ExtractedArg = LocalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
|
try
|
||||||
string ConvertedArg = SecurityFuncs.Base64DecodeOld(ExtractedArg);
|
{
|
||||||
string[] SplitArg = ConvertedArg.Split('|');
|
string ExtractedArg = LocalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
|
||||||
string ip = SecurityFuncs.Base64Decode(SplitArg[0]);
|
string ConvertedArg = SecurityFuncs.Base64DecodeOld(ExtractedArg);
|
||||||
string port = SecurityFuncs.Base64Decode(SplitArg[1]);
|
string[] SplitArg = ConvertedArg.Split('|');
|
||||||
string client = SecurityFuncs.Base64Decode(SplitArg[2]);
|
string ip = SecurityFuncs.Base64Decode(SplitArg[0]);
|
||||||
GlobalVars.UserConfiguration.SelectedClient = client;
|
string port = SecurityFuncs.Base64Decode(SplitArg[1]);
|
||||||
GlobalVars.IP = ip;
|
string client = SecurityFuncs.Base64Decode(SplitArg[2]);
|
||||||
GlobalVars.JoinPort = Convert.ToInt32(port);
|
GlobalVars.UserConfiguration.SelectedClient = client;
|
||||||
GlobalFuncs.ReadClientValues();
|
GlobalVars.IP = ip;
|
||||||
|
GlobalVars.JoinPort = Convert.ToInt32(port);
|
||||||
|
GlobalFuncs.ReadClientValues();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
GlobalFuncs.LogExceptions(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ namespace NovetusURI
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogPrint("Attempting to install URI.");
|
||||||
LocalFuncs.RegisterURI(this);
|
LocalFuncs.RegisterURI(this);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using NLog;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace NovetusURI
|
namespace NovetusURI
|
||||||
|
|
@ -68,6 +69,7 @@ namespace NovetusURI
|
||||||
#region Form Events
|
#region Form Events
|
||||||
void LoaderFormLoad(object sender, EventArgs e)
|
void LoaderFormLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogPrint("Booting Quick Configure....");
|
||||||
QuickConfigure main = new QuickConfigure();
|
QuickConfigure main = new QuickConfigure();
|
||||||
main.ShowDialog();
|
main.ShowDialog();
|
||||||
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
|
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
|
||||||
|
|
@ -97,13 +99,16 @@ namespace NovetusURI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogPrint("Ready to launch.");
|
||||||
Visible = true;
|
Visible = true;
|
||||||
CenterToScreen();
|
CenterToScreen();
|
||||||
if (GlobalVars.UserConfiguration.DiscordPresence)
|
if (GlobalVars.UserConfiguration.DiscordPresence)
|
||||||
{
|
{
|
||||||
|
GlobalFuncs.LogPrint("Starting Discord Rich Presence...");
|
||||||
label1.Text = "Starting Discord Rich Presence...";
|
label1.Text = "Starting Discord Rich Presence...";
|
||||||
StartDiscord();
|
StartDiscord();
|
||||||
}
|
}
|
||||||
|
GlobalFuncs.LogPrint("Launching Game...");
|
||||||
label1.Text = "Launching Game...";
|
label1.Text = "Launching Game...";
|
||||||
LocalFuncs.SetupURIValues();
|
LocalFuncs.SetupURIValues();
|
||||||
StartGame();
|
StartGame();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace NovetusURI
|
||||||
|
|
||||||
var config = new NLog.Config.LoggingConfiguration();
|
var config = new NLog.Config.LoggingConfiguration();
|
||||||
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\URI-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
|
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.ConfigDir + "\\URI-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
|
||||||
config.AddRule(LogLevel.Info, LogLevel.Fatal, logfile);
|
config.AddRuleForAllLevels(logfile);
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
|
|
||||||
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
|
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue