Browse Source

Disable update checks when running in package

pull/1522/head
Oren Novotny 6 years ago
parent
commit
a6ba0449f5
Failed to extract signature
  1. 13
      ILSpy/AboutPage.cs
  2. 10
      ILSpy/Commands/CheckForUpdatesCommand.cs
  3. 1
      ILSpy/ILSpy.csproj
  4. 6
      ILSpy/MainWindow.xaml.cs

13
ILSpy/AboutPage.cs

@ -35,6 +35,7 @@ using ICSharpCode.AvalonEdit.Rendering; @@ -35,6 +35,7 @@ using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.Decompiler;
using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpy.TextView;
using OSVersionHelper;
namespace ICSharpCode.ILSpy
{
@ -59,7 +60,10 @@ namespace ICSharpCode.ILSpy @@ -59,7 +60,10 @@ namespace ICSharpCode.ILSpy
{
AvalonEditTextOutput output = new AvalonEditTextOutput() { EnableHyperlinks = true };
output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion);
output.AddUIElement(
if(WindowsVersionHelper.HasPackageIdentity) {
output.WriteLine($"Package Name: {WindowsVersionHelper.GetPackageFamilyName()}");
} else {// if we're running in an MSIX, updates work differently
output.AddUIElement(
delegate {
StackPanel stackPanel = new StackPanel();
stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
@ -81,7 +85,9 @@ namespace ICSharpCode.ILSpy @@ -81,7 +85,9 @@ namespace ICSharpCode.ILSpy
Children = { stackPanel, checkBox }
};
});
output.WriteLine();
output.WriteLine();
}
foreach (var plugin in App.ExportProvider.GetExportedValues<IAboutPageAddition>())
plugin.Write(output);
output.WriteLine();
@ -283,7 +289,8 @@ namespace ICSharpCode.ILSpy @@ -283,7 +289,8 @@ namespace ICSharpCode.ILSpy
{
var tcs = new TaskCompletionSource<string>();
UpdateSettings s = new UpdateSettings(spySettings);
if (s.AutomaticUpdateCheckEnabled) {
// If we're in an MSIX package, updates work differently
if (s.AutomaticUpdateCheckEnabled && !WindowsVersionHelper.HasPackageIdentity) {
// perform update check if we never did one before;
// or if the last check wasn't in the past 7 days
if (s.LastSuccessfulUpdateCheck == null

10
ILSpy/Commands/CheckForUpdatesCommand.cs

@ -18,12 +18,22 @@ @@ -18,12 +18,22 @@
using ICSharpCode.ILSpy.Properties;
using OSVersionHelper;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(Menu = nameof(Resources._Help), Header = nameof(Resources._CheckUpdates), MenuOrder = 5000)]
sealed class CheckForUpdatesCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
{
if(WindowsVersionHelper.HasPackageIdentity) {
return false;
}
return base.CanExecute(parameter);
}
public override void Execute(object parameter)
{
MainWindow.Instance.ShowMessageIfUpdatesAvailableAsync(ILSpySettings.Load(), forceCheck: true);

1
ILSpy/ILSpy.csproj

@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
<PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta1-63314-01" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="15.5.23" />
<PackageReference Include="Mono.Cecil" Version="0.10.3" />
<PackageReference Include="OSVersionHelper" Version="1.0.11" />
</ItemGroup>
<ItemGroup>

6
ILSpy/MainWindow.xaml.cs

@ -42,6 +42,7 @@ using ICSharpCode.ILSpy.TextView; @@ -42,6 +42,7 @@ using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.TreeView;
using Microsoft.Win32;
using OSVersionHelper;
namespace ICSharpCode.ILSpy
{
@ -490,6 +491,11 @@ namespace ICSharpCode.ILSpy @@ -490,6 +491,11 @@ namespace ICSharpCode.ILSpy
public void ShowMessageIfUpdatesAvailableAsync(ILSpySettings spySettings, bool forceCheck = false)
{
// Don't check for updates if we're in an MSIX since they work differently
if(WindowsVersionHelper.HasPackageIdentity) {
return;
}
Task<string> result;
if (forceCheck) {
result = AboutPage.CheckForUpdatesAsync(spySettings);

Loading…
Cancel
Save