Fixed clients not loading

This commit is contained in:
Bitl 2020-07-11 13:37:52 -07:00
parent 5a5bbd2ed7
commit 71bbd7dc3d
5 changed files with 954 additions and 955 deletions

View File

@ -147,24 +147,7 @@ namespace NovetusCMD
{ {
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
GlobalFuncs.ConsolePrint("Config loaded.", 3); GlobalFuncs.ConsolePrint("Config loaded.", 3);
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
static void ReadClientValues(string ClientName)
{
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
GlobalFuncs.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
ReadClientValues(ClientName);
}
else
{
GlobalFuncs.ReadClientValues(clientpath);
GlobalFuncs.ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3);
}
} }
#endregion #endregion
@ -291,7 +274,7 @@ namespace NovetusCMD
} }
else else
{ {
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
} }
InitUPnP(); InitUPnP();

View File

@ -402,7 +402,42 @@ public class GlobalFuncs
} }
} }
public static void ReadClientValues(string clientpath) #if LAUNCHER
public static void ReadClientValues(string ClientName, RichTextBox box)
#else
public static void ReadClientValues(string ClientName)
#endif
{
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
#if LAUNCHER
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2, box);
#elif CMD
GlobalFuncs.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
#elif URI
#endif
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
#if LAUNCHER
ReadClientValues(ClientName, box);
#else
ReadClientValues(ClientName);
#endif
}
else
{
LoadClientValues(clientpath);
#if LAUNCHER
ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3, box);
#elif CMD
GlobalFuncs.ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3);
#elif URI
#endif
}
}
public static void LoadClientValues(string clientpath)
{ {
string file, usesplayername, usesid, warning, string file, usesplayername, usesid, warning,
legacymode, clientmd5, scriptmd5, legacymode, clientmd5, scriptmd5,
@ -959,7 +994,11 @@ public class GlobalFuncs
{ {
if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) && SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient)) if (SecurityFuncs.checkClientMD5(GlobalVars.UserConfiguration.SelectedClient) && SecurityFuncs.checkScriptMD5(GlobalVars.UserConfiguration.SelectedClient))
{ {
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, mapname, e);
#endif
} }
else else
{ {
@ -975,17 +1014,29 @@ public class GlobalFuncs
} }
else else
{ {
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, mapname, e);
#endif
} }
} }
else else
{ {
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, mapname, e);
#endif
} }
} }
else else
{ {
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e); OpenClient(type, rbxexe, args, mapname, e);
#endif
} }
} }
catch (Exception ex) catch (Exception ex)
@ -1001,13 +1052,21 @@ public class GlobalFuncs
} }
} }
#if LAUNCHER
private static void OpenClient(ScriptType type, string rbxexe, string args, string mapname, EventHandler e, RichTextBox box)
#else
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 mapname, EventHandler e)
#endif
{ {
Process client = new Process(); Process client = new Process();
client.StartInfo.FileName = rbxexe; client.StartInfo.FileName = rbxexe;
client.StartInfo.Arguments = args; client.StartInfo.Arguments = args;
client.EnableRaisingEvents = true; client.EnableRaisingEvents = true;
#if LAUNCHER
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, box);
#else
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
#endif
client.Exited += e; client.Exited += e;
client.Start(); client.Start();
client.PriorityClass = ProcessPriorityClass.RealTime; client.PriorityClass = ProcessPriorityClass.RealTime;

View File

@ -544,7 +544,7 @@ namespace NovetusLauncher
} }
GlobalFuncs.ConsolePrint("Config loaded.", 3, richTextBox1); GlobalFuncs.ConsolePrint("Config loaded.", 3, richTextBox1);
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); ReadClientValues();
} }
void WriteConfigValues() void WriteConfigValues()
@ -559,63 +559,50 @@ namespace NovetusLauncher
GlobalFuncs.ConsolePrint("Config Saved.", 3, richTextBox1); GlobalFuncs.ConsolePrint("Config Saved.", 3, richTextBox1);
} }
void ReadClientValues(string ClientName) void ReadClientValues()
{ {
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, richTextBox1);
if (!File.Exists(clientpath)) switch (GlobalVars.SelectedClientInfo.UsesPlayerName)
{ {
GlobalFuncs.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2, richTextBox1); case true:
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Enabled = true;
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; break;
ReadClientValues(ClientName); case false:
textBox2.Enabled = false;
break;
}
switch (GlobalVars.SelectedClientInfo.UsesID)
{
case true:
textBox5.Enabled = true;
button4.Enabled = true;
if (GlobalVars.IP.Equals("localhost"))
{
checkBox3.Enabled = true;
}
break;
case false:
textBox5.Enabled = false;
button4.Enabled = false;
checkBox3.Enabled = false;
GlobalVars.LocalPlayMode = false;
break;
}
if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning))
{
label30.Text = GlobalVars.SelectedClientInfo.Warning;
label30.Visible = true;
} }
else else
{ {
GlobalFuncs.ReadClientValues(clientpath); label30.Visible = false;
switch (GlobalVars.SelectedClientInfo.UsesPlayerName)
{
case true:
textBox2.Enabled = true;
break;
case false:
textBox2.Enabled = false;
break;
}
switch (GlobalVars.SelectedClientInfo.UsesID)
{
case true:
textBox5.Enabled = true;
button4.Enabled = true;
if (GlobalVars.IP.Equals("localhost"))
{
checkBox3.Enabled = true;
}
break;
case false:
textBox5.Enabled = false;
button4.Enabled = false;
checkBox3.Enabled = false;
GlobalVars.LocalPlayMode = false;
break;
}
if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning))
{
label30.Text = GlobalVars.SelectedClientInfo.Warning;
label30.Visible = true;
}
else
{
label30.Visible = false;
}
textBox6.Text = GlobalVars.SelectedClientInfo.Description;
label26.Text = GlobalVars.UserConfiguration.SelectedClient;
GlobalFuncs.ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3, richTextBox1);
} }
textBox6.Text = GlobalVars.SelectedClientInfo.Description;
label26.Text = GlobalVars.UserConfiguration.SelectedClient;
} }
void GeneratePlayerID() void GeneratePlayerID()
@ -662,7 +649,7 @@ namespace NovetusLauncher
void ListBox2SelectedIndexChanged(object sender, EventArgs e) void ListBox2SelectedIndexChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString(); GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString();
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); ReadClientValues();
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, ""); GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
} }

View File

@ -33,22 +33,6 @@ namespace NovetusURI
} }
} }
public static void ReadClientValues(string ClientName)
{
string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov";
if (!File.Exists(clientpath))
{
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus Launcher - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
ReadClientValues(ClientName);
}
else
{
GlobalFuncs.ReadClientValues(clientpath);
}
}
public static void SetupURIValues() public static void SetupURIValues()
{ {
string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", ""); string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
@ -60,7 +44,7 @@ namespace NovetusURI
GlobalVars.UserConfiguration.SelectedClient = client; GlobalVars.UserConfiguration.SelectedClient = client;
GlobalVars.IP = ip; GlobalVars.IP = ip;
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port);
LocalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
} }
} }
#endregion #endregion