Skip to content

Commit ed93e78

Browse files
committed
improve and add support for studio for a couple of them
1 parent 2eb84fe commit ed93e78

1 file changed

Lines changed: 35 additions & 47 deletions

File tree

Bloxstrap/Bootstrapper.cs

Lines changed: 35 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,14 @@ public async Task Run()
350350
StartRoblox();
351351
}
352352

353-
if (_launchMode == LaunchMode.Player)
354-
{
355-
_ = Task.Run(async () => await HandlePostLaunchOperations());
356-
}
353+
_ = Task.Run(async () => await HandlePostLaunchOperations(_launchMode));
357354

358355
await mutex.ReleaseAsync();
359356

360357
Dialog?.CloseBootstrapper();
361358
}
362359

363-
private async Task HandlePostLaunchOperations()
360+
private async Task HandlePostLaunchOperations(LaunchMode launchMode)
364361
{
365362
const string LOG_IDENT = "Bootstrapper::PostLaunch";
366363

@@ -380,28 +377,30 @@ private async Task HandlePostLaunchOperations()
380377
await Task.Delay(20000);
381378
}
382379

383-
if (App.Settings.Prop.AutoCloseCrashHandler)
380+
if (launchMode == LaunchMode.Player)
384381
{
385-
try
382+
if (App.Settings.Prop.AutoCloseCrashHandler)
386383
{
387-
var crashHandlerProcesses = Process.GetProcessesByName("RobloxCrashHandler");
388-
389-
foreach (var proc in crashHandlerProcesses)
384+
try
390385
{
391-
try
392-
{
393-
proc.Kill();
394-
App.Logger.WriteLine(LOG_IDENT, $"Killed RobloxCrashHandler process (PID {proc.Id})");
395-
}
396-
catch (Exception ex)
386+
var crashHandlerProcesses = Process.GetProcessesByName("RobloxCrashHandler");
387+
388+
foreach (var proc in crashHandlerProcesses)
397389
{
398-
App.Logger.WriteLine(LOG_IDENT, $"Failed to kill RobloxCrashHandler process (PID {proc.Id}): {ex.Message}");
390+
try
391+
{
392+
proc.Kill();
393+
}
394+
catch (Exception ex)
395+
{
396+
App.Logger.WriteLine(LOG_IDENT, $"Failed to kill RobloxCrashHandler process (PID {proc.Id}): {ex.Message}");
397+
}
399398
}
400399
}
401-
}
402-
catch (Exception ex)
403-
{
404-
App.Logger.WriteLine(LOG_IDENT, $"Error killing RobloxCrashHandler: {ex.Message}");
400+
catch (Exception ex)
401+
{
402+
App.Logger.WriteLine(LOG_IDENT, $"Error killing RobloxCrashHandler: {ex.Message}");
403+
}
405404
}
406405
}
407406

@@ -420,26 +419,8 @@ private async Task HandlePostLaunchOperations()
420419
_ => ProcessPriorityClass.Normal
421420
};
422421

423-
var robloxProcesses = Process.GetProcessesByName("RobloxPlayerBeta");
424-
425-
if (robloxProcesses.Length == 0)
426-
{
427-
App.Logger.WriteLine(LOG_IDENT, "Roblox process not found for priority setting");
428-
return;
429-
}
430-
431-
foreach (var proc in robloxProcesses)
432-
{
433-
try
434-
{
435-
proc.PriorityClass = priorityClass;
436-
App.Logger.WriteLine(LOG_IDENT, $"Set priority to {priorityClass} for process {proc.Id}");
437-
}
438-
catch (Exception ex)
439-
{
440-
App.Logger.WriteLine(LOG_IDENT, $"Failed to set priority for process {proc.Id}: {ex}");
441-
}
442-
}
422+
var robloxProcess = Process.GetProcessById(_appPid);
423+
robloxProcess.PriorityClass = priorityClass;
443424
}
444425
catch (Exception ex)
445426
{
@@ -1303,12 +1284,14 @@ private async Task<bool> CheckForUpdates()
13031284
#region Roblox Install
13041285
private static bool TryDeleteRobloxInDirectory(string dir)
13051286
{
1306-
string clientPath = Path.Combine(dir, "RobloxPlayerBeta.exe");
1307-
if (!File.Exists(dir))
1287+
// If neither of these exist in the directory, return true.
1288+
// This was not implemented properly.
1289+
string clientPath = Path.Combine(dir, App.RobloxPlayerAppName);
1290+
if (!File.Exists(clientPath))
13081291
{
1309-
clientPath = Path.Combine(dir, "RobloxStudioBeta.exe");
1310-
if (!File.Exists(dir))
1311-
return true; // ok???
1292+
clientPath = Path.Combine(dir, App.RobloxStudioAppName);
1293+
if (!File.Exists(clientPath))
1294+
return true;
13121295
}
13131296

13141297
try
@@ -1358,7 +1341,12 @@ public static void CleanupVersionsFolder()
13581341
{
13591342
Directory.Delete(dir, true);
13601343
}
1361-
catch (Exception ex)
1344+
catch (UnauthorizedAccessException ex)
1345+
{
1346+
App.Logger.WriteLine(LOG_IDENT, $"Failed to delete {dir}");
1347+
App.Logger.WriteException(LOG_IDENT, ex);
1348+
}
1349+
catch (IOException ex)
13621350
{
13631351
App.Logger.WriteLine(LOG_IDENT, $"Failed to delete {dir}");
13641352
App.Logger.WriteException(LOG_IDENT, ex);

0 commit comments

Comments
 (0)