From ab2f5f589a86739534ed8f8cd4e835759bf6cbe7 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 13 Aug 2024 00:14:50 +0100 Subject: [PATCH] Cleanup new shortcuts functionality Remove old obsolete option and ensure uninstaller deletes all the new shortcuts --- Bloxstrap/Installer.cs | 14 +++++++++++++- Bloxstrap/Models/SettingTasks/ShortcutTask.cs | 2 +- Bloxstrap/Models/Settings.cs | 1 - Bloxstrap/Resources/Strings.Designer.cs | 18 ------------------ Bloxstrap/Resources/Strings.resx | 6 ------ .../Elements/Settings/Pages/BehaviourPage.xaml | 6 ------ .../ViewModels/Settings/BehaviourViewModel.cs | 6 ------ 7 files changed, 14 insertions(+), 39 deletions(-) diff --git a/Bloxstrap/Installer.cs b/Bloxstrap/Installer.cs index 817b337..b07634c 100644 --- a/Bloxstrap/Installer.cs +++ b/Bloxstrap/Installer.cs @@ -242,9 +242,21 @@ namespace Bloxstrap } #endif + + var cleanupSequence = new List { - () => File.Delete(DesktopShortcut), + () => + { + foreach (var file in Directory.GetFiles(Paths.Desktop).Where(x => x.EndsWith("lnk"))) + { + var shortcut = ShellLink.Shortcut.ReadFromFile(file); + + if (shortcut.ExtraData.EnvironmentVariableDataBlock?.TargetUnicode == Paths.Application) + File.Delete(file); + } + }, + () => File.Delete(StartMenuShortcut), () => Directory.Delete(Paths.Versions, true), diff --git a/Bloxstrap/Models/SettingTasks/ShortcutTask.cs b/Bloxstrap/Models/SettingTasks/ShortcutTask.cs index a13a1ce..5b30995 100644 --- a/Bloxstrap/Models/SettingTasks/ShortcutTask.cs +++ b/Bloxstrap/Models/SettingTasks/ShortcutTask.cs @@ -26,7 +26,7 @@ namespace Bloxstrap.Models.SettingTasks if (NewState) Shortcut.Create(Paths.Application, ExeFlags, ShortcutPath); - else + else if (File.Exists(ShortcutPath)) File.Delete(ShortcutPath); OriginalState = NewState; diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index 3bc2580..2b7ed2e 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -11,7 +11,6 @@ namespace Bloxstrap.Models public string BootstrapperIconCustomLocation { get; set; } = ""; public Theme Theme { get; set; } = Theme.Default; public bool CheckForUpdates { get; set; } = true; - public bool CreateDesktopIcon { get; set; } = true; public bool ConfirmLaunches { get; set; } = false; public string Locale { get; set; } = "nil"; public bool ForceRobloxLanguage { get; set; } = false; diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index bf92399..4e7f870 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -1790,24 +1790,6 @@ namespace Bloxstrap.Resources { } } - /// - /// Looks up a localized string similar to Bloxstrap will place an icon on the desktop that launches Roblox the next time it launches.. - /// - public static string Menu_Behaviour_CreateDesktopIcon_Description { - get { - return ResourceManager.GetString("Menu.Behaviour.CreateDesktopIcon.Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Create desktop icon. - /// - public static string Menu_Behaviour_CreateDesktopIcon_Title { - get { - return ResourceManager.GetString("Menu.Behaviour.CreateDesktopIcon.Title", resourceCulture); - } - } - /// /// Looks up a localized string similar to Configure what Bloxstrap should do when launching.. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 234c918..76b07ff 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -557,12 +557,6 @@ Would you like to upgrade your currently installed version? Prompt to confirm when launching another Roblox instance - - Bloxstrap will place an icon on the desktop that launches Roblox the next time it launches. - - - Create desktop icon - Configure what Bloxstrap should do when launching. diff --git a/Bloxstrap/UI/Elements/Settings/Pages/BehaviourPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/BehaviourPage.xaml index 9bb7ef7..4a92c3b 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/BehaviourPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/BehaviourPage.xaml @@ -17,12 +17,6 @@ - - - - diff --git a/Bloxstrap/UI/ViewModels/Settings/BehaviourViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/BehaviourViewModel.cs index dc2945e..bf205ff 100644 --- a/Bloxstrap/UI/ViewModels/Settings/BehaviourViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/BehaviourViewModel.cs @@ -5,12 +5,6 @@ private string _oldPlayerVersionGuid = ""; private string _oldStudioVersionGuid = ""; - public bool CreateDesktopIcon - { - get => App.Settings.Prop.CreateDesktopIcon; - set => App.Settings.Prop.CreateDesktopIcon = value; - } - public bool UpdateCheckingEnabled { get => App.Settings.Prop.CheckForUpdates;