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");
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
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);
|
||||
#endif
|
||||
|
||||
new MainWindow().ShowDialog();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace Bloxstrap
|
||||
CheckInstallMigration();
|
||||
|
||||
// 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();
|
||||
|
||||
// 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!");
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent";
|
||||
@ -601,7 +573,28 @@ namespace Bloxstrap
|
||||
|
||||
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}...");
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace Bloxstrap.Helpers
|
||||
if (log)
|
||||
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Checking if '{processName}' is running...");
|
||||
|
||||
Process[] processes = Process.GetProcessesByName("RobloxPlayerBeta");
|
||||
Process[] processes = Process.GetProcessesByName(processName);
|
||||
|
||||
if (log)
|
||||
App.Logger.WriteLine($"[Utilities::CheckIfProcessRunning] Found {processes.Length} process(es) running for '{processName}'");
|
||||
@ -39,10 +39,11 @@ namespace Bloxstrap.Helpers
|
||||
return processes.Length;
|
||||
}
|
||||
|
||||
public static void OpenWebsite(string website)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo { FileName = website, UseShellExecute = true });
|
||||
}
|
||||
public static bool CheckIfProcessRunning(string processName, bool log = true) => GetProcessCount(processName, log) >= 1;
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace Bloxstrap.Integrations
|
||||
if (!App.Settings.Prop.RFUEnabled)
|
||||
{
|
||||
// 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;
|
||||
|
||||
App.State.Prop.RbxFpsUnlockerVersion = "";
|
||||
|
@ -318,13 +318,15 @@ namespace Bloxstrap.Integrations
|
||||
if (shaderSearchPaths.Contains(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))
|
||||
{
|
||||
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);
|
||||
@ -381,7 +383,7 @@ namespace Bloxstrap.Integrations
|
||||
|
||||
if (!App.Settings.Prop.UseReShadeExtraviPresets && !string.IsNullOrEmpty(App.State.Prop.ExtraviReShadePresetsVersion))
|
||||
{
|
||||
if (Utilities.GetProcessCount("RobloxPlayerBeta") > 0)
|
||||
if (Utilities.CheckIfRobloxRunning())
|
||||
return;
|
||||
|
||||
UninstallExtraviPresets();
|
||||
@ -392,7 +394,7 @@ namespace Bloxstrap.Integrations
|
||||
|
||||
if (!App.Settings.Prop.UseReShade)
|
||||
{
|
||||
if (Utilities.GetProcessCount("RobloxPlayerBeta") > 0)
|
||||
if (Utilities.CheckIfRobloxRunning())
|
||||
return;
|
||||
|
||||
App.Logger.WriteLine("[ReShade::CheckModifications] ReShade is not enabled");
|
||||
|
Loading…
Reference in New Issue
Block a user