i cannot believe this code had to be rewritten again!

This commit is contained in:
Bitl 2020-07-14 19:02:42 -07:00
parent 6b5a3d6316
commit 5def12095a
4 changed files with 120 additions and 69 deletions

View File

@ -74,7 +74,7 @@ using System.Globalization;
if (!SelectedClientInfo.LegacyMode) if (!SelectedClientInfo.LegacyMode)
{ {
ClientName = "\\RobloxApp_Client.exe"; ClientName = "\\RobloxApp_client.exe";
} }
else else
{ {

View File

@ -498,11 +498,26 @@ public class GlobalFuncs
return GlobalPaths.AltBaseGameDir + "temp.rbxl"; return GlobalPaths.AltBaseGameDir + "temp.rbxl";
} }
//NOT FOR SDK.
public static FileFormat.ClientInfo GetClientInfoValues(string ClientName)
{
string name = ClientName;
FileFormat.ClientInfo info = new FileFormat.ClientInfo();
string clientpath = GlobalPaths.ClientDir + @"\\" + name + @"\\clientinfo.nov";
LoadClientValues(info, clientpath);
return info;
}
public static void LoadClientValues(string clientpath) public static void LoadClientValues(string clientpath)
{ {
string file, usesplayername, usesid, warning, LoadClientValues(GlobalVars.SelectedClientInfo, clientpath);
legacymode, clientmd5, scriptmd5, }
desc, fix2007, alreadyhassecurity,
public static void LoadClientValues(FileFormat.ClientInfo info, string clientpath)
{
string file, usesplayername, usesid, warning,
legacymode, clientmd5, scriptmd5,
desc, fix2007, alreadyhassecurity,
nographicsoptions, commandlineargs; nographicsoptions, commandlineargs;
using (StreamReader reader = new StreamReader(clientpath)) using (StreamReader reader = new StreamReader(clientpath))
@ -533,17 +548,17 @@ public class GlobalFuncs
commandlineargs = SecurityFuncs.Base64Decode(result[10]); commandlineargs = SecurityFuncs.Base64Decode(result[10]);
} }
GlobalVars.SelectedClientInfo.UsesPlayerName = Convert.ToBoolean(usesplayername); info.UsesPlayerName = Convert.ToBoolean(usesplayername);
GlobalVars.SelectedClientInfo.UsesID = Convert.ToBoolean(usesid); info.UsesID = Convert.ToBoolean(usesid);
GlobalVars.SelectedClientInfo.Warning = warning; info.Warning = warning;
GlobalVars.SelectedClientInfo.LegacyMode = Convert.ToBoolean(legacymode); info.LegacyMode = Convert.ToBoolean(legacymode);
GlobalVars.SelectedClientInfo.ClientMD5 = clientmd5; info.ClientMD5 = clientmd5;
GlobalVars.SelectedClientInfo.ScriptMD5 = scriptmd5; info.ScriptMD5 = scriptmd5;
GlobalVars.SelectedClientInfo.Description = desc; info.Description = desc;
GlobalVars.SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007); info.Fix2007 = Convert.ToBoolean(fix2007);
GlobalVars.SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity); info.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity);
GlobalVars.SelectedClientInfo.NoGraphicsOptions = Convert.ToBoolean(nographicsoptions); info.NoGraphicsOptions = Convert.ToBoolean(nographicsoptions);
GlobalVars.SelectedClientInfo.CommandLineArgs = commandlineargs; info.CommandLineArgs = commandlineargs;
} }
public static void ReShade(string cfgpath, string cfgname, bool write) public static void ReShade(string cfgpath, string cfgname, bool write)
@ -773,6 +788,11 @@ public class GlobalFuncs
} }
public static void UpdateRichPresence(GlobalVars.LauncherState state, string mapname, bool initial = false) public static void UpdateRichPresence(GlobalVars.LauncherState state, string mapname, bool initial = false)
{
UpdateRichPresence(state, GlobalVars.UserConfiguration.SelectedClient, mapname, initial);
}
public static void UpdateRichPresence(GlobalVars.LauncherState state, string clientname, string mapname, bool initial = false)
{ {
if (GlobalVars.UserConfiguration.DiscordPresence) if (GlobalVars.UserConfiguration.DiscordPresence)
{ {
@ -789,30 +809,30 @@ public class GlobalFuncs
case GlobalVars.LauncherState.InLauncher: case GlobalVars.LauncherState.InLauncher:
GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher; GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher;
GlobalVars.presence.state = "In Launcher"; GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + GlobalVars.UserConfiguration.SelectedClient; GlobalVars.presence.details = "Selected " + clientname;
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In Launcher"; GlobalVars.presence.smallImageText = "In Launcher";
break; break;
case GlobalVars.LauncherState.InMPGame: case GlobalVars.LauncherState.InMPGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; GlobalVars.presence.state = "In " + clientname + " Multiplayer Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; GlobalVars.presence.smallImageText = "In " + clientname + " Multiplayer Game";
break; break;
case GlobalVars.LauncherState.InSoloGame: case GlobalVars.LauncherState.InSoloGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Solo Game"; GlobalVars.presence.state = "In " + clientname + " Solo Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Solo Game"; GlobalVars.presence.smallImageText = "In " + clientname + " Solo Game";
break; break;
case GlobalVars.LauncherState.InStudio: case GlobalVars.LauncherState.InStudio:
GlobalVars.presence.smallImageKey = GlobalVars.image_instudio; GlobalVars.presence.smallImageKey = GlobalVars.image_instudio;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + GlobalVars.UserConfiguration.SelectedClient + " Studio"; GlobalVars.presence.state = "In " + clientname + " Studio";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + GlobalVars.UserConfiguration.SelectedClient + " Studio"; GlobalVars.presence.smallImageText = "In " + clientname + " Studio";
break; break;
case GlobalVars.LauncherState.InCustomization: case GlobalVars.LauncherState.InCustomization:
GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization; GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization;
@ -831,9 +851,9 @@ public class GlobalFuncs
case GlobalVars.LauncherState.LoadingURI: case GlobalVars.LauncherState.LoadingURI:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "Joining a " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; GlobalVars.presence.state = "Joining a " + clientname + " Multiplayer Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "Joining a " + GlobalVars.UserConfiguration.SelectedClient + " Multiplayer Game"; GlobalVars.presence.smallImageText = "Joining a " + clientname + " Multiplayer Game";
break; break;
default: default:
break; break;
@ -939,6 +959,11 @@ public class GlobalFuncs
} }
public static string GetLuaFileName() public static string GetLuaFileName()
{
return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient);
}
public static string GetLuaFileName(string ClientName)
{ {
string luafile = ""; string luafile = "";
@ -948,39 +973,44 @@ public class GlobalFuncs
} }
else else
{ {
luafile = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua";
} }
return luafile; return luafile;
} }
public static string GetClientEXEDir(ScriptType type) public static string GetClientEXEDir(ScriptType type)
{
return GetClientEXEDir(GlobalVars.UserConfiguration.SelectedClient, type);
}
public static string GetClientEXEDir(string ClientName, ScriptType type)
{ {
string rbxexe = ""; string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode) if (GlobalVars.SelectedClientInfo.LegacyMode)
{ {
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
} }
else else
{ {
switch (type) switch (type)
{ {
case ScriptType.Client: case ScriptType.Client:
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_client.exe";
break; break;
case ScriptType.Server: case ScriptType.Server:
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_server.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_server.exe";
break; break;
case ScriptType.Studio: case ScriptType.Studio:
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_studio.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_studio.exe";
break; break;
case ScriptType.Solo: case ScriptType.Solo:
case ScriptType.EasterEgg: case ScriptType.EasterEgg:
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_solo.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_solo.exe";
break; break;
case ScriptType.None: case ScriptType.None:
default: default:
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
break; break;
} }
} }
@ -1020,23 +1050,24 @@ public class GlobalFuncs
ReadClientValues(ClientName); ReadClientValues(ClientName);
#endif #endif
string luafile = GetLuaFileName(); string luafile = GetLuaFileName(ClientName);
string rbxexe = GetClientEXEDir(type); string rbxexe = GetClientEXEDir(ClientName, type);
string mapfile = type.Equals(ScriptType.EasterEgg) ? GlobalPaths.ConfigDirData + "\\Appreciation.rbxl" : (nomap ? "" : GlobalVars.UserConfiguration.MapPath); string mapfile = type.Equals(ScriptType.EasterEgg) ? GlobalPaths.ConfigDirData + "\\Appreciation.rbxl" : (nomap ? "" : GlobalVars.UserConfiguration.MapPath);
string mapname = type.Equals(ScriptType.EasterEgg) ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map); string mapname = type.Equals(ScriptType.EasterEgg) ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map);
FileFormat.ClientInfo info = GetClientInfoValues(ClientName);
string quote = "\""; string quote = "\"";
string args = ""; string args = "";
if (GlobalVars.SelectedClientInfo.CommandLineArgs.Equals("%args%")) if (info.CommandLineArgs.Equals("%args%"))
{ {
if (!GlobalVars.SelectedClientInfo.Fix2007) if (!info.Fix2007)
{ {
args = quote args = quote
+ mapfile + mapfile
+ "\" -script \"" + "\" -script \""
+ ChangeGameSettings() + ChangeGameSettings()
+ " dofile('" + luafile + "'); " + " dofile('" + luafile + "'); "
+ ScriptFuncs.Generator.GetScriptFuncForType(type) + ScriptFuncs.Generator.GetScriptFuncForType(ClientName, type)
+ "; " + "; "
+ (!string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? " dofile('" + GlobalPaths.AddonScriptPath + "');" : "") + (!string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? " dofile('" + GlobalPaths.AddonScriptPath + "');" : "")
+ quote + quote
@ -1044,7 +1075,7 @@ public class GlobalFuncs
} }
else else
{ {
ScriptFuncs.Generator.GenerateScriptForClient(type); ScriptFuncs.Generator.GenerateScriptForClient(ClientName, type);
args = "-script " args = "-script "
+ quote + quote
+ luafile + luafile
@ -1058,7 +1089,7 @@ public class GlobalFuncs
} }
else else
{ {
args = ScriptFuncs.ClientScript.CompileScript(GlobalVars.SelectedClientInfo.CommandLineArgs, args = ScriptFuncs.ClientScript.CompileScript(ClientName, info.CommandLineArgs,
ScriptFuncs.ClientScript.GetTagFromType(type, false, no3d), ScriptFuncs.ClientScript.GetTagFromType(type, false, no3d),
ScriptFuncs.ClientScript.GetTagFromType(type, true, no3d), ScriptFuncs.ClientScript.GetTagFromType(type, true, no3d),
mapfile, mapfile,
@ -1079,11 +1110,11 @@ public class GlobalFuncs
{ {
if (!GlobalVars.AdminMode) if (!GlobalVars.AdminMode)
{ {
if (GlobalVars.SelectedClientInfo.AlreadyHasSecurity != true) if (info.AlreadyHasSecurity != true)
{ {
if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) && SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient)) if (SecurityFuncs.checkClientMD5(ClientName) && SecurityFuncs.checkScriptMD5(ClientName))
{ {
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, ClientName, mapname, e);
} }
else else
{ {
@ -1108,17 +1139,17 @@ public class GlobalFuncs
} }
else else
{ {
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, ClientName, mapname, e);
} }
} }
else else
{ {
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, ClientName, mapname, e);
} }
} }
else else
{ {
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, ClientName, mapname, e);
} }
} }
#if URI || LAUNCHER || CMD #if URI || LAUNCHER || CMD
@ -1147,7 +1178,7 @@ public class GlobalFuncs
} }
} }
private static void OpenClient(ScriptType type, string rbxexe, string args, string mapname, EventHandler e) private static void OpenClient(ScriptType type, string rbxexe, string args, string clientname, string mapname, EventHandler e)
{ {
Process client = new Process(); Process client = new Process();
client.StartInfo.FileName = rbxexe; client.StartInfo.FileName = rbxexe;
@ -1159,10 +1190,10 @@ public class GlobalFuncs
} }
client.Start(); client.Start();
client.PriorityClass = ProcessPriorityClass.RealTime; client.PriorityClass = ProcessPriorityClass.RealTime;
SecurityFuncs.RenameWindow(client, type, mapname); SecurityFuncs.RenameWindow(client, type, clientname, mapname);
if (e != null) if (e != null)
{ {
UpdateRichPresence(GetStateForType(type), mapname); UpdateRichPresence(GetStateForType(type), clientname, mapname);
} }
#if CMD #if CMD
GlobalVars.ProcessID = client.Id; GlobalVars.ProcessID = client.Id;

View File

@ -27,33 +27,40 @@ public class ScriptFuncs
{ {
public static string GetScriptFuncForType(ScriptType type) public static string GetScriptFuncForType(ScriptType type)
{ {
return GetScriptFuncForType(GlobalVars.UserConfiguration.SelectedClient, type);
}
public static string GetScriptFuncForType(string ClientName, ScriptType type)
{
FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);
string rbxexe = ""; string rbxexe = "";
if (GlobalVars.SelectedClientInfo.LegacyMode) if (info.LegacyMode)
{ {
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
} }
else else
{ {
rbxexe = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\RobloxApp_client.exe"; rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_client.exe";
} }
#if LAUNCHER #if LAUNCHER
string md5dir = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : ""; string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : "";
#else #else
string md5dir = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : ""; string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif #endif
string md5script = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : ""; string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
string md5exe = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : ""; string md5exe = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
switch (type) switch (type)
{ {
case ScriptType.Client: case ScriptType.Client:
return "_G.CSConnect(" return "_G.CSConnect("
+ (GlobalVars.SelectedClientInfo.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ GlobalVars.IP + "'," + GlobalVars.IP + "',"
+ GlobalVars.UserConfiguration.RobloxPort + ",'" + GlobalVars.UserConfiguration.RobloxPort + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.Loadout + "," + GlobalVars.Loadout + ","
+ md5s + ",'" + md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + "')"; + GlobalVars.UserConfiguration.PlayerTripcode + "')";
@ -65,8 +72,8 @@ public class ScriptFuncs
case ScriptType.Solo: case ScriptType.Solo:
case ScriptType.EasterEgg: case ScriptType.EasterEgg:
return "_G.CSSolo(" return "_G.CSSolo("
+ (GlobalVars.SelectedClientInfo.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
+ (GlobalVars.SelectedClientInfo.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.soloLoadout + ")"; + GlobalVars.soloLoadout + ")";
case ScriptType.Studio: case ScriptType.Studio:
return "_G.CSStudio()"; return "_G.CSStudio()";
@ -93,7 +100,13 @@ public class ScriptFuncs
return "N/A"; return "N/A";
} }
} }
public static void GenerateScriptForClient(ScriptType type) public static void GenerateScriptForClient(ScriptType type)
{
GenerateScriptForClient(GlobalVars.UserConfiguration.SelectedClient, type);
}
public static void GenerateScriptForClient(string ClientName, ScriptType type)
{ {
string code = GlobalFuncs.MultiLine( string code = GlobalFuncs.MultiLine(
"--Load Script", "--Load Script",
@ -106,7 +119,7 @@ public class ScriptFuncs
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine)); List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray(); string[] convertedList = list.ToArray();
File.WriteAllLines(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua", convertedList); File.WriteAllLines(GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua", convertedList);
} }
} }
#endregion #endregion
@ -244,10 +257,17 @@ public class ScriptFuncs
} }
public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true) public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
{
return CompileScript(GlobalVars.UserConfiguration.SelectedClient, code, tag, endtag, mapfile, luafile, rbxexe, usesharedtags);
}
public static string CompileScript(string ClientName, string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
{ {
string start = tag; string start = tag;
string end = endtag; string end = endtag;
FileFormat.ClientInfo info = GlobalFuncs.GetClientInfoValues(ClientName);
ScriptType type = GetTypeFromTag(start); ScriptType type = GetTypeFromTag(start);
//we must have the ending tag before we continue. //we must have the ending tag before we continue.
@ -268,7 +288,7 @@ public class ScriptFuncs
} }
} }
if (GlobalVars.SelectedClientInfo.Fix2007) if (info.Fix2007)
{ {
Generator.GenerateScriptForClient(type); Generator.GenerateScriptForClient(type);
} }
@ -281,12 +301,12 @@ public class ScriptFuncs
} }
#if LAUNCHER #if LAUNCHER
string md5dir = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : ""; string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location) : "";
#else #else
string md5dir = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : ""; string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif #endif
string md5script = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : ""; string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
string md5exe = !GlobalVars.SelectedClientInfo.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : ""; string md5exe = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; string md5s = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
string compiled = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version) string compiled = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version)
.Replace("%mapfile%", mapfile) .Replace("%mapfile%", mapfile)
@ -321,8 +341,8 @@ public class ScriptFuncs
.Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString()) .Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString())
.Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString()) .Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString())
.Replace("%md5launcher%", md5dir) .Replace("%md5launcher%", md5dir)
.Replace("%md5script%", GlobalVars.SelectedClientInfo.ScriptMD5) .Replace("%md5script%", info.ScriptMD5)
.Replace("%md5exe%", GlobalVars.SelectedClientInfo.ClientMD5) .Replace("%md5exe%", info.ClientMD5)
.Replace("%md5scriptd%", md5script) .Replace("%md5scriptd%", md5script)
.Replace("%md5exed%", md5exe) .Replace("%md5exed%", md5exe)
.Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString()) .Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString())

View File

@ -174,13 +174,13 @@ public class SecurityFuncs
return new String(' ', random.Next(20)); return new String(' ', random.Next(20));
} }
public static void RenameWindow(Process exe, ScriptType type, string mapname) public static void RenameWindow(Process exe, ScriptType type, string clientname, string mapname)
{ {
if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity) if (!GlobalVars.SelectedClientInfo.AlreadyHasSecurity)
{ {
int time = 500; int time = 500;
BackgroundWorker worker = new BackgroundWorker(); BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, GlobalVars.UserConfiguration.SelectedClient, mapname); worker.DoWork += (obj, e) => WorkerDoWork(exe, type, time, worker, clientname, mapname);
worker.RunWorkerAsync(); worker.RunWorkerAsync();
} }
} }
@ -238,7 +238,7 @@ public class SecurityFuncs
else else
{ {
Thread.Sleep(time); Thread.Sleep(time);
RenameWindow(exe, type, mapname); RenameWindow(exe, type, clientname, mapname);
} }
} }