mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Check if RFU is running before deleting/updating
This commit is contained in:
parent
fe24e06367
commit
01a9cff6e1
@ -3,14 +3,13 @@ using System.IO;
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
using Bloxstrap.Models;
|
using Bloxstrap.Models;
|
||||||
|
|
||||||
namespace Bloxstrap.Helpers.Integrations
|
namespace Bloxstrap.Helpers.Integrations
|
||||||
{
|
{
|
||||||
internal class RbxFpsUnlocker
|
internal class RbxFpsUnlocker
|
||||||
{
|
{
|
||||||
|
public const string ApplicationName = "rbxfpsunlocker";
|
||||||
public const string ProjectRepository = "axstin/rbxfpsunlocker";
|
public const string ProjectRepository = "axstin/rbxfpsunlocker";
|
||||||
|
|
||||||
// default settings but with QuickStart set to true and CheckForUpdates set to false
|
// default settings but with QuickStart set to true and CheckForUpdates set to false
|
||||||
@ -25,6 +24,32 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
"SilentErrors=false\n" +
|
"SilentErrors=false\n" +
|
||||||
"QuickStart=true\n";
|
"QuickStart=true\n";
|
||||||
|
|
||||||
|
public static void CheckIfRunning()
|
||||||
|
{
|
||||||
|
Process[] processes = Process.GetProcessesByName(ApplicationName);
|
||||||
|
|
||||||
|
if (processes.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// try/catch just in case process was closed before prompt was answered
|
||||||
|
|
||||||
|
foreach (Process process in processes)
|
||||||
|
{
|
||||||
|
if (process.MainModule is null || process.MainModule.FileName is null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!process.MainModule.FileName.Contains(Program.BaseDirectory))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
process.Kill();
|
||||||
|
process.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task CheckInstall()
|
public static async Task CheckInstall()
|
||||||
{
|
{
|
||||||
if (Program.BaseDirectory is null)
|
if (Program.BaseDirectory is null)
|
||||||
@ -37,7 +62,10 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
if (!Program.Settings.RFUEnabled)
|
if (!Program.Settings.RFUEnabled)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(folderLocation))
|
if (Directory.Exists(folderLocation))
|
||||||
|
{
|
||||||
|
CheckIfRunning();
|
||||||
Directory.Delete(folderLocation, true);
|
Directory.Delete(folderLocation, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -63,6 +91,7 @@ namespace Bloxstrap.Helpers.Integrations
|
|||||||
if (lastDownload > lastReleasePublish)
|
if (lastDownload > lastReleasePublish)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CheckIfRunning();
|
||||||
File.Delete(fileLocation);
|
File.Delete(fileLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
string commandLine = "";
|
string commandLine = "";
|
||||||
|
|
||||||
#if DEBUG
|
#if false //DEBUG
|
||||||
new Preferences().ShowDialog();
|
new Preferences().ShowDialog();
|
||||||
#else
|
#else
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user