From 8b74470f6c18ca35a77e37ec9f4d83ac9d8a85e9 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Fri, 27 Oct 2023 22:24:01 +0100 Subject: [PATCH] Convert AssemblyLoadStatus to a generic enum i might need this for other things --- Bloxstrap/Enums/AssemblyLoadStatus.cs | 9 --------- Bloxstrap/Enums/GenericTriState.cs | 9 +++++++++ Bloxstrap/Utility/Shortcut.cs | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 Bloxstrap/Enums/AssemblyLoadStatus.cs create mode 100644 Bloxstrap/Enums/GenericTriState.cs diff --git a/Bloxstrap/Enums/AssemblyLoadStatus.cs b/Bloxstrap/Enums/AssemblyLoadStatus.cs deleted file mode 100644 index 08ef104..0000000 --- a/Bloxstrap/Enums/AssemblyLoadStatus.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Bloxstrap.Enums -{ - enum AssemblyLoadStatus - { - NotAttempted, - Failed, - Successful - } -} diff --git a/Bloxstrap/Enums/GenericTriState.cs b/Bloxstrap/Enums/GenericTriState.cs new file mode 100644 index 0000000..c8b406b --- /dev/null +++ b/Bloxstrap/Enums/GenericTriState.cs @@ -0,0 +1,9 @@ +namespace Bloxstrap.Enums +{ + public enum GenericTriState + { + Successful, + Failed, + Unknown + } +} diff --git a/Bloxstrap/Utility/Shortcut.cs b/Bloxstrap/Utility/Shortcut.cs index a48a01c..35e504f 100644 --- a/Bloxstrap/Utility/Shortcut.cs +++ b/Bloxstrap/Utility/Shortcut.cs @@ -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.",