add seperate folders option

This commit is contained in:
Bitl 2021-10-27 12:07:13 -07:00
parent ce73392f56
commit 284944db9d
6 changed files with 159 additions and 14 deletions

View File

@ -19,6 +19,7 @@ public class FileFormat
Fix2007 = false;
AlreadyHasSecurity = false;
ClientLoadOptions = Settings.ClientLoadOptions.Client_2008AndUp;
SeperateFolders = false;
CommandLineArgs = "%args%";
}
@ -31,6 +32,7 @@ public class FileFormat
public string ScriptMD5 { get; set; }
public bool Fix2007 { get; set; }
public bool AlreadyHasSecurity { get; set; }
public bool SeperateFolders { get; set; }
public Settings.ClientLoadOptions ClientLoadOptions { get; set; }
public string CommandLineArgs { get; set; }
}

View File

@ -764,6 +764,11 @@ public class GlobalFuncs
{
ClientName = "\\RobloxApp_client.exe";
}
else if (File.Exists(path + "\\client\\RobloxApp_client.exe"))
{
ClientName = "\\client\\RobloxApp_client.exe";
DefaultClientInfo.SeperateFolders = true;
}
else if (File.Exists(path + "\\RobloxApp.exe"))
{
ClientName = "\\RobloxApp.exe";
@ -817,6 +822,7 @@ public class GlobalFuncs
SecurityFuncs.Base64Encode(DefaultClientInfo.Fix2007.ToString()),
SecurityFuncs.Base64Encode(DefaultClientInfo.AlreadyHasSecurity.ToString()),
SecurityFuncs.Base64Encode(((int)DefaultClientInfo.ClientLoadOptions).ToString()),
SecurityFuncs.Base64Encode(DefaultClientInfo.SeperateFolders.ToString()),
SecurityFuncs.Base64Encode(DefaultClientInfo.CommandLineArgs.ToString())
};
@ -985,7 +991,7 @@ public class GlobalFuncs
string file, usesplayername, usesid, warning,
legacymode, clientmd5, scriptmd5,
desc, fix2007, alreadyhassecurity,
clientloadoptions, commandlineargs;
clientloadoptions, commandlineargs, folders;
using (StreamReader reader = new StreamReader(clientpath))
{
@ -1007,11 +1013,23 @@ public class GlobalFuncs
try
{
commandlineargs = SecurityFuncs.Base64Decode(result[11]);
bool parsedValue;
if (bool.TryParse(commandlineargs, out parsedValue))
{
folders = SecurityFuncs.Base64Decode(result[11]);
commandlineargs = SecurityFuncs.Base64Decode(result[12]);
}
else
{
folders = "False";
}
}
catch
{
//fake this option until we properly apply it.
clientloadoptions = "2";
folders = "False";
commandlineargs = SecurityFuncs.Base64Decode(result[10]);
}
@ -1032,7 +1050,8 @@ public class GlobalFuncs
{
info.ClientLoadOptions = (Settings.ClientLoadOptions)Convert.ToInt32(clientloadoptions);
}
info.SeperateFolders = Convert.ToBoolean(folders);
info.CommandLineArgs = commandlineargs;
}
@ -1650,12 +1669,12 @@ public class GlobalFuncs
}
}
public static string GetLuaFileName()
public static string GetLuaFileName(ScriptType type)
{
return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient);
return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient, type);
}
public static string GetLuaFileName(string ClientName)
public static string GetLuaFileName(string ClientName, ScriptType type)
{
string luafile = "";
@ -1665,12 +1684,44 @@ public class GlobalFuncs
}
else
{
luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua";
if (GlobalVars.SelectedClientInfo.SeperateFolders)
{
luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua";
}
else
{
luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua";
}
}
return luafile;
}
public static string GetClientSeperateFolderName(ScriptType type)
{
string rbxfolder = "";
switch (type)
{
case ScriptType.Client:
case ScriptType.Solo:
case ScriptType.EasterEgg:
rbxfolder = "client";
break;
case ScriptType.Server:
rbxfolder = "server";
break;
case ScriptType.Studio:
rbxfolder = "studio";
break;
case ScriptType.None:
default:
rbxfolder = "";
break;
}
return rbxfolder;
}
public static string GetClientEXEDir(ScriptType type)
{
return GetClientEXEDir(GlobalVars.UserConfiguration.SelectedClient, type);
@ -1683,6 +1734,27 @@ public class GlobalFuncs
{
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
}
else if (GlobalVars.SelectedClientInfo.SeperateFolders)
{
switch (type)
{
case ScriptType.Client:
case ScriptType.Solo:
case ScriptType.EasterEgg:
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_client.exe";
break;
case ScriptType.Server:
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_server.exe";
break;
case ScriptType.Studio:
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_studio.exe";
break;
case ScriptType.None:
default:
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
break;
}
}
else
{
switch (type)
@ -1742,7 +1814,7 @@ public class GlobalFuncs
ReadClientValues(ClientName);
#endif
string luafile = GetLuaFileName(ClientName);
string luafile = GetLuaFileName(ClientName, type);
string rbxexe = GetClientEXEDir(ClientName, type);
string mapfile = type.Equals(ScriptType.EasterEgg) ? GlobalPaths.ConfigDirData + "\\Appreciation.rbxl" : (nomap ? "" : GlobalVars.UserConfiguration.MapPath);
string mapname = type.Equals(ScriptType.EasterEgg) ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map);

View File

@ -39,6 +39,10 @@ public class ScriptFuncs
{
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe";
}
if (info.SeperateFolders)
{
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\client\\RobloxApp_client.exe";
}
else
{
rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_client.exe";
@ -117,14 +121,30 @@ public class ScriptFuncs
string code = GlobalFuncs.MultiLine(
"--Load Script",
//scriptcontents,
"dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')",
(GlobalVars.SelectedClientInfo.SeperateFolders ?
"dofile('rbxasset://../../content/scripts/" + GlobalPaths.ScriptName + ".lua')" :
"dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')"),
GetScriptFuncForType(type),
!string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? "dofile('" + GlobalPaths.AddonScriptPath + "')" : ""
);
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray();
File.WriteAllLines(GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua", convertedList);
if (GlobalVars.SelectedClientInfo.SeperateFolders)
{
string scriptsFolder = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts";
if (!Directory.Exists(scriptsFolder))
{
Directory.CreateDirectory(scriptsFolder);
}
}
File.WriteAllLines(
(GlobalVars.SelectedClientInfo.SeperateFolders ?
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua":
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"),
convertedList);
}
}
#endregion

View File

@ -95,7 +95,11 @@ public class SecurityFuncs
if (GlobalVars.SelectedClientInfo.LegacyMode)
{
rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp.exe";
}
}
if (GlobalVars.SelectedClientInfo.SeperateFolders)
{
rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\client\\RobloxApp_client.exe";
}
else
{
rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe";

View File

@ -143,6 +143,7 @@ partial class ClientinfoEditor
this.label9 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -1058,12 +1059,24 @@ partial class ClientinfoEditor
this.label10.TabIndex = 33;
this.label10.Text = "When applying the settings (if there is a settings XML file):";
//
// checkBox5
//
this.checkBox5.AutoSize = true;
this.checkBox5.Location = new System.Drawing.Point(171, 108);
this.checkBox5.Name = "checkBox5";
this.checkBox5.Size = new System.Drawing.Size(133, 17);
this.checkBox5.TabIndex = 34;
this.checkBox5.Text = "Uses Seperate Folders";
this.checkBox5.UseVisualStyleBackColor = true;
this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
//
// ClientinfoEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(632, 351);
this.Controls.Add(this.checkBox5);
this.Controls.Add(this.label10);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label9);
@ -1202,4 +1215,5 @@ partial class ClientinfoEditor
private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem notificationsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem joinportToolStripMenuItem;
private System.Windows.Forms.CheckBox checkBox5;
}

View File

@ -90,7 +90,7 @@ public partial class ClientinfoEditor : Form
{
string file, usesplayername, usesid, warning, legacymode, clientmd5,
scriptmd5, desc, locked, fix2007, alreadyhassecurity,
cmdargsorclientoptions, commandargsver2;
cmdargsorclientoptions, commandargsver2, folders;
using (StreamReader reader = new StreamReader(ofd.FileName))
{
@ -124,12 +124,30 @@ public partial class ClientinfoEditor : Form
fix2007 = SecurityFuncs.Base64Decode(result[8]);
alreadyhassecurity = SecurityFuncs.Base64Decode(result[9]);
cmdargsorclientoptions = SecurityFuncs.Base64Decode(result[10]);
folders = "";
commandargsver2 = "";
try
{
if (IsVersion2)
{
commandargsver2 = SecurityFuncs.Base64Decode(result[11]);
bool parsedValue;
if (bool.TryParse(commandargsver2, out parsedValue))
{
folders = SecurityFuncs.Base64Decode(result[11]);
commandargsver2 = SecurityFuncs.Base64Decode(result[12]);
}
else
{
folders = "False";
if (!label9.Text.Equals("v1 (v1.1)"))
{
label9.Text = "v2 (v1.3 Pre-Release 5)";
}
}
}
}
catch (Exception ex)
@ -172,6 +190,7 @@ public partial class ClientinfoEditor : Form
SelectedClientInfo.Description = desc;
SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007);
SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity);
SelectedClientInfo.SeperateFolders = Convert.ToBoolean(folders);
try
{
@ -204,6 +223,7 @@ public partial class ClientinfoEditor : Form
checkBox1.Checked = SelectedClientInfo.UsesPlayerName;
checkBox2.Checked = SelectedClientInfo.UsesID;
checkBox3.Checked = SelectedClientInfo.LegacyMode;
checkBox5.Checked = SelectedClientInfo.SeperateFolders;
checkBox6.Checked = SelectedClientInfo.Fix2007;
checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity;
@ -231,6 +251,7 @@ public partial class ClientinfoEditor : Form
SecurityFuncs.Base64Encode(SelectedClientInfo.Fix2007.ToString()),
SecurityFuncs.Base64Encode(SelectedClientInfo.AlreadyHasSecurity.ToString()),
SecurityFuncs.Base64Encode(((int)SelectedClientInfo.ClientLoadOptions).ToString()),
SecurityFuncs.Base64Encode(SelectedClientInfo.SeperateFolders.ToString()),
SecurityFuncs.Base64Encode(SelectedClientInfo.CommandLineArgs.ToString())
};
File.WriteAllText(SelectedClientInfoPath + "\\clientinfo.nov", SecurityFuncs.Base64Encode(string.Join("|", lines)));
@ -269,6 +290,7 @@ public partial class ClientinfoEditor : Form
SelectedClientInfo.Fix2007.ToString(),
SelectedClientInfo.AlreadyHasSecurity.ToString(),
((int)SelectedClientInfo.ClientLoadOptions).ToString(),
SelectedClientInfo.SeperateFolders.ToString(),
SelectedClientInfo.CommandLineArgs.ToString()
};
File.WriteAllLines(sfd.FileName, lines);
@ -303,6 +325,7 @@ public partial class ClientinfoEditor : Form
ini.IniWriteValue(section, "Fix2007", SelectedClientInfo.Fix2007.ToString());
ini.IniWriteValue(section, "AlreadyHasSecurity", SelectedClientInfo.AlreadyHasSecurity.ToString());
ini.IniWriteValue(section, "ClientLoadOptions", ((int)SelectedClientInfo.ClientLoadOptions).ToString());
ini.IniWriteValue(section, "SeperateFolders", SelectedClientInfo.SeperateFolders.ToString());
ini.IniWriteValue(section, "CommandLineArgs", SelectedClientInfo.CommandLineArgs.ToString());
}
}
@ -366,6 +389,11 @@ public partial class ClientinfoEditor : Form
SelectedClientInfo.ClientLoadOptions = (Settings.ClientLoadOptions)comboBox1.SelectedIndex;
BeginInvoke(new Action(() => { comboBox1.Select(0, 0); }));
}
private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
SelectedClientInfo.SeperateFolders = checkBox5.Checked;
}
#endregion
#region Functions
@ -384,13 +412,17 @@ public partial class ClientinfoEditor : Form
string ClientName = "";
if (!SelectedClientInfo.LegacyMode)
if (SelectedClientInfo.LegacyMode)
{
ClientName = "\\RobloxApp_client.exe";
ClientName = "\\RobloxApp.exe";
}
else if (SelectedClientInfo.SeperateFolders)
{
ClientName = "\\client\\RobloxApp_client.exe";
}
else
{
ClientName = "\\RobloxApp.exe";
ClientName = "\\RobloxApp_client.exe";
}
string ClientMD5 = File.Exists(SelectedClientInfoPath + ClientName) ? SecurityFuncs.GenerateMD5(SelectedClientInfoPath + ClientName) : "";
@ -431,6 +463,7 @@ public partial class ClientinfoEditor : Form
checkBox2.Checked = SelectedClientInfo.UsesID;
checkBox3.Checked = SelectedClientInfo.LegacyMode;
checkBox4.Checked = Locked;
checkBox5.Checked = SelectedClientInfo.SeperateFolders;
checkBox6.Checked = SelectedClientInfo.Fix2007;
checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity;
comboBox1.SelectedIndex = (int)SelectedClientInfo.ClientLoadOptions;