From 7cd07f7944ab57711c0618aad6241f6bb74332a8 Mon Sep 17 00:00:00 2001 From: Bitl Date: Mon, 13 Jan 2020 12:00:16 -0700 Subject: [PATCH] fixed a ClientScript bug. --- NovetusLauncher/NovetusFuncs/ClientScript.cs | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/NovetusLauncher/NovetusFuncs/ClientScript.cs b/NovetusLauncher/NovetusFuncs/ClientScript.cs index f70e9ef..dae2170 100644 --- a/NovetusLauncher/NovetusFuncs/ClientScript.cs +++ b/NovetusLauncher/NovetusFuncs/ClientScript.cs @@ -17,12 +17,19 @@ public class ClientScript { public static string GetArgsFromTag(string code, string tag, string endtag) { - int pFrom = code.IndexOf(tag) + tag.Length; - int pTo = code.LastIndexOf(endtag); + try + { + int pFrom = code.IndexOf(tag) + tag.Length; + int pTo = code.LastIndexOf(endtag); - string result = code.Substring(pFrom, pTo - pFrom); - - return result; + string result = code.Substring(pFrom, pTo - pFrom); + + return result; + } + catch (Exception) + { + return "%donothing%"; + } } public static ScriptGenerator.ScriptType GetTypeFromTag(string tag, string endtag) @@ -123,8 +130,13 @@ public class ClientScript } string extractedCode = GetArgsFromTag(code, tag, endtag); - - string md5dir = GlobalVars.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : ""; + + if (extractedCode.Contains("%donothing%")) + { + return ""; + } + + string md5dir = GlobalVars.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(Assembly.GetExecutingAssembly().Location) : ""; string md5script = GlobalVars.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(GlobalVars.ClientDir + @"\\" + GlobalVars.SelectedClient + @"\\content\\scripts\\" + GlobalVars.ScriptName + ".lua") : ""; string md5exe = GlobalVars.AlreadyHasSecurity != true ? SecurityFuncs.CalculateMD5(rbxexe) : ""; string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";