removed REALLY bad code. What the FUCK?!?

This commit is contained in:
Bitl 2021-11-06 15:15:45 -07:00
parent 5e38a35d5a
commit 7706658f9c
3 changed files with 21 additions and 27 deletions

View File

@ -187,6 +187,12 @@ namespace NovetusCMD
{ {
WriteConfigValues(); WriteConfigValues();
} }
if (GlobalVars.RequestToOutputInfo)
{
GlobalFuncs.FixedFileDelete(GlobalPaths.BasePath + "\\" + GlobalVars.ServerInfoFileName);
}
Application.Exit(); Application.Exit();
} }
@ -269,7 +275,7 @@ namespace NovetusCMD
} }
else else
{ {
GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the default map.", 4); GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the map defined in the INI file.", 4);
} }
if (CommandLine["client"] != null) if (CommandLine["client"] != null)
@ -279,7 +285,7 @@ namespace NovetusCMD
} }
else else
{ {
GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the default client.", 4); GlobalFuncs.ConsolePrint("NovetusCMD will launch the server with the client defined in the INI file.", 4);
} }
if (CommandLine["port"] != null) if (CommandLine["port"] != null)

View File

@ -2261,19 +2261,19 @@ public class GlobalFuncs
if (GlobalVars.RequestToOutputInfo) if (GlobalVars.RequestToOutputInfo)
{ {
string[] lines1 = { string[] lines1 = {
SecurityFuncs.Base64Encode((!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP)), SecurityFuncs.Base64Encode(!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
}; };
string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1, true)); string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true);
string[] lines2 = { string[] lines2 = {
SecurityFuncs.Base64Encode("localhost"), SecurityFuncs.Base64Encode("localhost"),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
}; };
string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2, true)); string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true);
string text = MultiLine( string[] text = {
"Process ID: " + (GlobalVars.ProcessID == 0 ? "N/A" : GlobalVars.ProcessID.ToString()), "Process ID: " + (GlobalVars.ProcessID == 0 ? "N/A" : GlobalVars.ProcessID.ToString()),
"Don't copy the Process ID when sharing the server.", "Don't copy the Process ID when sharing the server.",
"--------------------", "--------------------",
@ -2288,10 +2288,11 @@ public class GlobalFuncs
URI, URI,
"Local URI Link:", "Local URI Link:",
URI2 URI2
); };
File.WriteAllText(GlobalPaths.BasePath + "\\" + GlobalVars.ServerInfoFileName, GlobalFuncs.RemoveEmptyLines(text)); string txt = GlobalPaths.BasePath + "\\" + GlobalVars.ServerInfoFileName;
GlobalFuncs.ConsolePrint("Server Information sent to file " + GlobalPaths.BasePath + "\\" + GlobalVars.ServerInfoFileName, 4); File.WriteAllLines(txt, text);
ConsolePrint("Server Information sent to file " + txt, 4);
} }
} }
#endif #endif
@ -2330,16 +2331,6 @@ public class GlobalFuncs
}*/ }*/
} }
public static string MultiLine(params string[] args)
{
return string.Join(Environment.NewLine, args);
}
public static string RemoveEmptyLines(string lines)
{
return Regex.Replace(lines, @"^\s*$\n|\r", string.Empty, RegexOptions.Multiline).TrimEnd();
}
// Credit to Carrot for the original code. Rewote it to be smaller. // Credit to Carrot for the original code. Rewote it to be smaller.
public static string CryptStringWithByte(string word) public static string CryptStringWithByte(string word)
{ {

View File

@ -103,18 +103,15 @@ public class ScriptFuncs
public static void GenerateScriptForClient(string ClientName, ScriptType type) public static void GenerateScriptForClient(string ClientName, ScriptType type)
{ {
string code = GlobalFuncs.MultiLine( string[] code = {
"--Load Script", "--Load Script",
//scriptcontents, //scriptcontents,
(GlobalVars.SelectedClientInfo.SeperateFolders ? (GlobalVars.SelectedClientInfo.SeperateFolders ? "" +
"dofile('rbxasset://../../content/scripts/" + GlobalPaths.ScriptName + ".lua')" : "dofile('rbxasset://../../content/scripts/" + GlobalPaths.ScriptName + ".lua')" :
"dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')"), "dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')"),
GetScriptFuncForType(type), GetScriptFuncForType(type),
!string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? "dofile('" + GlobalPaths.AddonScriptPath + "')" : "" !string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? "dofile('" + GlobalPaths.AddonScriptPath + "')" : ""
); };
List<string> list = new List<string>(Regex.Split(code, Environment.NewLine));
string[] convertedList = list.ToArray();
if (GlobalVars.SelectedClientInfo.SeperateFolders) if (GlobalVars.SelectedClientInfo.SeperateFolders)
{ {
@ -129,7 +126,7 @@ public class ScriptFuncs
(GlobalVars.SelectedClientInfo.SeperateFolders ? (GlobalVars.SelectedClientInfo.SeperateFolders ?
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua": GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua":
GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"), GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"),
convertedList); code);
} }
} }
#endregion #endregion