public static DecompilerSettings LoadDecompilerSettings(DNSpySettings settings)
        {
            XElement           e = settings["DecompilerSettings"];
            DecompilerSettings s = new DecompilerSettings();

            s.AnonymousMethods               = (bool?)e.Attribute("anonymousMethods") ?? s.AnonymousMethods;
            s.YieldReturn                    = (bool?)e.Attribute("yieldReturn") ?? s.YieldReturn;
            s.AsyncAwait                     = (bool?)e.Attribute("asyncAwait") ?? s.AsyncAwait;
            s.QueryExpressions               = (bool?)e.Attribute("queryExpressions") ?? s.QueryExpressions;
            s.ExpressionTrees                = (bool?)e.Attribute("expressionTrees") ?? s.ExpressionTrees;
            s.UseDebugSymbols                = (bool?)e.Attribute("useDebugSymbols") ?? s.UseDebugSymbols;
            s.ShowXmlDocumentation           = (bool?)e.Attribute("xmlDoc") ?? s.ShowXmlDocumentation;
            s.ShowILComments                 = (bool?)e.Attribute("showILComments") ?? s.ShowILComments;
            s.RemoveEmptyDefaultConstructors = (bool?)e.Attribute("removeEmptyDefaultConstructors") ?? s.RemoveEmptyDefaultConstructors;
            s.ShowTokenAndRvaComments        = (bool?)e.Attribute("showTokenAndRvaComments") ?? s.ShowTokenAndRvaComments;
            s.ShowILBytes                    = (bool?)e.Attribute("showILBytes") ?? s.ShowILBytes;
            s.DecompilationObject0           = (DecompilationObject)((int?)e.Attribute("decompilationObject0") ?? (int)s.DecompilationObject0);
            s.DecompilationObject1           = (DecompilationObject)((int?)e.Attribute("decompilationObject1") ?? (int)s.DecompilationObject1);
            s.DecompilationObject2           = (DecompilationObject)((int?)e.Attribute("decompilationObject2") ?? (int)s.DecompilationObject2);
            s.DecompilationObject3           = (DecompilationObject)((int?)e.Attribute("decompilationObject3") ?? (int)s.DecompilationObject3);
            s.DecompilationObject4           = (DecompilationObject)((int?)e.Attribute("decompilationObject4") ?? (int)s.DecompilationObject4);
            s.SortMembers                    = (bool?)e.Attribute("sortMembers") ?? s.SortMembers;
            s.ForceShowAllMembers            = (bool?)e.Attribute("forceShowAllMembers") ?? s.ForceShowAllMembers;
            s.SortSystemUsingStatementsFirst = (bool?)e.Attribute("sortSystemUsingStatementsFirst") ?? s.SortSystemUsingStatementsFirst;
            return(s);
        }
Beispiel #2
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;
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 void Save()
 {
     if (this != LocalsSettings.Instance)
     {
         return;
     }
     DNSpySettings.Update(root => Save(root));
 }
Beispiel #5
0
 void Save()
 {
     if (this != DebuggerSettings.Instance)
     {
         return;
     }
     DNSpySettings.Update(root => Save(root));
 }
Beispiel #6
0
 void Save()
 {
     if (this != BreakpointSettings.Instance)
     {
         return;
     }
     DNSpySettings.Update(root => Save(root));
 }
Beispiel #7
0
 void Save()
 {
     if (this != CallStackSettings.Instance)
     {
         return;
     }
     DNSpySettings.Update(root => Save(root));
 }
Beispiel #8
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;
        }
        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);
            }
        }
Beispiel #10
0
        void Load()
        {
            try {
                disableSaveCounter++;

                Load(DNSpySettings.Load());
            }
            finally {
                disableSaveCounter--;
            }
        }
Beispiel #11
0
        void Load()
        {
            try {
                disableSaveCounter++;

                var settings = DNSpySettings.Load();
                var csx      = settings[SETTINGS_NAME];
                ShowTokens = (bool?)csx.Attribute("ShowTokens") ?? true;
            }
            finally {
                disableSaveCounter--;
            }
        }
Beispiel #12
0
 void OKButton_Click(object sender, RoutedEventArgs e)
 {
     RefreshFlags = RefreshFlags.None;
     DNSpySettings.Update(
         delegate(XElement root) {
         foreach (var optionPage in optionPages)
         {
             RefreshFlags |= optionPage.Save(root);
         }
     });
     this.DialogResult = true;
     Close();
 }
Beispiel #13
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);
        }
Beispiel #14
0
        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);
            }
        }
Beispiel #15
0
        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;
                }
            }
        }
Beispiel #16
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;
            CoreCLRDbgShimFilename          = SessionSettings.Unescape((string)csx.Attribute("CoreCLRDbgShimFilename") ?? string.Empty);
        }
Beispiel #17
0
        public static DisplaySettings LoadDisplaySettings(DNSpySettings settings)
        {
            XElement        e = settings["DisplaySettings"];
            DisplaySettings s = new DisplaySettings();

            s.SelectedFont                      = new FontFamily(SessionSettings.Unescape((string)e.Attribute("Font")) ?? FontUtils.GetDefaultFont());
            s.SelectedFontSize                  = (double?)e.Attribute("FontSize") ?? FontUtils.DEFAULT_FONT_SIZE;
            s.ShowLineNumbers                   = (bool?)e.Attribute("ShowLineNumbers") ?? true;
            s.ShowMetadataTokens                = (bool?)e.Attribute("ShowMetadataTokens") ?? true;
            s.ShowAssemblyVersion               = (bool?)e.Attribute("ShowAssemblyVersion") ?? true;
            s.ShowAssemblyPublicKeyToken        = (bool?)e.Attribute("ShowAssemblyPublicKeyToken") ?? false;
            s.DecompileFullType                 = (bool?)e.Attribute("DecompileFullType") ?? true;
            s.NewEmptyTabs                      = (bool?)e.Attribute("NewEmptyTabs") ?? false;
            s.RestoreTabsAtStartup              = (bool?)e.Attribute("RestoreTabsAtStartup") ?? true;
            s.AutoHighlightRefs                 = (bool?)e.Attribute("AutoHighlightRefs") ?? true;
            s.SyntaxHighlightTreeViewUI         = (bool?)e.Attribute("SyntaxHighlightTreeViewUI") ?? true;
            s.SyntaxHighlightAnalyzerTreeViewUI = (bool?)e.Attribute("SyntaxHighlightAnalyzerTreeViewUI") ?? true;
            s.SyntaxHighlightSearchListUI       = (bool?)e.Attribute("SyntaxHighlightSearchListUI") ?? true;
            s.SingleClickExpandsChildren        = (bool?)e.Attribute("SingleClickExpandsChildren") ?? true;

            return(s);
        }
Beispiel #18
0
        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--;
            }
        }
		public static DecompilerSettings LoadDecompilerSettings(DNSpySettings settings) {
			XElement e = settings["DecompilerSettings"];
			DecompilerSettings s = new DecompilerSettings();
			s.AnonymousMethods = (bool?)e.Attribute("anonymousMethods") ?? s.AnonymousMethods;
			s.YieldReturn = (bool?)e.Attribute("yieldReturn") ?? s.YieldReturn;
			s.AsyncAwait = (bool?)e.Attribute("asyncAwait") ?? s.AsyncAwait;
			s.QueryExpressions = (bool?)e.Attribute("queryExpressions") ?? s.QueryExpressions;
			s.ExpressionTrees = (bool?)e.Attribute("expressionTrees") ?? s.ExpressionTrees;
			s.UseDebugSymbols = (bool?)e.Attribute("useDebugSymbols") ?? s.UseDebugSymbols;
			s.ShowXmlDocumentation = (bool?)e.Attribute("xmlDoc") ?? s.ShowXmlDocumentation;
			s.ShowILComments = (bool?)e.Attribute("showILComments") ?? s.ShowILComments;
			s.RemoveEmptyDefaultConstructors = (bool?)e.Attribute("removeEmptyDefaultConstructors") ?? s.RemoveEmptyDefaultConstructors;
			s.ShowTokenAndRvaComments = (bool?)e.Attribute("showTokenAndRvaComments") ?? s.ShowTokenAndRvaComments;
			s.ShowILBytes = (bool?)e.Attribute("showILBytes") ?? s.ShowILBytes;
			s.DecompilationObject0 = (DecompilationObject)((int?)e.Attribute("decompilationObject0") ?? (int)s.DecompilationObject0);
			s.DecompilationObject1 = (DecompilationObject)((int?)e.Attribute("decompilationObject1") ?? (int)s.DecompilationObject1);
			s.DecompilationObject2 = (DecompilationObject)((int?)e.Attribute("decompilationObject2") ?? (int)s.DecompilationObject2);
			s.DecompilationObject3 = (DecompilationObject)((int?)e.Attribute("decompilationObject3") ?? (int)s.DecompilationObject3);
			s.DecompilationObject4 = (DecompilationObject)((int?)e.Attribute("decompilationObject4") ?? (int)s.DecompilationObject4);
			s.SortMembers = (bool?)e.Attribute("sortMembers") ?? s.SortMembers;
			s.ForceShowAllMembers = (bool?)e.Attribute("forceShowAllMembers") ?? s.ForceShowAllMembers;
			s.SortSystemUsingStatementsFirst = (bool?)e.Attribute("sortSystemUsingStatementsFirst") ?? s.SortSystemUsingStatementsFirst;
			return s;
		}
 public override void Load(DNSpySettings settings)
 {
     this.settings = LoadDecompilerSettings(settings);
 }
Beispiel #21
0
 void Save()
 {
     DNSpySettings.Update(root => Save(root));
 }
Beispiel #22
0
 public override void Load(DNSpySettings settings)
 {
     this.settings         = DebuggerSettings.Instance.Clone();
     this.BreakProcessType = this.settings.BreakProcessType;
 }
		public override void Load(DNSpySettings settings) {
			this.settings = LoadDecompilerSettings(settings);
		}
Beispiel #24
0
 public abstract void Load(DNSpySettings settings);
Beispiel #25
0
 public override void Load(DNSpySettings settings)
 {
     this.settings = LoadDisplaySettings(settings);
 }
Beispiel #26
0
        public override void Load(DNSpySettings settings)
        {
            var xelem = settings[SETTINGS_SECTION_NAME];

            DisassembleBaml = (bool?)xelem.Attribute("DisassembleBaml") ?? false;
        }
Beispiel #27
0
		public abstract void Load(DNSpySettings settings);
Beispiel #28
0
		public override void Load(DNSpySettings settings) {
			this.settings = LoadDisplaySettings(settings);
		}
Beispiel #29
0
		public static DisplaySettings LoadDisplaySettings(DNSpySettings settings) {
			XElement e = settings["DisplaySettings"];
			DisplaySettings s = new DisplaySettings();
			s.SelectedFont = new FontFamily(SessionSettings.Unescape((string)e.Attribute("Font")) ?? FontUtils.GetDefaultFont());
			s.SelectedFontSize = (double?)e.Attribute("FontSize") ?? FontUtils.DEFAULT_FONT_SIZE;
			s.ShowLineNumbers = (bool?)e.Attribute("ShowLineNumbers") ?? true;
			s.ShowMetadataTokens = (bool?)e.Attribute("ShowMetadataTokens") ?? true;
			s.ShowAssemblyVersion = (bool?)e.Attribute("ShowAssemblyVersion") ?? true;
			s.ShowAssemblyPublicKeyToken = (bool?)e.Attribute("ShowAssemblyPublicKeyToken") ?? false;
			s.DecompileFullType = (bool?)e.Attribute("DecompileFullType") ?? true;
			s.NewEmptyTabs = (bool?)e.Attribute("NewEmptyTabs") ?? false;
			s.RestoreTabsAtStartup = (bool?)e.Attribute("RestoreTabsAtStartup") ?? true;
			s.AutoHighlightRefs = (bool?)e.Attribute("AutoHighlightRefs") ?? true;
			s.SyntaxHighlightTreeViewUI = (bool?)e.Attribute("SyntaxHighlightTreeViewUI") ?? true;
			s.SyntaxHighlightAnalyzerTreeViewUI = (bool?)e.Attribute("SyntaxHighlightAnalyzerTreeViewUI") ?? true;
			s.SyntaxHighlightSearchListUI = (bool?)e.Attribute("SyntaxHighlightSearchListUI") ?? true;
			s.SingleClickExpandsChildren = (bool?)e.Attribute("SingleClickExpandsChildren") ?? true;

			return s;
		}