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.ConsolePrint("Config loaded.", 3);
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);
}
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
#endregion
@ -291,7 +274,7 @@ namespace NovetusCMD
}
else
{
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
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,
legacymode, clientmd5, scriptmd5,
@ -959,7 +994,11 @@ public class GlobalFuncs
{
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);
#endif
}
else
{
@ -975,17 +1014,29 @@ public class GlobalFuncs
}
else
{
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e);
#endif
}
}
else
{
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e);
#endif
}
}
else
{
#if LAUNCHER
OpenClient(type, rbxexe, args, mapname, e, box);
#else
OpenClient(type, rbxexe, args, mapname, e);
#endif
}
}
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)
#endif
{
Process client = new Process();
client.StartInfo.FileName = rbxexe;
client.StartInfo.Arguments = args;
client.EnableRaisingEvents = true;
#if LAUNCHER
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, box);
#else
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
#endif
client.Exited += e;
client.Start();
client.PriorityClass = ProcessPriorityClass.RealTime;

View File

@ -6,16 +6,15 @@
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using Mono.Nat;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.ComponentModel;
using System.Reflection;
using Mono.Nat;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace NovetusLauncher
{
@ -508,7 +507,7 @@ namespace NovetusLauncher
}
GlobalFuncs.ConsolePrint("Config loaded.", 3, richTextBox1);
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
ReadClientValues();
}
void WriteConfigValues()
@ -523,20 +522,9 @@ namespace NovetusLauncher
GlobalFuncs.ConsolePrint("Config Saved.", 3, richTextBox1);
}
void ReadClientValues(string ClientName)
void ReadClientValues()
{
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, richTextBox1);
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);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
ReadClientValues(ClientName);
}
else
{
GlobalFuncs.ReadClientValues(clientpath);
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, richTextBox1);
switch (GlobalVars.SelectedClientInfo.UsesPlayerName)
{
@ -578,8 +566,6 @@ namespace NovetusLauncher
textBox6.Text = GlobalVars.SelectedClientInfo.Description;
label26.Text = GlobalVars.UserConfiguration.SelectedClient;
GlobalFuncs.ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3, richTextBox1);
}
}
void GeneratePlayerID()
@ -626,7 +612,7 @@ namespace NovetusLauncher
void ListBox2SelectedIndexChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString();
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
ReadClientValues();
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
}

View File

@ -544,7 +544,7 @@ namespace NovetusLauncher
}
GlobalFuncs.ConsolePrint("Config loaded.", 3, richTextBox1);
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
ReadClientValues();
}
void WriteConfigValues()
@ -559,20 +559,9 @@ namespace NovetusLauncher
GlobalFuncs.ConsolePrint("Config Saved.", 3, richTextBox1);
}
void ReadClientValues(string ClientName)
void ReadClientValues()
{
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, richTextBox1);
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);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
ReadClientValues(ClientName);
}
else
{
GlobalFuncs.ReadClientValues(clientpath);
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, richTextBox1);
switch (GlobalVars.SelectedClientInfo.UsesPlayerName)
{
@ -614,8 +603,6 @@ namespace NovetusLauncher
textBox6.Text = GlobalVars.SelectedClientInfo.Description;
label26.Text = GlobalVars.UserConfiguration.SelectedClient;
GlobalFuncs.ConsolePrint("Client '" + GlobalVars.UserConfiguration.SelectedClient + "' successfully loaded.", 3, richTextBox1);
}
}
void GeneratePlayerID()
@ -662,7 +649,7 @@ namespace NovetusLauncher
void ListBox2SelectedIndexChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.SelectedClient = listBox2.SelectedItem.ToString();
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
ReadClientValues();
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()
{
string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
@ -60,7 +44,7 @@ namespace NovetusURI
GlobalVars.UserConfiguration.SelectedClient = client;
GlobalVars.IP = ip;
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port);
LocalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
GlobalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient);
}
}
#endregion