From c2f8608e64a328ed8832f9befebb0aedc4541363 Mon Sep 17 00:00:00 2001 From: Bitl Date: Fri, 19 Nov 2021 12:54:56 -0700 Subject: [PATCH] Update GlobalFuncs.cs --- .../StorageAndFunctions/GlobalFuncs.cs | 86 +++++++------------ 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index b3f4074..af3101f 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -2021,57 +2021,32 @@ public class GlobalFuncs string args = ""; GlobalVars.ValidatedExtraFiles = 0; - if (!info.AlreadyHasSecurity) + if (!info.AlreadyHasSecurity || !GlobalVars.AdminMode) { - if (Regex.Match(GlobalVars.UserConfiguration.PlayerTripcode, "[^a-zA-Z0-9]") != Match.Empty || - string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.PlayerTripcode)) + string validstart = ""; + string validend = ""; + + foreach (string line in info.CommandLineArgs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { -#if URI - if (label != null) + if (line.Contains(validstart) && line.Contains(validend)) { - label.Text = "The client has been detected as modified."; - } -#elif LAUNCHER - if (box != null) - { - ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box); - } -#elif CMD - ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2); -#endif - -#if URI || LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); -#endif - return; - } - - if (!GlobalVars.AdminMode) - { - string validstart = ""; - string validend = ""; - - foreach (string line in info.CommandLineArgs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) - { - if (line.Contains(validstart) && line.Contains(validend)) + string extractedFile = ScriptFuncs.ClientScript.GetArgsFromTag(line, validstart, validend); + if (!string.IsNullOrWhiteSpace(extractedFile)) { - string extractedFile = ScriptFuncs.ClientScript.GetArgsFromTag(line, validstart, validend); - if (!string.IsNullOrWhiteSpace(extractedFile)) + try { - try - { - string[] parsedFileParams = extractedFile.Split('|'); - string filePath = parsedFileParams[0]; - string fileMD5 = parsedFileParams[1]; - string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\" + filePath; + string[] parsedFileParams = extractedFile.Split('|'); + string filePath = parsedFileParams[0]; + string fileMD5 = parsedFileParams[1]; + string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\" + filePath; - if (!SecurityFuncs.CheckMD5(fileMD5, fullFilePath)) - { + if (!SecurityFuncs.CheckMD5(fileMD5, fullFilePath)) + { #if URI - if (label != null) - { - label.Text = "The client has been detected as modified."; - } + if (label != null) + { + label.Text = "The client has been detected as modified."; + } #elif LAUNCHER if (box != null) { @@ -2082,25 +2057,24 @@ public class GlobalFuncs #endif #if URI || LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); #endif - return; - } - else - { - GlobalVars.ValidatedExtraFiles += 1; - } + return; } -#if URI || LAUNCHER || CMD || BASICLAUNCHER - catch (Exception ex) + else { - LogExceptions(ex); + GlobalVars.ValidatedExtraFiles += 1; + } + } +#if URI || LAUNCHER || CMD || BASICLAUNCHER + catch (Exception ex) + { + LogExceptions(ex); #else catch (Exception) { #endif - continue; - } + continue; } } }