Esempio n. 1
0
        public static string GetPackageFamilyName()
        {
#if NET472
            return(WindowsVersionHelper.GetPackageFamilyName());
#endif
            return("");
        }
Esempio n. 2
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput()
            {
                Title = Resources.About, EnableHyperlinks = true
            };

            output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion);
            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;
                    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);
            }
            output.WriteLine();
            output.Address = new Uri("resource://AboutPage");
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), Resources.ILSpyAboutPageTxt)) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line);
                    }
                }
            }
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("third-party notices", "resource:third-party-notices.txt"));
            textView.ShowText(output);
        }