Esempio n. 1
0
 public AssemblyListManager(DNSpySettings spySettings)
 {
     XElement doc = spySettings["AssemblyLists"];
     foreach (var list in doc.Elements("List")) {
         AssemblyLists.Add(SessionSettings.Unescape((string)list.Attribute("name")));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Saves the specifies assembly list into the config file.
 /// </summary>
 public static void SaveList(AssemblyList list)
 {
     if (!list.CanSave)
     {
         return;
     }
     DNSpySettings.Update(
         delegate(XElement root) {
         XElement doc = root.Element("AssemblyLists");
         if (doc == null)
         {
             doc = new XElement("AssemblyLists");
             root.Add(doc);
         }
         XElement listElement = doc.Elements("List").FirstOrDefault(e => SessionSettings.Unescape((string)e.Attribute("name")) == list.ListName);
         if (listElement != null)
         {
             listElement.ReplaceWith(list.SaveAsXml());
         }
         else
         {
             doc.Add(list.SaveAsXml());
         }
     });
 }
Esempio n. 3
0
 /// <summary>
 /// If automatic update checking is enabled, checks if there are any updates available.
 /// Returns the download URL if an update is available.
 /// Returns null if no update is available, or if no check was performed.
 /// </summary>
 public static Task<string> CheckForUpdatesIfEnabledAsync(DNSpySettings spySettings)
 {
     var tcs = new TaskCompletionSource<string>();
     UpdateSettings s = new UpdateSettings(spySettings);
     if (checkForUpdateCode && s.AutomaticUpdateCheckEnabled) {
         // 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
             || s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7)
             || s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
         {
             GetLatestVersionAsync().ContinueWith(
                 delegate (Task<AvailableVersionInfo> task) {
                     try {
                         s.LastSuccessfulUpdateCheck = DateTime.UtcNow;
                         AvailableVersionInfo v = task.Result;
                         if (v.Version > currentVersion)
                             tcs.SetResult(v.DownloadUrl);
                         else
                             tcs.SetResult(null);
                     } catch (AggregateException) {
                         // ignore errors getting the version info
                         tcs.SetResult(null);
                     }
                 });
         } else {
             tcs.SetResult(null);
         }
     } else {
         tcs.SetResult(null);
     }
     return tcs.Task;
 }
Esempio n. 4
0
        public bool DeleteList(string Name)
        {
            if (FileLists.Contains(Name))
            {
                FileLists.Remove(Name);

                DNSpySettings.Update(
                    delegate(XElement root) {
                    XElement doc = root.Element(FILELISTS_SECTION_NAME);
                    if (doc == null)
                    {
                        root.Element(FILELISTS_SECTION_NAME_OLD);
                    }
                    if (doc == null)
                    {
                        return;
                    }
                    XElement listElement = doc.Elements(LIST_SECTION_NAME).FirstOrDefault(e => SessionSettings.Unescape((string)e.Attribute("name")) == Name);
                    if (listElement != null)
                    {
                        listElement.Remove();
                    }
                });
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        DnSpyFileList DoLoadList(DNSpySettings spySettings, string listName)
        {
            var doc = GetFileListsElement(spySettings);

            if (listName != null)
            {
                foreach (var listElem in doc.Elements(LIST_SECTION_NAME))
                {
                    if (SessionSettings.Unescape((string)listElem.Attribute("name")) == listName)
                    {
                        return(Initialize(Create(listElem)));
                    }
                }
            }
            XElement      firstList = doc.Elements(LIST_SECTION_NAME).FirstOrDefault();
            DnSpyFileList list;

            if (firstList != null)
            {
                list = Create(firstList);
            }
            else
            {
                list = new DnSpyFileList(options, listName ?? DefaultListName);
            }
            return(Initialize(list));
        }
Esempio n. 6
0
        AssemblyList DoLoadList(DNSpySettings spySettings, string listName)
        {
            XElement doc = spySettings["AssemblyLists"];

            if (listName != null)
            {
                foreach (var list in doc.Elements("List"))
                {
                    if (SessionSettings.Unescape((string)list.Attribute("name")) == listName)
                    {
                        return(new AssemblyList(list));
                    }
                }
            }
            XElement firstList = doc.Elements("List").FirstOrDefault();

            if (firstList != null)
            {
                return(new AssemblyList(firstList));
            }
            else
            {
                return(new AssemblyList(listName ?? DefaultListName));
            }
        }
Esempio n. 7
0
        public void Save()
        {
            XElement doc = new XElement("SessionSettings");

            if (this.ActiveAssemblyList != null)
            {
                doc.Add(new XElement("ActiveAssemblyList", Escape(this.ActiveAssemblyList)));
            }
            doc.Add(new XElement("WindowState", ToString(this.WindowState)));
            doc.Add(new XElement("IsFullScreen", ToString(this.IsFullScreen)));
            if (this.WindowBounds != null)
            {
                doc.Add(new XElement("WindowBounds", ToString(this.WindowBounds)));
            }
            doc.Add(new XElement("WordWrap", ToString(this.WordWrap)));
            doc.Add(new XElement("HighlightCurrentLine", ToString(this.HighlightCurrentLine)));
            doc.Add(new XElement("LeftColumnWidth", ToString(this.LeftColumnWidth)));
            doc.Add(new XElement("TopPaneHeight", ToString(this.TopPaneSettings.Height)));
            doc.Add(new XElement("TopPaneName", ToString(this.TopPaneSettings.Name)));
            doc.Add(new XElement("BottomPaneHeight", ToString(this.BottomPaneSettings.Height)));
            doc.Add(new XElement("BottomPaneName", ToString(this.BottomPaneSettings.Name)));
            doc.Add(new XElement("ThemeName", ToString(this.ThemeName)));
            doc.Add(new XElement("IgnoredWarnings", IgnoredWarnings.Select(id => new XElement("Warning", Escape(id)))));

            if (ICSharpCode.ILSpy.Options.DisplaySettingsPanel.CurrentDisplaySettings.RestoreTabsAtStartup)
            {
                doc.Add(SavedTabGroupsState.ToXml(new XElement("TabGroups")));
            }

            DNSpySettings.SaveSettings(doc);
        }
Esempio n. 8
0
        public SessionSettings(DNSpySettings spySettings)
        {
            XElement doc = spySettings["SessionSettings"];

            XElement filterSettings = doc.Element("FilterSettings");

            if (filterSettings == null)
            {
                filterSettings = new XElement("FilterSettings");
            }

            this.FilterSettings = new FilterSettings(filterSettings);

            this.ActiveAssemblyList = Unescape((string)doc.Element("ActiveAssemblyList"));

            this.WindowState  = FromString((string)doc.Element("WindowState"), WindowState.Normal);
            this.IsFullScreen = FromString((string)doc.Element("IsFullScreen"), false);
            var winBoundsString = (string)doc.Element("WindowBounds");

            if (winBoundsString != null)
            {
                this.WindowBounds = FromString(winBoundsString, DefaultWindowBounds);
            }
            this.LeftColumnWidth           = FromString((string)doc.Element("LeftColumnWidth"), 0.0);
            this.WordWrap                  = FromString((string)doc.Element("WordWrap"), false);
            this.HighlightCurrentLine      = FromString((string)doc.Element("HighlightCurrentLine"), true);
            this.TopPaneSettings.Name      = FromString((string)doc.Element("TopPaneName"), string.Empty);
            this.TopPaneSettings.Height    = FromString((string)doc.Element("TopPaneHeight"), 200.0);
            this.BottomPaneSettings.Name   = FromString((string)doc.Element("BottomPaneName"), string.Empty);
            this.BottomPaneSettings.Height = FromString((string)doc.Element("BottomPaneHeight"), 200.0);
            this.ThemeName                 = (string)doc.Element("ThemeName") ?? dnSpy.dntheme.Themes.DefaultThemeName;

            var ignoreXml = doc.Element("IgnoredWarnings");

            if (ignoreXml != null)
            {
                foreach (var child in ignoreXml.Elements("Warning"))
                {
                    var id = Unescape((string)child);
                    if (id != null)
                    {
                        IgnoredWarnings.Add(id);
                    }
                }
            }

            var groups = doc.Element("TabGroups");

            if (groups == null)
            {
                this.TabsFound           = false;
                this.SavedTabGroupsState = new SavedTabGroupsState();
            }
            else
            {
                this.TabsFound           = true;
                this.SavedTabGroupsState = SavedTabGroupsState.FromXml(groups);
            }
        }
Esempio n. 9
0
        public AssemblyListManager(DNSpySettings spySettings)
        {
            XElement doc = spySettings["AssemblyLists"];

            foreach (var list in doc.Elements("List"))
            {
                AssemblyLists.Add(SessionSettings.Unescape((string)list.Attribute("name")));
            }
        }
Esempio n. 10
0
        public DnSpyFileListManager(IDnSpyFileListOptions options, DNSpySettings spySettings)
        {
            this.options = options;
            var doc = GetFileListsElement(spySettings);

            foreach (var list in doc.Elements(LIST_SECTION_NAME))
            {
                FileLists.Add(SessionSettings.Unescape((string)list.Attribute("name")));
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Loads an assembly list from the ILSpySettings.
        /// If no list with the specified name is found, the default list is loaded instead.
        /// </summary>
        public DnSpyFileList LoadList(DNSpySettings spySettings, string listName)
        {
            DnSpyFileList list = DoLoadList(spySettings, listName);

            if (!FileLists.Contains(list.Name))
            {
                FileLists.Add(list.Name);
            }
            return(list);
        }
Esempio n. 12
0
        static XElement GetFileListsElement(DNSpySettings spySettings)
        {
            var doc = spySettings.GetElement(FILELISTS_SECTION_NAME);

            if (doc == null)
            {
                doc = spySettings[FILELISTS_SECTION_NAME_OLD];
            }
            return(doc ?? new XElement(FILELISTS_SECTION_NAME));
        }
Esempio n. 13
0
        /// <summary>
        /// Loads an assembly list from the ILSpySettings.
        /// If no list with the specified name is found, the default list is loaded instead.
        /// </summary>
        public AssemblyList LoadList(DNSpySettings spySettings, string listName)
        {
            AssemblyList list = DoLoadList(spySettings, listName);

            if (!AssemblyLists.Contains(list.ListName))
            {
                AssemblyLists.Add(list.ListName);
            }
            return(list);
        }
Esempio n. 14
0
            public void Save()
            {
                XElement updateSettings = new XElement("UpdateSettings");

                updateSettings.Add(new XElement("AutomaticUpdateCheckEnabled", automaticUpdateCheckEnabled));
                if (lastSuccessfulUpdateCheck != null)
                {
                    updateSettings.Add(new XElement("LastSuccessfulUpdateCheck", lastSuccessfulUpdateCheck));
                }
                DNSpySettings.SaveSettings(updateSettings);
            }
Esempio n. 15
0
            public UpdateSettings(DNSpySettings spySettings)
            {
                XElement s = spySettings["UpdateSettings"];

                this.automaticUpdateCheckEnabled = (bool?)s.Element("AutomaticUpdateCheckEnabled") ?? true;
                try {
                    this.lastSuccessfulUpdateCheck = (DateTime?)s.Element("LastSuccessfulUpdateCheck");
                } catch (FormatException) {
                    // avoid crashing on settings files invalid due to
                    // https://github.com/icsharpcode/ILSpy/issues/closed/#issue/2
                }
            }
Esempio n. 16
0
		DnSpyFileList DoLoadList(DNSpySettings spySettings, string listName) {
			var doc = GetFileListsElement(spySettings);
			if (listName != null) {
				foreach (var listElem in doc.Elements(LIST_SECTION_NAME)) {
					if (SessionSettings.Unescape((string)listElem.Attribute("name")) == listName)
						return Initialize(Create(listElem));
				}
			}
			XElement firstList = doc.Elements(LIST_SECTION_NAME).FirstOrDefault();
			DnSpyFileList list;
			if (firstList != null)
				list = Create(firstList);
			else
				list = new DnSpyFileList(options, listName ?? DefaultListName);
			return Initialize(list);
		}
Esempio n. 17
0
        /// <summary>
        /// If automatic update checking is enabled, checks if there are any updates available.
        /// Returns the download URL if an update is available.
        /// Returns null if no update is available, or if no check was performed.
        /// </summary>
        public static Task <string> CheckForUpdatesIfEnabledAsync(DNSpySettings spySettings)
        {
            var            tcs = new TaskCompletionSource <string>();
            UpdateSettings s   = new UpdateSettings(spySettings);

            if (checkForUpdateCode && s.AutomaticUpdateCheckEnabled)
            {
                // 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 ||
                    s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7) ||
                    s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
                {
                    GetLatestVersionAsync().ContinueWith(
                        delegate(Task <AvailableVersionInfo> task) {
                        try {
                            s.LastSuccessfulUpdateCheck = DateTime.UtcNow;
                            AvailableVersionInfo v      = task.Result;
                            if (v.Version > currentVersion)
                            {
                                tcs.SetResult(v.DownloadUrl);
                            }
                            else
                            {
                                tcs.SetResult(null);
                            }
                        }
                        catch (AggregateException) {
                            // ignore errors getting the version info
                            tcs.SetResult(null);
                        }
                    });
                }
                else
                {
                    tcs.SetResult(null);
                }
            }
            else
            {
                tcs.SetResult(null);
            }
            return(tcs.Task);
        }
Esempio n. 18
0
        public bool DeleteList(string Name)
        {
            if (AssemblyLists.Contains(Name))
            {
                AssemblyLists.Remove(Name);

                DNSpySettings.Update(
                    delegate(XElement root)
                {
                    XElement doc = root.Element("AssemblyLists");
                    if (doc == null)
                    {
                        return;
                    }
                    XElement listElement = doc.Elements("List").FirstOrDefault(e => SessionSettings.Unescape((string)e.Attribute("name")) == Name);
                    if (listElement != null)
                    {
                        listElement.Remove();
                    }
                });
                return(true);
            }
            return(false);
        }
Esempio n. 19
0
 /// <summary>
 /// Saves the specifies assembly list into the config file.
 /// </summary>
 public static void SaveList(DnSpyFileList list)
 {
     DNSpySettings.Update((root) => {
         var doc = root.Element(FILELISTS_SECTION_NAME) ?? root.Element(FILELISTS_SECTION_NAME_OLD);
         if (doc != null)
         {
             doc.Name = FILELISTS_SECTION_NAME;
         }
         if (doc == null)
         {
             doc = new XElement(FILELISTS_SECTION_NAME);
             root.Add(doc);
         }
         XElement listElement = doc.Elements(LIST_SECTION_NAME).FirstOrDefault(e => SessionSettings.Unescape((string)e.Attribute("name")) == list.Name);
         if (listElement != null)
         {
             listElement.ReplaceWith(SaveAsXml(list));
         }
         else
         {
             doc.Add(SaveAsXml(list));
         }
     });
 }
Esempio n. 20
0
		void ShowMessageIfUpdatesAvailableAsync(DNSpySettings spySettings) {
			AboutPage.CheckForUpdatesIfEnabledAsync(spySettings).ContinueWith(
				delegate (Task<string> task) {
					if (task.Result != null) {
						updateAvailableDownloadUrl = task.Result;
						updateAvailablePanel.Visibility = Visibility.Visible;
					}
				},
				TaskScheduler.FromCurrentSynchronizationContext()
			);
		}
Esempio n. 21
0
		void Load(DNSpySettings settings) {
			var csx = settings[SETTINGS_NAME];
			UseHexadecimal = (bool?)csx.Attribute("UseHexadecimal") ?? true;
			SyntaxHighlightCallStack = (bool?)csx.Attribute("SyntaxHighlightCallStack") ?? true;
			SyntaxHighlightBreakpoints = (bool?)csx.Attribute("SyntaxHighlightBreakpoints") ?? true;
			SyntaxHighlightThreads = (bool?)csx.Attribute("SyntaxHighlightThreads") ?? true;
			SyntaxHighlightModules = (bool?)csx.Attribute("SyntaxHighlightModules") ?? true;
			SyntaxHighlightLocals = (bool?)csx.Attribute("SyntaxHighlightLocals") ?? true;
			SyntaxHighlightAttach = (bool?)csx.Attribute("SyntaxHighlightAttach") ?? true;
			SyntaxHighlightExceptions = (bool?)csx.Attribute("SyntaxHighlightExceptions") ?? true;
			BreakProcessType = (BreakProcessType)((int?)csx.Attribute("BreakProcessType") ?? (int)BreakProcessType.ModuleCctorOrEntryPoint);
			PropertyEvalAndFunctionCalls = (bool?)csx.Attribute("PropertyEvalAndFunctionCalls") ?? true;
			UseStringConversionFunction = (bool?)csx.Attribute("UseStringConversionFunction") ?? true;
			DebuggerBrowsableAttributesCanHidePropsFields = (bool?)csx.Attribute("DebuggerBrowsableAttributesCanHidePropsFields") ?? true;
			CompilerGeneratedAttributesCanHideFields = (bool?)csx.Attribute("CompilerGeneratedAttributesCanHideFields") ?? true;
			DisableManagedDebuggerDetection = (bool?)csx.Attribute("DisableManagedDebuggerDetection") ?? true;
			IgnoreBreakInstructions = (bool?)csx.Attribute("IgnoreBreakInstructions") ?? false;
			AutoOpenLocalsWindow = (bool?)csx.Attribute("AutoOpenLocalsWindow") ?? true;
			UseMemoryModules = (bool?)csx.Attribute("UseMemoryModules") ?? false;
			CoreCLRDbgShimFilename = SessionSettings.Unescape((string)csx.Attribute("CoreCLRDbgShimFilename") ?? string.Empty);
		}
Esempio n. 22
0
		/// <summary>
		/// Loads an assembly list from the ILSpySettings.
		/// If no list with the specified name is found, the default list is loaded instead.
		/// </summary>
		public DnSpyFileList LoadList(DNSpySettings spySettings, string listName) {
			DnSpyFileList list = DoLoadList(spySettings, listName);
			if (!FileLists.Contains(list.Name))
				FileLists.Add(list.Name);
			return list;
		}
Esempio n. 23
0
 /// <summary>
 /// Loads an assembly list from the ILSpySettings.
 /// If no list with the specified name is found, the default list is loaded instead.
 /// </summary>
 public AssemblyList LoadList(DNSpySettings spySettings, string listName)
 {
     AssemblyList list = DoLoadList(spySettings, listName);
     if (!AssemblyLists.Contains(list.ListName))
         AssemblyLists.Add(list.ListName);
     return list;
 }
Esempio n. 24
0
 AssemblyList DoLoadList(DNSpySettings spySettings, string listName)
 {
     XElement doc = spySettings["AssemblyLists"];
     if (listName != null) {
         foreach (var list in doc.Elements("List")) {
             if (SessionSettings.Unescape((string)list.Attribute("name")) == listName) {
                 return new AssemblyList(list);
             }
         }
     }
     XElement firstList = doc.Elements("List").FirstOrDefault();
     if (firstList != null)
         return new AssemblyList(firstList);
     else
         return new AssemblyList(listName ?? DefaultListName);
 }
Esempio n. 25
0
		static XElement GetFileListsElement(DNSpySettings spySettings) {
			var doc = spySettings.GetElement(FILELISTS_SECTION_NAME);
			if (doc == null)
				doc = spySettings[FILELISTS_SECTION_NAME_OLD];
			return doc ?? new XElement(FILELISTS_SECTION_NAME);
		}
Esempio n. 26
0
		public MainWindow() {
			instance = this;
			mainMenu = new Menu();
			spySettings = DNSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.sessionSettings.PropertyChanged += sessionSettings_PropertyChanged;
			var listOptions = new DnSpyFileListOptionsImpl(this.Dispatcher);
			this.dnSpyFileListManager = new DnSpyFileListManager(listOptions, spySettings);
			Themes.ThemeChanged += Themes_ThemeChanged;
			Themes.IsHighContrastChanged += (s, e) => Themes.SwitchThemeIfNecessary();
			Options.DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;
			OtherSettings.Instance.PropertyChanged += OtherSettings_PropertyChanged;
			InitializeTextEditorFontResource();

			languageComboBox = new ComboBox() {
				DisplayMemberPath = "Name",
				Width = 100,
				ItemsSource = Languages.AllLanguages,
			};
			languageComboBox.SetBinding(ComboBox.SelectedItemProperty, new Binding("FilterSettings.Language") {
				Source = sessionSettings,
			});

			InitializeComponent();
			AddTitleInfo(IntPtr.Size == 4 ? "x86" : "x64");
			App.CompositionContainer.ComposeParts(this);

			if (sessionSettings.LeftColumnWidth > 0)
				leftColumn.Width = new GridLength(sessionSettings.LeftColumnWidth, GridUnitType.Pixel);
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

			InstallCommands();

			tabGroupsManager = new TabGroupsManager<TabState>(tabGroupsContentPresenter, tabManager_OnSelectionChanged, tabManager_OnAddRemoveTabState);
			tabGroupsManager.OnTabGroupSelected += tabGroupsManager_OnTabGroupSelected;
			var theme = Themes.GetThemeOrDefault(sessionSettings.ThemeName);
			if (theme.IsHighContrast != Themes.IsHighContrast)
				theme = Themes.GetThemeOrDefault(Themes.CurrentDefaultThemeName) ?? theme;
			Themes.Theme = theme;
			InitializeAssemblyTreeView(treeView);

			InitMainMenu();
			InitToolbar();
			loadingImage.Source = ImageCache.Instance.GetImage("dnSpy-Big", theme.GetColor(ColorType.EnvironmentBackground).InheritedColor.Background.GetColor(null).Value);

			this.Activated += (s, e) => UpdateSystemMenuImage();
			this.Deactivated += (s, e) => UpdateSystemMenuImage();
			this.ContentRendered += MainWindow_ContentRendered;
			this.IsEnabled = false;
		}
Esempio n. 27
0
		public override void Load(DNSpySettings settings) {
			var xelem = settings[SETTINGS_SECTION_NAME];
			this.UseMemoryMappedIO = (bool?)xelem.Attribute("UseMemoryMappedIO") ?? true;
			this.DeserializeResources = (bool?)xelem.Attribute("DeserializeResources") ?? true;
			this.UseNewRenderer = (bool?)xelem.Attribute("UseNewRenderer") ?? false;
			TextFormatterFactory.TextFormatterProvider = UseNewRenderer ? TextFormatterProvider.GlyphRunFormatter : TextFormatterProvider.BuiltIn;
		}
Esempio n. 28
0
		void LoadingHandler(int i) {
			switch (i) {
			case 0:
				this.CommandBindings.Add(new CommandBinding(ILSpyTreeNode.TreeNodeActivatedEvent, TreeNodeActivatedExecuted));

				ContextMenuProvider.Add(treeView);

				DNSpySettings spySettings = this.spySettings;
				this.spySettings = null;

				this.dnspyFileList = dnSpyFileListManager.LoadList(spySettings, sessionSettings.ActiveAssemblyList);
				break;

			case 1:
				HandleCommandLineArguments(App.CommandLineArguments);

				if (dnspyFileList.GetDnSpyFiles().Length == 0
					&& dnspyFileList.Name == DnSpyFileListManager.DefaultListName) {
					LoadInitialAssemblies();
				}

				ShowAssemblyListDontAskUser(this.dnspyFileList);
				break;

			case 2:
				HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments);
				if (App.CommandLineArguments.NavigateTo == null && App.CommandLineArguments.AssembliesToLoad.Count != 1) {
					if (ICSharpCode.ILSpy.Options.DisplaySettingsPanel.CurrentDisplaySettings.RestoreTabsAtStartup) {
						RestoreTabGroups(sessionSettings.SavedTabGroupsState);
						if (!sessionSettings.TabsFound)
							AboutPage.Display(SafeActiveTextView);
					}
					else {
						AboutPage.Display(SafeActiveTextView);
					}
				}
				break;

			case 3:
				AvalonEditTextOutput output = new AvalonEditTextOutput();
				if (FormatExceptions(App.StartupExceptions.ToArray(), output))
					SafeActiveTextView.ShowText(output);

				if (topPane.Content == null) {
					var pane = GetPane(topPane, sessionSettings.TopPaneSettings.Name);
					if (pane != null)
						ShowInTopPane(pane);
				}
				if (bottomPane.Content == null) {
					var pane = GetPane(bottomPane, sessionSettings.BottomPaneSettings.Name);
					if (pane != null)
						ShowInBottomPane(pane);
				}
				break;

			case 4:
				foreach (var plugin in plugins)
					plugin.OnLoaded();

				var list = callWhenLoaded;
				callWhenLoaded = null;
				foreach (var func in list)
					func();

				break;

			case 5:
				this.IsEnabled = true;

				// Make sure that when no tabs are created that we have focus. If we don't do this we
				// can't press Ctrl+K and open the asm search.
				this.Focus();

				// Sometimes we get keyboard focus when it's better that the text editor gets the focus instead
				this.GotKeyboardFocus += MainWindow_GotKeyboardFocus;

				loadingControl.Visibility = Visibility.Collapsed;
				mainGrid.Visibility = Visibility.Visible;

				// In case a plugin has added their own bindings
				UninstallTabCommandBindings(ActiveTabState);
				InstallTabCommandBindings(ActiveTabState);

				// Flickering workaround fix. Could reproduce it when using VMWare + WinXP
				loadingProgressBar.IsIndeterminate = false;
				return;
			default:
				return;
			}
			StartLoadingHandler(i + 1);
		}
Esempio n. 29
0
		public DnSpyFileListManager(IDnSpyFileListOptions options, DNSpySettings spySettings) {
			this.options = options;
			var doc = GetFileListsElement(spySettings);
			foreach (var list in doc.Elements(LIST_SECTION_NAME))
				FileLists.Add(SessionSettings.Unescape((string)list.Attribute("name")));
		}
Esempio n. 30
0
		public override void Load(DNSpySettings settings) {
			var xelem = settings[SETTINGS_SECTION_NAME];
			DisassembleBaml = (bool?)xelem.Attribute("DisassembleBaml") ?? false;
		}
Esempio n. 31
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(DNSpySettings.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(dnSpy.StartUpClass), "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");
        }
Esempio n. 32
0
		public override void Load(DNSpySettings settings) {
			this.settings = DebuggerSettings.Instance.Clone();
			this.BreakProcessType = this.settings.BreakProcessType;
		}
Esempio n. 33
0
			public UpdateSettings(DNSpySettings spySettings) {
				XElement s = spySettings["UpdateSettings"];
				this.automaticUpdateCheckEnabled = (bool?)s.Element("AutomaticUpdateCheckEnabled") ?? true;
				try {
					this.lastSuccessfulUpdateCheck = (DateTime?)s.Element("LastSuccessfulUpdateCheck");
				}
				catch (FormatException) {
					// avoid crashing on settings files invalid due to
					// https://github.com/icsharpcode/ILSpy/issues/closed/#issue/2
				}
			}
Esempio n. 34
0
 public override void Load(DNSpySettings settings)
 {
     var xelem = settings[SETTINGS_SECTION_NAME];
     this.BytesGroupCountVM.Value = (int?)xelem.Attribute("BytesGroupCount") ?? 8;
     this.BytesPerLineVM.Value = (int?)xelem.Attribute("BytesPerLine") ?? 0;
     this.UseHexPrefix = (bool?)xelem.Attribute("UseHexPrefix") ?? false;
     this.ShowAscii = (bool?)xelem.Attribute("ShowAscii") ?? true;
     this.LowerCaseHex = (bool?)xelem.Attribute("LowerCaseHex") ?? false;
     this.FontFamily = new FontFamily(SessionSettings.Unescape((string)xelem.Attribute("FontFamily")) ?? FontUtils.GetDefaultFont());
     this.FontSize = (double?)xelem.Attribute("FontSize") ?? FontUtils.DEFAULT_FONT_SIZE;
     this.AsciiEncoding = (AsciiEncoding)((int?)xelem.Attribute("AsciiEncoding") ?? (int)AsciiEncoding.UTF8);
 }