Fixed launcher freezing caused by WaitForExit()
This commit is contained in:
parent
813119147d
commit
b21fda98ff
|
|
@ -990,21 +990,14 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//again, we don't need this.
|
void ClientExited(object sender, EventArgs e)
|
||||||
void ClientExited()
|
|
||||||
{
|
{
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||||
if (GlobalVars.CloseOnLaunch == true)
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
|
@ -1013,6 +1006,24 @@ namespace NovetusLauncher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
{
|
||||||
|
Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EasterEggExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||||
|
label12.Text = LocalVars.prevsplash;
|
||||||
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
{
|
||||||
|
Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StartSolo()
|
void StartSolo()
|
||||||
{
|
{
|
||||||
string luafile = LauncherFuncs.GetLuaFileName();
|
string luafile = LauncherFuncs.GetLuaFileName();
|
||||||
|
|
@ -1044,17 +1055,11 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1102,19 +1107,10 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ServerExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
if (GlobalVars.CloseOnLaunch == true)
|
|
||||||
{
|
|
||||||
Visible = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1155,17 +1151,11 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1207,16 +1197,10 @@ namespace NovetusLauncher
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
client.Start();
|
client.Start();
|
||||||
|
client.Exited += new EventHandler(EasterEggExited);
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, "");
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, "");
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, "");
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, "");
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -957,21 +957,14 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Client, GlobalVars.Map);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InMPGame, GlobalVars.Map);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: make it so we don't need this.
|
void ClientExited(object sender, EventArgs e)
|
||||||
void ClientExited(/*NetManager mgr*/)
|
|
||||||
{
|
{
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||||
if (GlobalVars.CloseOnLaunch == true)
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
|
@ -980,6 +973,24 @@ namespace NovetusLauncher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
{
|
||||||
|
Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EasterEggExited(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
||||||
|
label12.Text = LocalVars.prevsplash;
|
||||||
|
if (GlobalVars.CloseOnLaunch == true)
|
||||||
|
{
|
||||||
|
Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void StartSolo()
|
void StartSolo()
|
||||||
{
|
{
|
||||||
string luafile = LauncherFuncs.GetLuaFileName();
|
string luafile = LauncherFuncs.GetLuaFileName();
|
||||||
|
|
@ -1011,17 +1022,11 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Solo, GlobalVars.Map);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InSoloGame, GlobalVars.Map);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1069,20 +1074,10 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ServerExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Server, GlobalVars.Map);
|
||||||
//we need to consider this implementation for ALL process code.
|
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
if (GlobalVars.CloseOnLaunch == true)
|
|
||||||
{
|
|
||||||
Visible = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1123,17 +1118,11 @@ namespace NovetusLauncher
|
||||||
client.StartInfo.Arguments = args;
|
client.StartInfo.Arguments = args;
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
|
client.Exited += new EventHandler(ClientExited);
|
||||||
client.Start();
|
client.Start();
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname);
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.Studio, mapname);
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname);
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InStudio, mapname);
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
ClientExited();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
@ -1175,21 +1164,10 @@ namespace NovetusLauncher
|
||||||
client.EnableRaisingEvents = true;
|
client.EnableRaisingEvents = true;
|
||||||
ReadClientValues(GlobalVars.SelectedClient);
|
ReadClientValues(GlobalVars.SelectedClient);
|
||||||
client.Start();
|
client.Start();
|
||||||
|
client.Exited += new EventHandler(EasterEggExited);
|
||||||
client.PriorityClass = ProcessPriorityClass.RealTime;
|
client.PriorityClass = ProcessPriorityClass.RealTime;
|
||||||
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, "");
|
SecurityFuncs.RenameWindow(client, ScriptGenerator.ScriptType.EasterEgg, "");
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, "");
|
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InEasterEggGame, "");
|
||||||
//while (!client.HasExited && client.Responding)
|
|
||||||
//{
|
|
||||||
//insert events
|
|
||||||
//GlobalVars.Delay(15);
|
|
||||||
//}
|
|
||||||
client.WaitForExit();
|
|
||||||
LauncherFuncs.UpdateRichPresence(LauncherFuncs.LauncherState.InLauncher, "");
|
|
||||||
label12.Text = LocalVars.prevsplash;
|
|
||||||
if (GlobalVars.CloseOnLaunch == true)
|
|
||||||
{
|
|
||||||
Visible = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!Env.Debugging)
|
catch (Exception ex) when (!Env.Debugging)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue