Convert AssemblyLoadStatus to a generic enum

i might need this for other things
This commit is contained in:
pizzaboxer 2023-10-27 22:24:01 +01:00
parent f564e409ba
commit 8b74470f6c
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
3 changed files with 14 additions and 14 deletions

View File

@ -1,9 +0,0 @@
namespace Bloxstrap.Enums
{
enum AssemblyLoadStatus
{
NotAttempted,
Failed,
Successful
}
}

View File

@ -0,0 +1,9 @@
namespace Bloxstrap.Enums
{
public enum GenericTriState
{
Successful,
Failed,
Unknown
}
}

View File

@ -4,7 +4,7 @@ namespace Bloxstrap.Utility
{
internal static class Shortcut
{
private static AssemblyLoadStatus _loadStatus = AssemblyLoadStatus.NotAttempted;
private static GenericTriState _loadStatus = GenericTriState.Unknown;
public static void Create(string exePath, string exeArgs, string lnkPath)
{
@ -17,18 +17,18 @@ namespace Bloxstrap.Utility
{
ShellLink.Shortcut.CreateShortcut(exePath, exeArgs, exePath, 0).WriteToFile(lnkPath);
if (_loadStatus != AssemblyLoadStatus.Successful)
_loadStatus = AssemblyLoadStatus.Successful;
if (_loadStatus != GenericTriState.Successful)
_loadStatus = GenericTriState.Successful;
}
catch (FileNotFoundException ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Failed to create a shortcut for {lnkPath}!");
App.Logger.WriteException(LOG_IDENT, ex);
if (_loadStatus == AssemblyLoadStatus.Failed)
if (_loadStatus == GenericTriState.Failed)
return;
_loadStatus = AssemblyLoadStatus.Failed;
_loadStatus = GenericTriState.Failed;
Frontend.ShowMessageBox(
$"{App.ProjectName} was unable to create shortcuts for the Desktop and Start menu. They will be created the next time Roblox is launched.",