Exemple #1
0
        public MainWindow()
        {
            instance = this;
            var spySettings = ILSpySettings.Load();

            this.spySettingsForMainWindow_Loaded = spySettings;
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));

            this.DataContext = new MainWindowDataContext {
                Workspace       = DockWorkspace.Instance,
                SessionSettings = sessionSettings
            };

            DockWorkspace.Instance.LoadSettings(sessionSettings);
            InitializeComponent();
            DockWorkspace.Instance.InitializeLayout(DockManager);
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView);

            this.Loaded += MainWindow_Loaded;
        }
Exemple #2
0
        public MainWindow()
        {
            instance                 = this;
            spySettings              = ILSpySettings.Load();
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));

            this.DataContext = sessionSettings;

            InitializeComponent();
            App.CompositionContainer.ComposeParts(this);
            mainPane.Content = decompilerTextView;

            if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1)
            {
                leftColumn.Width  = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
                rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
            }
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView, decompilerTextView);

            this.Loaded += MainWindow_Loaded;
        }
Exemple #3
0
        public MainWindow()
        {
            instance                 = this;
            spySettings              = ILSpySettings.Load();
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));

            this.DataContext = sessionSettings;
            this.Left        = sessionSettings.WindowBounds.Left;
            this.Top         = sessionSettings.WindowBounds.Top;
            this.Width       = sessionSettings.WindowBounds.Width;
            this.Height      = sessionSettings.WindowBounds.Height;
            // TODO: validate bounds (maybe a monitor was removed...)
            this.WindowState = sessionSettings.WindowState;

            InitializeComponent();
            App.CompositionContainer.ComposeParts(this);
            mainPane.Content = decompilerTextView;

            if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1)
            {
                leftColumn.Width  = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
                rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
            }
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView);

            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }
Exemple #4
0
        void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var path = GetPathForNode(treeView.SelectedItem as SharpTreeNode);

            ShowAssemblyList(assemblyListManager.LoadList(ILSpySettings.Load(), assemblyList.ListName));
            SelectNode(FindNodeByPath(path, true));
        }
Exemple #5
0
        public MainWindow()
        {
            instance                 = this;
            spySettings              = ILSpySettings.Load();
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new WindowIcon("Images/ILSpy.png");

            this.DataContext = sessionSettings;

            InitializeComponent();

#if DEBUG
            this.AttachDevTools();
#endif

            decompilerTextView = App.ExportProvider.GetExportedValue <DecompilerTextView>();
            mainPane.Content   = decompilerTextView;

            if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1)
            {
                leftColumn.Width  = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
                rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
            }
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            ContextMenuProvider.Add(treeView, decompilerTextView);
        }
Exemple #6
0
        public MainWindow()
        {
            instance = this;
            var spySettings = ILSpySettings.Load();

            this.spySettingsForMainWindow_Loaded = spySettings;
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));

            this.DataContext = sessionSettings;

            InitializeComponent();
            decompilerTextView = App.ExportProvider.GetExportedValue <DecompilerTextView>();
            mainPane.Content   = decompilerTextView;

            sessionSettings.DockLayout.Deserialize(new XmlLayoutSerializer(DockManager));

            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView, decompilerTextView);

            this.Loaded += MainWindow_Loaded;
        }
Exemple #7
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput()
            {
                EnableHyperlinks = true
            };

            output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion);
            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();
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line);
                    }
                }
            }
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MS-PL", "resource:MS-PL.txt"));
            textView.ShowText(output);
        }
Exemple #8
0
        public void ShowAssemblyList(string name)
        {
            AssemblyList list = this.AssemblyListManager.LoadList(ILSpySettings.Load(), name);

            //Only load a new list when it is a different one
            if (list.ListName != CurrentAssemblyList.ListName)
            {
                ShowAssemblyList(list);
            }
        }
Exemple #9
0
 void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     if (!DebugInformation.IsDebuggerLoaded)
     {
         var path = GetPathForNode(treeView.SelectedItem as SharpTreeNode);
         ShowAssemblyList(assemblyListManager.LoadList(ILSpySettings.Load(), assemblyList.ListName));
         SelectNode(FindNodeByPath(path, true));
     }
     else
     {
         e.Handled = false;
     }
 }
Exemple #10
0
 void downloadOrCheckUpdateButtonClick(object sender, RoutedEventArgs e)
 {
     if (updateAvailableDownloadUrl != null)
     {
         MainWindow.OpenLink(updateAvailableDownloadUrl);
     }
     else
     {
         updatePanel.Visibility = Visibility.Collapsed;
         AboutPage.CheckForUpdatesAsync(spySettings ?? ILSpySettings.Load())
         .ContinueWith(task => AdjustUpdateUIAfterCheck(task, true), TaskScheduler.FromCurrentSynchronizationContext());
     }
 }
Exemple #11
0
        async void downloadOrCheckUpdateButtonClick(object sender, RoutedEventArgs e)
        {
            if (updateAvailableDownloadUrl != null)
            {
                MainWindow.OpenLink(updateAvailableDownloadUrl);
            }
            else
            {
                updatePanel.Visibility = Visibility.Collapsed;
                string downloadUrl = await AboutPage.CheckForUpdatesAsync(ILSpySettings.Load());

                AdjustUpdateUIAfterCheck(downloadUrl, true);
            }
        }
Exemple #12
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput();

            output.WriteLine("ILSpy version " + RevisionClass.FullVersion);
            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        = "Automatically check for updates every week";
                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.CompositionContainer.GetExportedValues <IAboutPageAddition>())
            {
                plugin.Write(output);
            }
            output.WriteLine();
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line);
                    }
                }
            }
            textView.Show(output);
        }
Exemple #13
0
        public void ShowAssemblyList(string name)
        {
            ILSpySettings settings = this.spySettings;

            if (settings == null)
            {
                settings = ILSpySettings.Load();
            }
            AssemblyList list = this.assemblyListManager.LoadList(settings, name);

            //Only load a new list when it is a different one
            if (list.ListName != CurrentAssemblyList.ListName)
            {
                ShowAssemblyList(list);
            }
        }
Exemple #14
0
        public OptionsDialog()
        {
            InitializeComponent();
            App.CompositionContainer.ComposeParts(this);
            ILSpySettings settings = ILSpySettings.Load();

            foreach (var optionPage in optionPages)
            {
                TabItem tabItem = new TabItem();
                tabItem.Header  = optionPage.Metadata.Title;
                tabItem.Content = optionPage.Value;
                tabControl.Items.Add(tabItem);

                IOptionPage page = optionPage.Value as IOptionPage;
                if (page != null)
                {
                    page.Load(settings);
                }
            }
        }
Exemple #15
0
        public MainWindow()
        {
            instance = this;
            var spySettings = ILSpySettings.Load();

            this.spySettingsForMainWindow_Loaded = spySettings;
            this.sessionSettings     = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));

            this.DataContext = new MainWindowDataContext {
                Workspace       = DockWorkspace.Instance,
                SessionSettings = sessionSettings
            };

            DockWorkspace.Instance.LoadSettings(sessionSettings);

            InitializeComponent();

            XmlLayoutSerializer serializer = new XmlLayoutSerializer(DockManager);

            serializer.LayoutSerializationCallback += DockWorkspace.Instance.LayoutSerializationCallback;
            try {
                sessionSettings.DockLayout.Deserialize(serializer);
            } finally {
                serializer.LayoutSerializationCallback -= DockWorkspace.Instance.LayoutSerializationCallback;
            }

            DockWorkspace.Instance.EnsureUnclosablePanes();

            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView);

            this.Loaded += MainWindow_Loaded;
        }
Exemple #16
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);
        }
Exemple #17
0
 public override async void Execute(object parameter)
 {
     await MainWindow.Instance.ShowMessageIfUpdatesAvailableAsync(ILSpySettings.Load(), forceCheck : true);
 }
Exemple #18
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput();

            output.WriteLine(string.Format("dnSpy version {0}", currentVersion.ToString()), TextTokenType.Text);
            var decVer = typeof(ICSharpCode.Decompiler.Ast.AstBuilder).Assembly.GetName().Version;

            output.WriteLine(string.Format("ILSpy Decompiler version {0}.{1}.{2}", decVer.Major, decVer.Minor, decVer.Build), TextTokenType.Text);
            if (checkForUpdateCode)
            {
                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        = "Automatically check for updates every week";
                    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 }
                    });
                });
            }
            if (checkForUpdateCode)
            {
                output.WriteLine();
            }
            foreach (var plugin in App.CompositionContainer.GetExportedValues <IAboutPageAddition>())
            {
                plugin.Write(output);
            }
            output.WriteLine();
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line, TextTokenType.Text);
                    }
                }
            }
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("COPYING", "resource:COPYING"));
            textView.ShowText(output);
            MainWindow.Instance.SetTitle(textView, "About");

            //reset icon bar
            textView.manager.Bookmarks.Clear();
        }