mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Fix process detection
also fixed a bug with reshade shader uninstalling
This commit is contained in:
parent
ad886df373
commit
b61f8730ef
@ -187,10 +187,8 @@ namespace Bloxstrap
|
|||||||
mutex = new(true, "Bloxstrap_MenuMutex");
|
mutex = new(true, "Bloxstrap_MenuMutex");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !DEBUG
|
|
||||||
if (Utilities.GetProcessCount(ProjectName) > 1)
|
if (Utilities.GetProcessCount(ProjectName) > 1)
|
||||||
ShowMessageBox($"{ProjectName} is currently running, likely as a background Roblox process. Please note that not all your changes will immediately apply until you close all currently open Roblox instances.", MessageBoxImage.Information);
|
ShowMessageBox($"{ProjectName} is currently running, likely as a background Roblox process. Please note that not all your changes will immediately apply until you close all currently open Roblox instances.", MessageBoxImage.Information);
|
||||||
#endif
|
|
||||||
|
|
||||||
new MainWindow().ShowDialog();
|
new MainWindow().ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ namespace Bloxstrap
|
|||||||
CheckInstallMigration();
|
CheckInstallMigration();
|
||||||
|
|
||||||
// if roblox needs updating but is running and we have multiple instances open, ignore update for now
|
// if roblox needs updating but is running and we have multiple instances open, ignore update for now
|
||||||
if (App.IsFirstRun || _versionGuid != App.State.Prop.VersionGuid && Utilities.GetProcessCount("RobloxPlayerBeta") == 0)
|
if (App.IsFirstRun || _versionGuid != App.State.Prop.VersionGuid && !Utilities.CheckIfRobloxRunning())
|
||||||
await InstallLatestVersion();
|
await InstallLatestVersion();
|
||||||
|
|
||||||
// last time the version folder was set, it was set to the latest version guid
|
// last time the version folder was set, it was set to the latest version guid
|
||||||
@ -299,34 +299,6 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Finished migrating install location!");
|
App.Logger.WriteLine("[Bootstrapper::CheckInstallMigration] Finished migrating install location!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShutdownIfRobloxRunning()
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::ShutdownIfRobloxRunning] Checking if Roblox is running...");
|
|
||||||
|
|
||||||
if (Utilities.GetProcessCount("RobloxPlayerBeta") == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::ShutdownIfRobloxRunning] Attempting to shutdown Roblox...");
|
|
||||||
|
|
||||||
Dialog?.PromptShutdown();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (Process process in Process.GetProcessesByName("RobloxPlayerBeta"))
|
|
||||||
{
|
|
||||||
process.CloseMainWindow();
|
|
||||||
process.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::ShutdownIfRobloxRunning] Failed to close process! {ex}");
|
|
||||||
}
|
|
||||||
|
|
||||||
App.Logger.WriteLine($"[Bootstrapper::ShutdownIfRobloxRunning] All Roblox processes closed");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task StartRoblox()
|
private async Task StartRoblox()
|
||||||
{
|
{
|
||||||
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
||||||
@ -601,7 +573,28 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private void Uninstall()
|
private void Uninstall()
|
||||||
{
|
{
|
||||||
ShutdownIfRobloxRunning();
|
// prompt to shutdown roblox if its currently running
|
||||||
|
if (Utilities.CheckIfRobloxRunning())
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::Uninstall] Prompting to shut down all open Roblox instances");
|
||||||
|
|
||||||
|
Dialog?.PromptShutdown();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (Process process in Process.GetProcessesByName("RobloxPlayerBeta"))
|
||||||
|
{
|
||||||
|
process.CloseMainWindow();
|
||||||
|
process.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::ShutdownIfRobloxRunning] Failed to close process! {ex}");
|
||||||
|
}
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::Uninstall] All Roblox processes closed");
|
||||||
|
}
|
||||||
|
|
||||||
SetStatus($"Uninstalling {App.ProjectName}...");
|
SetStatus($"Uninstalling {App.ProjectName}...");
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace Bloxstrap.Helpers
|
|||||||
if (log)
|
if (log)
|
||||||
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Checking if '{processName}' is running...");
|
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Checking if '{processName}' is running...");
|
||||||
|
|
||||||
Process[] processes = Process.GetProcessesByName("RobloxPlayerBeta");
|
Process[] processes = Process.GetProcessesByName(processName);
|
||||||
|
|
||||||
if (log)
|
if (log)
|
||||||
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Found {processes.Length} process(es) running for '{processName}'");
|
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Found {processes.Length} process(es) running for '{processName}'");
|
||||||
@ -39,10 +39,11 @@ namespace Bloxstrap.Helpers
|
|||||||
return processes.Length;
|
return processes.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenWebsite(string website)
|
public static bool CheckIfProcessRunning(string processName, bool log = true) => GetProcessCount(processName, log) >= 1;
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo { FileName = website, UseShellExecute = true });
|
public static bool CheckIfRobloxRunning(bool log = true) => CheckIfProcessRunning("RobloxPlayerBeta", log);
|
||||||
}
|
|
||||||
|
public static void OpenWebsite(string website) => Process.Start(new ProcessStartInfo { FileName = website, UseShellExecute = true });
|
||||||
|
|
||||||
public static async Task<T?> GetJson<T>(string url)
|
public static async Task<T?> GetJson<T>(string url)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ namespace Bloxstrap.Integrations
|
|||||||
if (!App.Settings.Prop.RFUEnabled)
|
if (!App.Settings.Prop.RFUEnabled)
|
||||||
{
|
{
|
||||||
// don't delete rbxfpsunlocker if rbxfpsunlocker and roblox is currently running
|
// don't delete rbxfpsunlocker if rbxfpsunlocker and roblox is currently running
|
||||||
if (Utilities.GetProcessCount(ApplicationName) > 0 && Utilities.GetProcessCount("RobloxPlayerBeta") > 0)
|
if (Utilities.CheckIfProcessRunning(ApplicationName) && Utilities.CheckIfRobloxRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
App.State.Prop.RbxFpsUnlockerVersion = "";
|
App.State.Prop.RbxFpsUnlockerVersion = "";
|
||||||
|
@ -318,13 +318,15 @@ namespace Bloxstrap.Integrations
|
|||||||
if (shaderSearchPaths.Contains(name))
|
if (shaderSearchPaths.Contains(name))
|
||||||
{
|
{
|
||||||
string searchPath = GetSearchPath("Shaders", name);
|
string searchPath = GetSearchPath("Shaders", name);
|
||||||
data["GENERAL"]["EffectSearchPaths"] = shaderSearchPaths.Remove(shaderSearchPaths.IndexOf(searchPath), searchPath.Length);
|
if (shaderSearchPaths.Contains(searchPath))
|
||||||
|
data["GENERAL"]["EffectSearchPaths"] = shaderSearchPaths.Remove(shaderSearchPaths.IndexOf(searchPath), searchPath.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textureSearchPaths.Contains(name))
|
if (textureSearchPaths.Contains(name))
|
||||||
{
|
{
|
||||||
string searchPath = GetSearchPath("Textures", name);
|
string searchPath = GetSearchPath("Textures", name);
|
||||||
data["GENERAL"]["TextureSearchPaths"] = textureSearchPaths.Remove(textureSearchPaths.IndexOf(searchPath), searchPath.Length);
|
if (textureSearchPaths.Contains(searchPath))
|
||||||
|
data["GENERAL"]["TextureSearchPaths"] = textureSearchPaths.Remove(textureSearchPaths.IndexOf(searchPath), searchPath.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.WriteFile(ConfigLocation, data);
|
parser.WriteFile(ConfigLocation, data);
|
||||||
@ -381,7 +383,7 @@ namespace Bloxstrap.Integrations
|
|||||||
|
|
||||||
if (!App.Settings.Prop.UseReShadeExtraviPresets && !string.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion))
|
if (!App.Settings.Prop.UseReShadeExtraviPresets && !string.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion))
|
||||||
{
|
{
|
||||||
if (Utilities.GetProcessCount("RobloxPlayerBeta") > 0)
|
if (Utilities.CheckIfRobloxRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UninstallExtraviPresets();
|
UninstallExtraviPresets();
|
||||||
@ -392,7 +394,7 @@ namespace Bloxstrap.Integrations
|
|||||||
|
|
||||||
if (!App.Settings.Prop.UseReShade)
|
if (!App.Settings.Prop.UseReShade)
|
||||||
{
|
{
|
||||||
if (Utilities.GetProcessCount("RobloxPlayerBeta") > 0)
|
if (Utilities.CheckIfRobloxRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
App.Logger.WriteLine("[ReShade::CheckModifications] ReShade is not enabled");
|
App.Logger.WriteLine("[ReShade::CheckModifications] ReShade is not enabled");
|
||||||
|
Loading…
Reference in New Issue
Block a user