public OptionsDialog() { InitializeComponent(); DNSpySettings settings = DNSpySettings.Load(); var creators = MefState.Instance.optionPages.OrderBy(p => p.Metadata.Order).ToArray(); optionPages = creators.Select(p => p.Value.Create()).ToArray(); for (int i = 0; i < creators.Length; i++) { TabItem tabItem = new TabItem(); tabItem.Header = creators[i].Metadata.Title; tabItem.Content = new ScrollViewer { // Disable the horizontal scrollbar since some pages have textboxes and they // will grow if the text doesn't fit and there's a horizontal scrollbar. HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Content = optionPages[i], }; tabControl.Items.Add(tabItem); optionPages[i].Load(settings); } foreach (var page in optionPages) { page.PropertyChanged += (s, e) => HasErrorUpdated(); } HasErrorUpdated(); }
void LoadInternal() { DNSpySettings settings = DNSpySettings.Load(); var bpsx = settings[SETTINGS_NAME]; BreakpointManager.Instance.Clear(); foreach (var bpx in bpsx.Elements("Breakpoint")) { uint? token = (uint?)bpx.Attribute("Token"); string asmFullName = SessionSettings.Unescape((string)bpx.Attribute("AssemblyFullName")); string moduleName = SessionSettings.Unescape((string)bpx.Attribute("ModuleName")); bool? isDynamic = (bool?)bpx.Attribute("IsDynamic"); bool? isInMemory = (bool?)bpx.Attribute("IsInMemory"); uint? ilOffset = (uint?)bpx.Attribute("ILOffset"); bool? isEnabled = (bool?)bpx.Attribute("IsEnabled"); if (token == null) { continue; } if (isDynamic == null || isInMemory == null) { continue; } if (string.IsNullOrEmpty(asmFullName)) { continue; } if (string.IsNullOrEmpty(moduleName)) { continue; } if (ilOffset == null) { continue; } if (isEnabled == null) { continue; } var snModule = SerializedDnSpyModule.Create(asmFullName, moduleName, isDynamic.Value, isInMemory.Value); var key = new SerializedDnSpyToken(snModule, token.Value); if (!isInMemory.Value && !isDynamic.Value) { var s = SessionSettings.Unescape((string)bpx.Attribute("Method")); if (s == null || s != GetMethodAsString(key)) { continue; } } var bp = new ILCodeBreakpoint(key, ilOffset.Value, isEnabled.Value); BreakpointManager.Instance.Add(bp); } }
void Load() { try { disableSaveCounter++; Load(DNSpySettings.Load()); } finally { disableSaveCounter--; } }
void Load() { try { disableSaveCounter++; var settings = DNSpySettings.Load(); var csx = settings[SETTINGS_NAME]; ShowTokens = (bool?)csx.Attribute("ShowTokens") ?? true; } finally { disableSaveCounter--; } }
void LoadInternal() { DNSpySettings settings = DNSpySettings.Load(); var bpsx = settings[SETTINGS_NAME]; BreakpointManager.Instance.Clear(); foreach (var bpx in bpsx.Elements("Breakpoint")) { uint? token = (uint?)bpx.Attribute("Token"); string assemblyFullPath = SessionSettings.Unescape((string)bpx.Attribute("AssemblyFullPath")); string moduleFullPath = SessionSettings.Unescape((string)bpx.Attribute("ModuleFullPath")); bool isDynamic = (bool?)bpx.Attribute("IsDynamic") ?? false; bool isInMemory = (bool?)bpx.Attribute("IsInMemory") ?? false; uint? ilOffset = (uint?)bpx.Attribute("ILOffset") ?? (uint?)bpx.Attribute("From"); //TODO: Remove "From" some time after this commit bool? isEnabled = (bool?)bpx.Attribute("IsEnabled"); if (token == null) { continue; } if (string.IsNullOrEmpty(moduleFullPath)) { continue; } if (ilOffset == null) { continue; } if (isEnabled == null) { continue; } var snModule = new SerializedDnModule(moduleFullPath, isDynamic, isInMemory); var key = MethodKey.Create(token.Value, snModule); if (!isInMemory) { var s = SessionSettings.Unescape((string)bpx.Attribute("Method")); if (s == null || s != GetMethodAsString(assemblyFullPath, key)) { continue; } } var bp = new ILCodeBreakpoint(assemblyFullPath, key, ilOffset.Value, isEnabled.Value); BreakpointManager.Instance.Add(bp); } }
void LoadInternal() { DNSpySettings settings = DNSpySettings.Load(); var exs = settings[SETTINGS_NAME]; ExceptionManager.Instance.RestoreDefaults(); foreach (var exx in exs.Elements("Exception")) { var exceptionType = (ExceptionType?)(int?)exx.Attribute("ExceptionType"); var fullName = SessionSettings.Unescape((string)exx.Attribute("FullName")); bool?breakOnFirstChance = (bool?)exx.Attribute("BreakOnFirstChance"); bool isOtherExceptions = (bool?)exx.Attribute("IsOtherExceptions") ?? false; var diffType = (ExceptionDiffType?)(int?)exx.Attribute("DiffType"); if (diffType == null) { continue; } if (exceptionType == null || (int)exceptionType.Value < 0 || exceptionType.Value >= ExceptionType.Last) { continue; } if (fullName == null) { continue; } var key = new ExceptionInfoKey(exceptionType.Value, fullName); switch (diffType.Value) { case ExceptionDiffType.Remove: ExceptionManager.Instance.Remove(key); break; case ExceptionDiffType.AddOrUpdate: if (breakOnFirstChance == null) { continue; } ExceptionManager.Instance.AddOrUpdate(key, breakOnFirstChance.Value, isOtherExceptions); break; default: Debug.Fail("Unknown ExceptionDiffType"); break; } } }
void Load() { try { disableSaveCounter++; var settings = DNSpySettings.Load(); var csx = settings[SETTINGS_NAME]; ShowModuleNames = (bool?)csx.Attribute("ShowModuleNames") ?? true; ShowParameterTypes = (bool?)csx.Attribute("ShowParameterTypes") ?? true; ShowParameterNames = (bool?)csx.Attribute("ShowParameterNames") ?? true; ShowParameterValues = (bool?)csx.Attribute("ShowParameterValues") ?? false; ShowIP = (bool?)csx.Attribute("ShowIP") ?? true; ShowOwnerTypes = (bool?)csx.Attribute("ShowOwnerTypes") ?? true; ShowNamespaces = (bool?)csx.Attribute("ShowNamespaces") ?? true; ShowTypeKeywords = (bool?)csx.Attribute("ShowTypeKeywords") ?? true; ShowTokens = (bool?)csx.Attribute("ShowTokens") ?? false; ShowReturnTypes = (bool?)csx.Attribute("ShowReturnTypes") ?? false; } finally { disableSaveCounter--; } }