move files, remove many #if clauses

This commit is contained in:
Bitl 2023-01-13 14:21:14 -07:00
parent 9aaff22db0
commit 607d0bcbb4
9 changed files with 8 additions and 137 deletions

View File

@ -103,14 +103,9 @@ namespace Novetus.Core
{ {
read = DownloadFile(fileURL, name); read = DownloadFile(fileURL, name);
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
downloadOutcome = "Error when downloading file: " + ex.Message; downloadOutcome = "Error when downloading file: " + ex.Message;
} }
finally finally
@ -214,9 +209,7 @@ namespace Novetus.Core
} }
catch (Exception e) catch (Exception e)
{ {
#if URI || LAUNCHER || BASICLAUNCHER
Util.LogExceptions(e); Util.LogExceptions(e);
#endif
if (e is WebException && bytesProcessed == 0) if (e is WebException && bytesProcessed == 0)
{ {
WebException ex = (WebException)e; WebException ex = (WebException)e;

View File

@ -86,14 +86,9 @@ namespace Novetus.Core
return false; return false;
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return false; return false;
} }
} }

View File

@ -47,14 +47,9 @@ namespace Novetus.Core
GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath)); GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath));
ReadClientValues(name, initial); ReadClientValues(name, initial);
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
Util.ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2); Util.ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2);
Util.ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4); Util.ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4);
name = GlobalVars.ProgramInformation.DefaultClient; name = GlobalVars.ProgramInformation.DefaultClient;
@ -230,14 +225,9 @@ namespace Novetus.Core
LoadClientValues(info, clientpath); LoadClientValues(info, clientpath);
return info; return info;
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return null; return null;
} }
} }
@ -634,14 +624,9 @@ namespace Novetus.Core
} }
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return; return;
} }
} }
@ -700,14 +685,9 @@ namespace Novetus.Core
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 || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return; return;
} }
} }
@ -739,14 +719,9 @@ namespace Novetus.Core
fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)); fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile));
doc = XDocument.Parse(fixedfile); doc = XDocument.Parse(fixedfile);
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return; return;
} }
@ -789,14 +764,9 @@ namespace Novetus.Core
RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token); RobloxXML.EditRenderSettings(doc, "Resolution", ModernResolution.ToString(), XMLTypes.Token);
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return; return;
} }
finally finally
@ -809,14 +779,9 @@ namespace Novetus.Core
} }
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return; return;
} }
} }
@ -1266,17 +1231,12 @@ namespace Novetus.Core
#if URI #if URI
ValidateFiles(line, validstart, validend, label); ValidateFiles(line, validstart, validend, label);
#else #else
ValidateFiles(line, validstart, validend); ValidateFiles(line, validstart, validend);
#endif #endif
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
continue; continue;
} }
} }
@ -1287,17 +1247,12 @@ namespace Novetus.Core
#if URI #if URI
ValidateFiles(line, validv2, "", label); ValidateFiles(line, validv2, "", label);
#else #else
ValidateFiles(line, validv2, ""); ValidateFiles(line, validv2, "");
#endif #endif
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
continue; continue;
} }
} }
@ -1413,11 +1368,7 @@ namespace Novetus.Core
GlobalVars.ValidatedExtraFiles = 0; GlobalVars.ValidatedExtraFiles = 0;
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
#else
catch (Exception)
#endif
{ {
#if URI #if URI
UpdateStatus(label, "Error: " + ex.Message); UpdateStatus(label, "Error: " + ex.Message);
@ -1431,9 +1382,7 @@ namespace Novetus.Core
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 || BASICLAUNCHER
Util.LogExceptions(ex); Util.LogExceptions(ex);
#endif
#if URI #if URI
//toss the exception back to the URI //toss the exception back to the URI
@ -1702,14 +1651,9 @@ namespace Novetus.Core
return result; return result;
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return ""; return "";
} }
} }
@ -1805,14 +1749,9 @@ namespace Novetus.Core
return source; return source;
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return source; return source;
} }
} }

View File

@ -336,14 +336,9 @@ namespace Novetus.Core
group.Header = group.Header + " (" + group.Items.Count + ")"; group.Header = group.Header + " (" + group.Items.Count + ")";
}*/ }*/
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
} }
} }
@ -360,14 +355,9 @@ namespace Novetus.Core
return Bmp; return Bmp;
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return null; return null;
} }
} }
@ -600,9 +590,7 @@ namespace Novetus.Core
catch (Exception ex) catch (Exception ex)
{ {
installOutcome = "Error when installing icon: " + ex.Message; installOutcome = "Error when installing icon: " + ex.Message;
#if URI || LAUNCHER || BASICLAUNCHER
Util.LogExceptions(ex); Util.LogExceptions(ex);
#endif
} }
} }
} }
@ -697,14 +685,9 @@ namespace Novetus.Core
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 || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ReadInfoFile(infopath, other); ReadInfoFile(infopath, other);
} }
} }
@ -958,14 +941,9 @@ namespace Novetus.Core
Config(cfgpath, true); Config(cfgpath, true);
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
Config(cfgpath, true); Config(cfgpath, true);
} }
} }
@ -1128,14 +1106,9 @@ namespace Novetus.Core
GlobalVars.UserCustomization.ExtraSelectionIsHat = ValueBool(extraishat, DefaultCustomization.ExtraSelectionIsHat); GlobalVars.UserCustomization.ExtraSelectionIsHat = ValueBool(extraishat, DefaultCustomization.ExtraSelectionIsHat);
GlobalVars.UserCustomization.ShowHatsInExtra = ValueBool(showhatsonextra, DefaultCustomization.ShowHatsInExtra); GlobalVars.UserCustomization.ShowHatsInExtra = ValueBool(showhatsonextra, DefaultCustomization.ShowHatsInExtra);
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
Customization(cfgpath, true); Customization(cfgpath, true);
} }
} }
@ -1251,14 +1224,9 @@ namespace Novetus.Core
break; break;
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ReShadeValues(cfgpath, true, setglobals); ReShadeValues(cfgpath, true, setglobals);
} }
} }
@ -1281,14 +1249,9 @@ namespace Novetus.Core
goto Failure; goto Failure;
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure; goto Failure;
} }
@ -1319,14 +1282,9 @@ namespace Novetus.Core
goto Failure; goto Failure;
} }
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure; goto Failure;
} }
@ -1394,14 +1352,9 @@ namespace Novetus.Core
download.InitDownloadNoDialog(path); download.InitDownloadNoDialog(path);
return GlobalPaths.AssetCacheAssetsGameDir + download.fileName; return GlobalPaths.AssetCacheAssetsGameDir + download.fileName;
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
} }
} }
@ -1444,14 +1397,9 @@ namespace Novetus.Core
return RobloxXML.GetURLInNodes(doc, assetCacheDef.Class, assetCacheDef.Id[0], item); return RobloxXML.GetURLInNodes(doc, assetCacheDef.Class, assetCacheDef.Id[0], item);
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
} }
} }

View File

@ -29,6 +29,7 @@ namespace Novetus.Core
public static readonly string AddonNovetusExts = AddonDir + @"\\novetusexts"; public static readonly string AddonNovetusExts = AddonDir + @"\\novetusexts";
public static readonly string NovetusExtsWebProxy = AddonNovetusExts + @"\\webproxy"; public static readonly string NovetusExtsWebProxy = AddonNovetusExts + @"\\webproxy";
public static readonly string MapsDirCustom = MapsDir + @"\\Custom"; public static readonly string MapsDirCustom = MapsDir + @"\\Custom";
public static readonly string MiscDir = BasePath + @"\\misc";
public static readonly string MapsDirBase = "maps"; public static readonly string MapsDirBase = "maps";
public static readonly string BaseGameDir = "rbxasset://../../../"; public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string AltBaseGameDir = "rbxasset://"; public static readonly string AltBaseGameDir = "rbxasset://";

View File

@ -233,14 +233,9 @@ namespace Novetus.Core
{ {
ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd(); ipAddress = new WebClient().DownloadString("https://ipv4.icanhazip.com/").TrimEnd();
} }
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
{ {
Util.LogExceptions(ex); Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ipAddress = "localhost"; ipAddress = "localhost";
} }

View File

@ -587,18 +587,18 @@ namespace Novetus.Core
} }
} }
#if LAUNCHER || URI || BASICLAUNCHER
public static void LogExceptions(Exception ex) public static void LogExceptions(Exception ex)
{ {
string message = (ex.Message != null ? ex.Message.ToString() : "N/A"); string message = (ex.Message != null ? ex.Message.ToString() : "N/A");
ConsolePrint(ex.Source + " Exception: " + message, 2, true); ConsolePrint(ex.Source + " Exception: " + message, 2, true);
#if LAUNCHER || URI || BASICLAUNCHER
LogPrint("EXCEPTION|MESSAGE: " + message, 2); LogPrint("EXCEPTION|MESSAGE: " + message, 2);
LogPrint("EXCEPTION|STACK TRACE: " + (!string.IsNullOrWhiteSpace(ex.StackTrace) ? ex.StackTrace : "N/A"), 2); LogPrint("EXCEPTION|STACK TRACE: " + (!string.IsNullOrWhiteSpace(ex.StackTrace) ? ex.StackTrace : "N/A"), 2);
LogPrint("EXCEPTION|ADDITIONAL INFO: " + (ex != null ? ex.ToString() : "N/A"), 2); LogPrint("EXCEPTION|ADDITIONAL INFO: " + (ex != null ? ex.ToString() : "N/A"), 2);
}
#endif #endif
}
//https://stackoverflow.com/questions/27108264/how-to-properly-make-a-http-web-get-request //https://stackoverflow.com/questions/27108264/how-to-properly-make-a-http-web-get-request

View File

@ -494,7 +494,7 @@ namespace NovetusLauncher
{ {
ClearConsole(); ClearConsole();
Util.ConsolePrint("Help:", 3, true, false); Util.ConsolePrint("Help:", 3, true, false);
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ConsoleHelpFileName, false); Util.ReadTextFileWithColor(GlobalPaths.MiscDir + "\\" + GlobalPaths.ConsoleHelpFileName, false);
Util.ConsolePrint(GlobalVars.Important2, 0, true, false); Util.ConsolePrint(GlobalVars.Important2, 0, true, false);
ScrollToTop(); ScrollToTop();
} }
@ -503,7 +503,7 @@ namespace NovetusLauncher
{ {
ClearConsole(); ClearConsole();
Util.ConsolePrint("ClientScript Documentation:", 3, true); Util.ConsolePrint("ClientScript Documentation:", 3, true);
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ClientScriptDocumentationFileName, false); Util.ReadTextFileWithColor(GlobalPaths.MiscDir + "\\" + GlobalPaths.ClientScriptDocumentationFileName, false);
ScrollToTop(); ScrollToTop();
} }

View File

@ -18,7 +18,7 @@ public partial class ClientScriptDocumentation : Form
#region Form Events #region Form Events
void ClientScriptDocumentationLoad(object sender, EventArgs e) void ClientScriptDocumentationLoad(object sender, EventArgs e)
{ {
richTextBox1.Text = File.ReadAllText(GlobalPaths.BasePath + "\\documentation.txt"); richTextBox1.Text = File.ReadAllText(GlobalPaths.MiscDir + "\\" + GlobalPaths.ClientScriptDocumentationFileName);
} }
#endregion #endregion
} }