Browse Source

Remove MSIX-specific code paths in ILSpy

pull/2642/head
Christoph Wille 3 years ago
parent
commit
a4ecc5e81c
  1. 61
      ILSpy/AboutPage.cs
  2. 5
      ILSpy/Commands/CheckForUpdatesCommand.cs
  3. 1
      ILSpy/ILSpy.csproj
  4. 6
      ILSpy/MainWindow.xaml.cs
  5. 26
      ILSpy/StorePackageHelper.cs

61
ILSpy/AboutPage.cs

@ -65,39 +65,32 @@ namespace ICSharpCode.ILSpy @@ -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<IAboutPageAddition>())
plugin.Write(output);
@ -303,7 +296,7 @@ namespace ICSharpCode.ILSpy @@ -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

5
ILSpy/Commands/CheckForUpdatesCommand.cs

@ -26,11 +26,6 @@ namespace ICSharpCode.ILSpy @@ -26,11 +26,6 @@ namespace ICSharpCode.ILSpy
{
public override bool CanExecute(object parameter)
{
if (StorePackageHelper.HasPackageIdentity)
{
return false;
}
return base.CanExecute(parameter);
}

1
ILSpy/ILSpy.csproj

@ -45,7 +45,6 @@ @@ -45,7 +45,6 @@
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20" />
<PackageReference Include="System.Composition" Version="$(SystemCompositionVersion)" />
<PackageReference Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
<PackageReference Include="OSVersionHelper" Version="1.1.24" />
<PackageReference Include="DataGridExtensions" Version="2.5.13" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="TomsToolbox.Wpf.Styles" Version="$(WpfStylesToolboxVersion)" />

6
ILSpy/MainWindow.xaml.cs

@ -932,12 +932,6 @@ namespace ICSharpCode.ILSpy @@ -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)
{

26
ILSpy/StorePackageHelper.cs

@ -1,26 +0,0 @@ @@ -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
}
}
}
Loading…
Cancel
Save