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

View File

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

View File

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

View File

@ -336,14 +336,9 @@ namespace Novetus.Core
group.Header = group.Header + " (" + group.Items.Count + ")";
}*/
}
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
}
}
@ -360,14 +355,9 @@ namespace Novetus.Core
return Bmp;
}
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
return null;
}
}
@ -600,9 +590,7 @@ namespace Novetus.Core
catch (Exception ex)
{
installOutcome = "Error when installing icon: " + ex.Message;
#if URI || LAUNCHER || BASICLAUNCHER
Util.LogExceptions(ex);
#endif
}
}
}
@ -697,14 +685,9 @@ namespace Novetus.Core
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ReadInfoFile(infopath, other);
}
}
@ -958,14 +941,9 @@ namespace Novetus.Core
Config(cfgpath, true);
}
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
Config(cfgpath, true);
}
}
@ -1128,14 +1106,9 @@ namespace Novetus.Core
GlobalVars.UserCustomization.ExtraSelectionIsHat = ValueBool(extraishat, DefaultCustomization.ExtraSelectionIsHat);
GlobalVars.UserCustomization.ShowHatsInExtra = ValueBool(showhatsonextra, DefaultCustomization.ShowHatsInExtra);
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
Customization(cfgpath, true);
}
}
@ -1251,14 +1224,9 @@ namespace Novetus.Core
break;
}
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ReShadeValues(cfgpath, true, setglobals);
}
}
@ -1281,14 +1249,9 @@ namespace Novetus.Core
goto Failure;
}
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure;
}
@ -1319,14 +1282,9 @@ namespace Novetus.Core
goto Failure;
}
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
goto Failure;
}
@ -1394,14 +1352,9 @@ namespace Novetus.Core
download.InitDownloadNoDialog(path);
return GlobalPaths.AssetCacheAssetsGameDir + download.fileName;
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception 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);
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception 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 NovetusExtsWebProxy = AddonNovetusExts + @"\\webproxy";
public static readonly string MapsDirCustom = MapsDir + @"\\Custom";
public static readonly string MiscDir = BasePath + @"\\misc";
public static readonly string MapsDirBase = "maps";
public static readonly string BaseGameDir = "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();
}
#if URI || LAUNCHER || BASICLAUNCHER
catch (Exception ex)
{
Util.LogExceptions(ex);
#else
catch (Exception)
{
#endif
ipAddress = "localhost";
}

View File

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

View File

@ -494,7 +494,7 @@ namespace NovetusLauncher
{
ClearConsole();
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);
ScrollToTop();
}
@ -503,7 +503,7 @@ namespace NovetusLauncher
{
ClearConsole();
Util.ConsolePrint("ClientScript Documentation:", 3, true);
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ClientScriptDocumentationFileName, false);
Util.ReadTextFileWithColor(GlobalPaths.MiscDir + "\\" + GlobalPaths.ClientScriptDocumentationFileName, false);
ScrollToTop();
}

View File

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