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
{
@ -47,7 +46,7 @@ namespace NovetusLauncher
{
try
{
NetFuncs.InitUPnP(DeviceFound,DeviceLost);
NetFuncs.InitUPnP(DeviceFound, DeviceLost);
GlobalFuncs.ConsolePrint("UPnP: Service initialized", 3, richTextBox1);
}
catch (Exception ex)
@ -63,7 +62,7 @@ namespace NovetusLauncher
{
try
{
NetFuncs.StartUPnP(device,protocol,port);
NetFuncs.StartUPnP(device, protocol, port);
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " opened on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
}
catch (Exception ex)
@ -79,7 +78,7 @@ namespace NovetusLauncher
{
try
{
NetFuncs.StopUPnP(device,protocol,port);
NetFuncs.StopUPnP(device, protocol, port);
GlobalFuncs.ConsolePrint("UPnP: Port " + port + " closed on '" + device.GetExternalIP() + "' (" + protocol.ToString() + ")", 3, richTextBox1);
}
catch (Exception ex)
@ -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, "");
}
@ -766,9 +752,9 @@ namespace NovetusLauncher
}
}
if ( e.Modifiers == Keys.Control )
if (e.Modifiers == Keys.Control)
{
switch(e.KeyCode)
switch (e.KeyCode)
{
case Keys.X:
case Keys.Z:
@ -976,13 +962,13 @@ namespace NovetusLauncher
catch (Exception ex)
{
GlobalFuncs.ConsolePrint("ERROR - Failed to register. (" + ex.Message + ")", 2, richTextBox1);
MessageBox.Show("Failed to register. (Error: " + ex.Message + ")","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
GlobalFuncs.ConsolePrint("ERROR - Failed to register. (Did not run as Administrator)", 2, richTextBox1);
MessageBox.Show("Failed to register. (Error: Did not run as Administrator)","Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@ -1046,7 +1032,7 @@ namespace NovetusLauncher
void Button6Click(object sender, EventArgs e)
{
Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\",@"\"));
Process.Start("explorer.exe", GlobalPaths.MapsDir.Replace(@"\\", @"\"));
}
void CheckBox4CheckedChanged(object sender, EventArgs e)
@ -1065,7 +1051,7 @@ namespace NovetusLauncher
_fieldsTreeCache.Nodes.Clear();
string mapdir = GlobalPaths.MapsDir;
TreeNodeHelper.ListDirectory(treeView1, mapdir, ".rbxl");
TreeNodeHelper.CopyNodes(treeView1.Nodes,_fieldsTreeCache.Nodes);
TreeNodeHelper.CopyNodes(treeView1.Nodes, _fieldsTreeCache.Nodes);
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, treeView1.Nodes);
treeView1.Focus();
if (File.Exists(GlobalPaths.RootPath + @"\\" + treeView1.SelectedNode.FullPath.ToString().Replace(".rbxl", "") + "_desc.txt"))
@ -1215,7 +1201,7 @@ namespace NovetusLauncher
DialogResult result = MessageBox.Show("If you want to test out your place, you will have to save your place in Novetus's map folder, then launch your place in Play Solo." + Environment.NewLine + Environment.NewLine + "Press Yes to launch Studio with a map, or No to launch Studio without a map.", "Novetus - Launch ROBLOX Studio", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
bool nomap = false;
switch(result)
switch (result)
{
case DialogResult.No:
nomap = true;

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