fixed a ClientScript bug.

This commit is contained in:
Bitl 2020-01-13 12:00:16 -07:00
parent 185dd1c5cc
commit 7cd07f7944
1 changed files with 19 additions and 7 deletions

View File

@ -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 + "'";