Beispiel #1
0
 public void CopyValues(DisplaySettings s)
 {
     this.SelectedFont       = s.selectedFont;
     this.SelectedFontSize   = s.selectedFontSize;
     this.ShowLineNumbers    = s.showLineNumbers;
     this.ShowMetadataTokens = s.showMetadataTokens;
 }
        public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
        {
            XElement e = settings["DisplaySettings"];
            var      s = new DisplaySettings();

            s.SelectedFont               = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
            s.SelectedFontSize           = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
            s.ShowLineNumbers            = (bool?)e.Attribute("ShowLineNumbers") ?? false;
            s.ShowMetadataTokens         = (bool?)e.Attribute("ShowMetadataTokens") ?? false;
            s.ShowMetadataTokensInBase10 = (bool?)e.Attribute("ShowMetadataTokensInBase10") ?? false;
            s.ShowDebugInfo              = (bool?)e.Attribute("ShowDebugInfo") ?? false;
            s.EnableWordWrap             = (bool?)e.Attribute("EnableWordWrap") ?? false;
            s.SortResults             = (bool?)e.Attribute("SortResults") ?? true;
            s.FoldBraces              = (bool?)e.Attribute("FoldBraces") ?? false;
            s.ExpandMemberDefinitions = (bool?)e.Attribute("ExpandMemberDefinitions") ?? false;
            s.ExpandUsingDeclarations = (bool?)e.Attribute("ExpandUsingDeclarations") ?? false;
            s.IndentationUseTabs      = (bool?)e.Attribute("IndentationUseTabs") ?? true;
            s.IndentationSize         = (int?)e.Attribute("IndentationSize") ?? 4;
            s.IndentationTabSize      = (int?)e.Attribute("IndentationTabSize") ?? 4;
            s.HighlightMatchingBraces = (bool?)e.Attribute("HighlightMatchingBraces") ?? true;
            s.HighlightCurrentLine    = (bool?)e.Attribute("HighlightCurrentLine") ?? false;
            s.HideEmptyMetadataTables = (bool?)e.Attribute("HideEmptyMetadataTables") ?? true;
            s.UseNestedNamespaceNodes = (bool?)e.Attribute("UseNestedNamespaceNodes") ?? false;
            s.ShowRawOffsetsAndBytesBeforeInstruction = (bool?)e.Attribute("ShowRawOffsetsAndBytesBeforeInstruction") ?? false;
            s.StyleWindowTitleBar = (bool?)e.Attribute("StyleWindowTitleBar") ?? false;

            return(s);
        }
Beispiel #3
0
        public void Save(XElement root)
        {
            var s = (DisplaySettings)this.DataContext;

            var section = new XElement("DisplaySettings");

            section.SetAttributeValue("Font", s.SelectedFont.Source);
            section.SetAttributeValue("FontSize", s.SelectedFontSize);
            section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
            section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
            section.SetAttributeValue("EnableWordWrap", s.EnableWordWrap);

            XElement existingElement = root.Element("DisplaySettings");

            if (existingElement != null)
            {
                existingElement.ReplaceWith(section);
            }
            else
            {
                root.Add(section);
            }

            currentDisplaySettings = null;             // invalidate cached settings
        }
Beispiel #4
0
		public void CopyValues(DisplaySettings s)
		{
			this.SelectedFont = s.selectedFont;
			this.SelectedFontSize = s.selectedFontSize;
			this.ShowLineNumbers = s.showLineNumbers;
			this.ShowMetadataTokens = s.showMetadataTokens;
			this.EnableWordWrap = s.enableWordWrap;
			this.SortResults = s.sortResults;
		}
Beispiel #5
0
        public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
        {
            XElement        e = settings["DisplaySettings"];
            DisplaySettings s = new DisplaySettings();

            s.SelectedFont     = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
            s.SelectedFontSize = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
            s.ShowLineNumbers  = (bool?)e.Attribute("ShowLineNumbers") ?? false;

            return(s);
        }
Beispiel #6
0
 public void CopyValues(DisplaySettings s)
 {
     this.SelectedFont               = s.selectedFont;
     this.SelectedFontSize           = s.selectedFontSize;
     this.ShowLineNumbers            = s.showLineNumbers;
     this.ShowMetadataTokens         = s.showMetadataTokens;
     this.ShowMetadataTokensInBase10 = s.showMetadataTokensInBase10;
     this.EnableWordWrap             = s.enableWordWrap;
     this.SortResults             = s.sortResults;
     this.FoldBraces              = s.foldBraces;
     this.ExpandMemberDefinitions = s.expandMemberDefinitions;
 }
        public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
        {
            XElement e = settings["DisplaySettings"];
            var      s = new DisplaySettings();

            s.SelectedFont       = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
            s.SelectedFontSize   = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
            s.ShowLineNumbers    = (bool?)e.Attribute("ShowLineNumbers") ?? false;
            s.ShowMetadataTokens = (bool?)e.Attribute("ShowMetadataTokens") ?? false;
            s.EnableWordWrap     = (bool?)e.Attribute("EnableWordWrap") ?? false;
            s.SortResults        = (bool?)e.Attribute("SortResults") ?? false;

            return(s);
        }
Beispiel #8
0
 public void CopyValues(DisplaySettings s)
 {
     this.SelectedFont                      = s.selectedFont;
     this.SelectedFontSize                  = s.selectedFontSize;
     this.ShowLineNumbers                   = s.showLineNumbers;
     this.ShowMetadataTokens                = s.showMetadataTokens;
     this.ShowAssemblyVersion               = s.showAssemblyVersion;
     this.ShowAssemblyPublicKeyToken        = s.showAssemblyPublicKeyToken;
     this.DecompileFullType                 = s.decompileFullType;
     this.NewEmptyTabs                      = s.newEmptyTabs;
     this.RestoreTabsAtStartup              = s.restoreTabsAtStartup;
     this.AutoHighlightRefs                 = s.autoHighlightRefs;
     this.SyntaxHighlightTreeViewUI         = s.syntaxHighlightTreeViewUI;
     this.SyntaxHighlightAnalyzerTreeViewUI = s.syntaxHighlightAnalyzerTreeViewUI;
     this.SyntaxHighlightSearchListUI       = s.syntaxHighlightSearchListUI;
 }
Beispiel #9
0
 public void CopyValues(DisplaySettings s)
 {
     this.SelectedFont               = s.selectedFont;
     this.SelectedFontSize           = s.selectedFontSize;
     this.ShowLineNumbers            = s.showLineNumbers;
     this.ShowMetadataTokens         = s.showMetadataTokens;
     this.ShowMetadataTokensInBase10 = s.showMetadataTokensInBase10;
     this.ShowDebugInfo              = s.showDebugInfo;
     this.EnableWordWrap             = s.enableWordWrap;
     this.SortResults             = s.sortResults;
     this.FoldBraces              = s.foldBraces;
     this.ExpandMemberDefinitions = s.expandMemberDefinitions;
     this.ExpandUsingDeclarations = s.expandUsingDeclarations;
     this.IndentationUseTabs      = s.indentationUseTabs;
     this.IndentationTabSize      = s.indentationTabSize;
     this.IndentationSize         = s.indentationSize;
 }
Beispiel #10
0
        public override RefreshFlags Save(XElement root)
        {
            DisplaySettings s = this.settings;

            var flags = RefreshFlags.None;

            if (currentDisplaySettings.ShowMetadataTokens != s.ShowMetadataTokens ||
                currentDisplaySettings.ShowAssemblyVersion != s.ShowAssemblyVersion ||
                currentDisplaySettings.ShowAssemblyPublicKeyToken != s.ShowAssemblyPublicKeyToken)
            {
                flags |= RefreshFlags.TreeViewNodes;
            }

            currentDisplaySettings.CopyValues(s);

            XElement section = new XElement("DisplaySettings");

            section.SetAttributeValue("Font", SessionSettings.Escape(s.SelectedFont.Source));
            section.SetAttributeValue("FontSize", s.SelectedFontSize);
            section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);
            section.SetAttributeValue("ShowMetadataTokens", s.ShowMetadataTokens);
            section.SetAttributeValue("ShowAssemblyVersion", s.ShowAssemblyVersion);
            section.SetAttributeValue("ShowAssemblyPublicKeyToken", s.ShowAssemblyPublicKeyToken);
            section.SetAttributeValue("DecompileFullType", s.DecompileFullType);
            section.SetAttributeValue("NewEmptyTabs", s.NewEmptyTabs);
            section.SetAttributeValue("RestoreTabsAtStartup", s.RestoreTabsAtStartup);
            section.SetAttributeValue("AutoHighlightRefs", s.AutoHighlightRefs);
            section.SetAttributeValue("SyntaxHighlightTreeViewUI", s.SyntaxHighlightTreeViewUI);
            section.SetAttributeValue("SyntaxHighlightAnalyzerTreeViewUI", s.SyntaxHighlightAnalyzerTreeViewUI);
            section.SetAttributeValue("SyntaxHighlightSearchListUI", s.SyntaxHighlightSearchListUI);
            section.SetAttributeValue("SingleClickExpandsChildren", s.SingleClickExpandsChildren);

            XElement existingElement = root.Element("DisplaySettings");

            if (existingElement != null)
            {
                existingElement.ReplaceWith(section);
            }
            else
            {
                root.Add(section);
            }

            return(flags);
        }
Beispiel #11
0
 public void CopyValues(DisplaySettings s)
 {
     this.SelectedFont               = s.selectedFont;
     this.SelectedFontSize           = s.selectedFontSize;
     this.ShowLineNumbers            = s.showLineNumbers;
     this.ShowMetadataTokens         = s.showMetadataTokens;
     this.ShowMetadataTokensInBase10 = s.showMetadataTokensInBase10;
     this.ShowDebugInfo              = s.showDebugInfo;
     this.EnableWordWrap             = s.enableWordWrap;
     this.SortResults             = s.sortResults;
     this.FoldBraces              = s.foldBraces;
     this.ExpandMemberDefinitions = s.expandMemberDefinitions;
     this.ExpandUsingDeclarations = s.expandUsingDeclarations;
     this.IndentationUseTabs      = s.indentationUseTabs;
     this.IndentationTabSize      = s.indentationTabSize;
     this.IndentationSize         = s.indentationSize;
     this.HighlightMatchingBraces = s.highlightMatchingBraces;
     this.HighlightCurrentLine    = s.highlightCurrentLine;
     this.HideEmptyMetadataTables = s.hideEmptyMetadataTables;
     this.StyleWindowTitleBar     = s.styleWindowTitleBar;
 }
        public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
        {
            XElement        e = settings["DisplaySettings"];
            DisplaySettings s = new DisplaySettings();

            s.SelectedFont                      = new FontFamily(SessionSettings.Unescape((string)e.Attribute("Font")) ?? GetDefaultFont());
            s.SelectedFontSize                  = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
            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;

            return(s);
        }
Beispiel #13
0
        public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
        {
            XElement e = settings["DisplaySettings"];
            var      s = new DisplaySettings();

            s.SelectedFont               = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
            s.SelectedFontSize           = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
            s.ShowLineNumbers            = (bool?)e.Attribute("ShowLineNumbers") ?? false;
            s.ShowDebugInfo              = (bool?)e.Attribute("ShowDebugInfo") ?? false;
            s.ShowMetadataTokens         = (bool?)e.Attribute("ShowMetadataTokens") ?? false;
            s.ShowMetadataTokensInBase10 = (bool?)e.Attribute("ShowMetadataTokensInBase10") ?? false;
            s.EnableWordWrap             = (bool?)e.Attribute("EnableWordWrap") ?? false;
            s.SortResults             = (bool?)e.Attribute("SortResults") ?? true;
            s.FoldBraces              = (bool?)e.Attribute("FoldBraces") ?? false;
            s.ExpandMemberDefinitions = (bool?)e.Attribute("ExpandMemberDefinitions") ?? false;
            s.ExpandUsingDeclarations = (bool?)e.Attribute("ExpandUsingDeclarations") ?? false;
            s.IndentationUseTabs      = (bool?)e.Attribute("IndentationUseTabs") ?? true;
            s.IndentationSize         = (int?)e.Attribute("IndentationSize") ?? 4;
            s.IndentationTabSize      = (int?)e.Attribute("IndentationTabSize") ?? 4;

            return(s);
        }
Beispiel #14
0
        public void Save(XElement root)
        {
            DisplaySettings s = (DisplaySettings)this.DataContext;

            currentDisplaySettings.CopyValues(s);

            XElement section = new XElement("DisplaySettings");

            section.SetAttributeValue("Font", s.SelectedFont.Source);
            section.SetAttributeValue("FontSize", s.SelectedFontSize);
            section.SetAttributeValue("ShowLineNumbers", s.ShowLineNumbers);

            XElement existingElement = root.Element("DisplaySettings");

            if (existingElement != null)
            {
                existingElement.ReplaceWith(section);
            }
            else
            {
                root.Add(section);
            }
        }
 public void LoadDefaults()
 {
     currentDisplaySettings = new DisplaySettings();
     this.DataContext       = currentDisplaySettings;
 }
Beispiel #16
0
		public void CopyValues(DisplaySettings s)
		{
			this.SelectedFont = s.selectedFont;
			this.SelectedFontSize = s.selectedFontSize;
			this.ShowLineNumbers = s.showLineNumbers;
			this.ShowMetadataTokens = s.showMetadataTokens;
			this.ShowAssemblyVersion = s.showAssemblyVersion;
			this.ShowAssemblyPublicKeyToken = s.showAssemblyPublicKeyToken;
			this.DecompileFullType = s.decompileFullType;
			this.NewEmptyTabs = s.newEmptyTabs;
			this.RestoreTabsAtStartup = s.restoreTabsAtStartup;
			this.AutoHighlightRefs = s.autoHighlightRefs;
			this.SyntaxHighlightTreeViewUI = s.syntaxHighlightTreeViewUI;
			this.SyntaxHighlightAnalyzerTreeViewUI = s.syntaxHighlightAnalyzerTreeViewUI;
			this.SyntaxHighlightSearchListUI = s.syntaxHighlightSearchListUI;
			this.SingleClickExpandsChildren = s.singleClickExpandsChildren;
		}
Beispiel #17
0
        public DecompilationOptions(LanguageVersion version, Decompiler.DecompilerSettings settings, Options.DisplaySettings displaySettings)
        {
            if (!Enum.TryParse(version?.Version, out Decompiler.CSharp.LanguageVersion languageVersion))
            {
                languageVersion = Decompiler.CSharp.LanguageVersion.Latest;
            }
            var newSettings = this.DecompilerSettings = settings.Clone();

            newSettings.SetLanguageVersion(languageVersion);
            newSettings.ExpandMemberDefinitions = displaySettings.ExpandMemberDefinitions;
            newSettings.ExpandUsingDeclarations = displaySettings.ExpandUsingDeclarations;
            newSettings.FoldBraces    = displaySettings.FoldBraces;
            newSettings.ShowDebugInfo = displaySettings.ShowDebugInfo;
            newSettings.CSharpFormattingOptions.IndentationString = GetIndentationString(displaySettings);
        }
 public DecompilationOptions(LanguageVersion version, Options.DecompilerSettings settings, Options.DisplaySettings displaySettings)
 {
     if (!Enum.TryParse(version.Version, out Decompiler.CSharp.LanguageVersion languageVersion))
     {
         languageVersion = Decompiler.CSharp.LanguageVersion.Latest;
     }
     this.DecompilerSettings = new Decompiler.DecompilerSettings(languageVersion)
     {
         AlwaysUseBraces         = settings.AlwaysUseBraces,
         ExpandMemberDefinitions = displaySettings.ExpandMemberDefinitions,
         FoldBraces                     = displaySettings.FoldBraces,
         RemoveDeadCode                 = settings.RemoveDeadCode,
         ShowDebugInfo                  = settings.ShowDebugInfo,
         ShowXmlDocumentation           = settings.ShowXmlDocumentation,
         UseDebugSymbols                = settings.UseDebugSymbols,
         UsingDeclarations              = settings.UsingDeclarations,
         ApplyWindowsRuntimeProjections = settings.ApplyWindowsRuntimeProjections,
     };
 }
Beispiel #19
0
		public override void Load(ILSpySettings settings) {
			this.settings = LoadDisplaySettings(settings);
		}
Beispiel #20
0
		public static DisplaySettings LoadDisplaySettings(ILSpySettings 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 #21
0
 public override void Load(DNSpySettings settings)
 {
     this.settings = LoadDisplaySettings(settings);
 }
		public static DisplaySettings LoadDisplaySettings(ILSpySettings settings)
		{
			XElement e = settings["DisplaySettings"];
			DisplaySettings s = new DisplaySettings();
			s.SelectedFont = new FontFamily((string)e.Attribute("Font") ?? "Consolas");
			s.SelectedFontSize = (double?)e.Attribute("FontSize") ?? 10.0 * 4 / 3;
			s.ShowLineNumbers = (bool?)e.Attribute("ShowLineNumbers") ?? false;
			s.ShowMetadataTokens = (bool?) e.Attribute("ShowMetadataTokens") ?? false;
			
			return s;
		}
Beispiel #23
0
		public void CopyValues(DisplaySettings s)
		{
			this.SelectedFont = s.selectedFont;
			this.SelectedFontSize = s.selectedFontSize;
			this.ShowLineNumbers = s.showLineNumbers;
			this.ShowMetadataTokens = s.showMetadataTokens;
			this.EnableWordWrap = s.enableWordWrap;
		}
Beispiel #24
0
		public void CopyValues(DisplaySettings s)
		{
			this.SelectedFont = s.selectedFont;
			this.SelectedFontSize = s.selectedFontSize;
			this.ShowLineNumbers = s.showLineNumbers;
		}