From a4ecc5e81cc76ee0d04e368982e2ba9bf70eaa7b Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Mon, 7 Feb 2022 10:33:28 +0100 Subject: [PATCH] Remove MSIX-specific code paths in ILSpy --- ILSpy/AboutPage.cs | 61 +++++++++++------------- ILSpy/Commands/CheckForUpdatesCommand.cs | 5 -- ILSpy/ILSpy.csproj | 1 - ILSpy/MainWindow.xaml.cs | 6 --- ILSpy/StorePackageHelper.cs | 26 ---------- 5 files changed, 27 insertions(+), 72 deletions(-) delete mode 100644 ILSpy/StorePackageHelper.cs diff --git a/ILSpy/AboutPage.cs b/ILSpy/AboutPage.cs index 1eafd77e4..08d792ac0 100644 --- a/ILSpy/AboutPage.cs +++ b/ILSpy/AboutPage.cs @@ -65,39 +65,32 @@ namespace ICSharpCode.ILSpy string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion; output.WriteLine(Resources.NETFrameworkVersion + prodVersion); - if (StorePackageHelper.HasPackageIdentity) - { - output.WriteLine($"Package Name: {StorePackageHelper.GetPackageFamilyName()}"); - } - else - {// if we're running in an MSIX, updates work differently - output.AddUIElement( - delegate { - StackPanel stackPanel = new StackPanel(); - stackPanel.HorizontalAlignment = HorizontalAlignment.Center; - stackPanel.Orientation = Orientation.Horizontal; - if (latestAvailableVersion == null) - { - AddUpdateCheckButton(stackPanel, textView); - } - else - { - // we already retrieved the latest version sometime earlier - ShowAvailableVersion(latestAvailableVersion, stackPanel); - } - CheckBox checkBox = new CheckBox(); - checkBox.Margin = new Thickness(4); - checkBox.Content = Resources.AutomaticallyCheckUpdatesEveryWeek; - UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); - checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); - return new StackPanel { - Margin = new Thickness(0, 4, 0, 0), - Cursor = Cursors.Arrow, - Children = { stackPanel, checkBox } - }; - }); - output.WriteLine(); - } + output.AddUIElement( + delegate { + StackPanel stackPanel = new StackPanel(); + stackPanel.HorizontalAlignment = HorizontalAlignment.Center; + stackPanel.Orientation = Orientation.Horizontal; + if (latestAvailableVersion == null) + { + AddUpdateCheckButton(stackPanel, textView); + } + else + { + // we already retrieved the latest version sometime earlier + ShowAvailableVersion(latestAvailableVersion, stackPanel); + } + CheckBox checkBox = new CheckBox(); + checkBox.Margin = new Thickness(4); + checkBox.Content = Resources.AutomaticallyCheckUpdatesEveryWeek; + UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); + checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); + return new StackPanel { + Margin = new Thickness(0, 4, 0, 0), + Cursor = Cursors.Arrow, + Children = { stackPanel, checkBox } + }; + }); + output.WriteLine(); foreach (var plugin in App.ExportProvider.GetExportedValues()) plugin.Write(output); @@ -303,7 +296,7 @@ namespace ICSharpCode.ILSpy UpdateSettings s = new UpdateSettings(spySettings); // If we're in an MSIX package, updates work differently - if (s.AutomaticUpdateCheckEnabled && !StorePackageHelper.HasPackageIdentity) + if (s.AutomaticUpdateCheckEnabled) { // perform update check if we never did one before; // or if the last check wasn't in the past 7 days diff --git a/ILSpy/Commands/CheckForUpdatesCommand.cs b/ILSpy/Commands/CheckForUpdatesCommand.cs index c398c1c1d..4f1dca113 100644 --- a/ILSpy/Commands/CheckForUpdatesCommand.cs +++ b/ILSpy/Commands/CheckForUpdatesCommand.cs @@ -26,11 +26,6 @@ namespace ICSharpCode.ILSpy { public override bool CanExecute(object parameter) { - if (StorePackageHelper.HasPackageIdentity) - { - return false; - } - return base.CanExecute(parameter); } diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index c8f368d24..48ffa78c4 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -45,7 +45,6 @@ - diff --git a/ILSpy/MainWindow.xaml.cs b/ILSpy/MainWindow.xaml.cs index 8f89011ff..10aca41b3 100644 --- a/ILSpy/MainWindow.xaml.cs +++ b/ILSpy/MainWindow.xaml.cs @@ -932,12 +932,6 @@ namespace ICSharpCode.ILSpy public async Task ShowMessageIfUpdatesAvailableAsync(ILSpySettings spySettings, bool forceCheck = false) { - // Don't check for updates if we're in an MSIX since they work differently - if (StorePackageHelper.HasPackageIdentity) - { - return; - } - string downloadUrl; if (forceCheck) { diff --git a/ILSpy/StorePackageHelper.cs b/ILSpy/StorePackageHelper.cs deleted file mode 100644 index 99f7e24f2..000000000 --- a/ILSpy/StorePackageHelper.cs +++ /dev/null @@ -1,26 +0,0 @@ -using OSVersionHelper; - -namespace ICSharpCode.ILSpy -{ - // The Store package is ever only built for net472 - public static class StorePackageHelper - { - public static bool HasPackageIdentity { - get { -#if NET472 - return WindowsVersionHelper.HasPackageIdentity; -#else - return false; -#endif - } - } - public static string GetPackageFamilyName() - { -#if NET472 - return WindowsVersionHelper.GetPackageFamilyName(); -#else - return ""; -#endif - } - } -}