public DecompilationOptions(LanguageVersion version, Options.DecompilerSettings settings) { 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 = settings.ExpandMemberDefinitions, FoldBraces = settings.FoldBraces, RemoveDeadCode = settings.RemoveDeadCode, ShowDebugInfo = settings.ShowDebugInfo, ShowXmlDocumentation = settings.ShowXmlDocumentation, UseDebugSymbols = settings.UseDebugSymbols, UsingDeclarations = settings.UsingDeclarations, }; }
public override RefreshFlags Save(XElement root) { DecompilerSettings s = this.settings; var flags = RefreshFlags.None; if (CurrentDecompilerSettings.AnonymousMethods != s.AnonymousMethods) { flags |= RefreshFlags.ILAst | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.ExpressionTrees != s.ExpressionTrees) { flags |= RefreshFlags.ILAst; } if (CurrentDecompilerSettings.YieldReturn != s.YieldReturn) { flags |= RefreshFlags.ILAst | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.AsyncAwait != s.AsyncAwait) { flags |= RefreshFlags.ILAst | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.AutomaticProperties != s.AutomaticProperties) { flags |= RefreshFlags.CSharp | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.AutomaticEvents != s.AutomaticEvents) { flags |= RefreshFlags.CSharp | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.UsingStatement != s.UsingStatement) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.ForEachStatement != s.ForEachStatement) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.LockStatement != s.LockStatement) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.SwitchStatementOnString != s.SwitchStatementOnString) { flags |= RefreshFlags.CSharp | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.UsingDeclarations != s.UsingDeclarations) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.QueryExpressions != s.QueryExpressions) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.FullyQualifyAmbiguousTypeNames != s.FullyQualifyAmbiguousTypeNames) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.UseDebugSymbols != s.UseDebugSymbols) { flags |= RefreshFlags.DecompileAll; } if (CurrentDecompilerSettings.ObjectOrCollectionInitializers != s.ObjectOrCollectionInitializers) { flags |= RefreshFlags.ILAst; } if (CurrentDecompilerSettings.ShowXmlDocumentation != s.ShowXmlDocumentation) { flags |= RefreshFlags.DecompileAll; } if (CurrentDecompilerSettings.ShowILComments != s.ShowILComments) { flags |= RefreshFlags.IL; } if (CurrentDecompilerSettings.RemoveEmptyDefaultConstructors != s.RemoveEmptyDefaultConstructors) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.IntroduceIncrementAndDecrement != s.IntroduceIncrementAndDecrement) { flags |= RefreshFlags.ILAst; } if (CurrentDecompilerSettings.MakeAssignmentExpressions != s.MakeAssignmentExpressions) { flags |= RefreshFlags.ILAst; } if (CurrentDecompilerSettings.AlwaysGenerateExceptionVariableForCatchBlocks != s.AlwaysGenerateExceptionVariableForCatchBlocks) { flags |= RefreshFlags.ILAst; } if (CurrentDecompilerSettings.ShowTokenAndRvaComments != s.ShowTokenAndRvaComments) { flags |= RefreshFlags.DecompileAll; } if (CurrentDecompilerSettings.ShowILBytes != s.ShowILBytes) { flags |= RefreshFlags.IL; } if (CurrentDecompilerSettings.DecompilationObject0 != s.DecompilationObject0) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.DecompilationObject1 != s.DecompilationObject1) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.DecompilationObject2 != s.DecompilationObject2) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.DecompilationObject3 != s.DecompilationObject3) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.DecompilationObject4 != s.DecompilationObject4) { flags |= RefreshFlags.CSharp; } if (CurrentDecompilerSettings.SortMembers != s.SortMembers) { flags |= RefreshFlags.IL | RefreshFlags.CSharp; } if (CurrentDecompilerSettings.ForceShowAllMembers != s.ForceShowAllMembers) { flags |= RefreshFlags.CSharp | RefreshFlags.TreeViewNodes; } if (CurrentDecompilerSettings.SortSystemUsingStatementsFirst != s.SortSystemUsingStatementsFirst) { flags |= RefreshFlags.CSharp; } XElement section = new XElement("DecompilerSettings"); section.SetAttributeValue("anonymousMethods", s.AnonymousMethods); section.SetAttributeValue("yieldReturn", s.YieldReturn); section.SetAttributeValue("asyncAwait", s.AsyncAwait); section.SetAttributeValue("queryExpressions", s.QueryExpressions); section.SetAttributeValue("expressionTrees", s.ExpressionTrees); section.SetAttributeValue("useDebugSymbols", s.UseDebugSymbols); section.SetAttributeValue("xmlDoc", s.ShowXmlDocumentation); section.SetAttributeValue("showILComments", s.ShowILComments); section.SetAttributeValue("removeEmptyDefaultConstructors", s.RemoveEmptyDefaultConstructors); section.SetAttributeValue("showTokenAndRvaComments", s.ShowTokenAndRvaComments); section.SetAttributeValue("showILBytes", s.ShowILBytes); section.SetAttributeValue("decompilationObject0", (int)s.DecompilationObject0); section.SetAttributeValue("decompilationObject1", (int)s.DecompilationObject1); section.SetAttributeValue("decompilationObject2", (int)s.DecompilationObject2); section.SetAttributeValue("decompilationObject3", (int)s.DecompilationObject3); section.SetAttributeValue("decompilationObject4", (int)s.DecompilationObject4); section.SetAttributeValue("sortMembers", s.SortMembers); section.SetAttributeValue("forceShowAllMembers", s.ForceShowAllMembers); section.SetAttributeValue("sortSystemUsingStatementsFirst", s.SortSystemUsingStatementsFirst); XElement existingElement = root.Element("DecompilerSettings"); if (existingElement != null) { existingElement.ReplaceWith(section); } else { root.Add(section); } currentDecompilerSettings = null; // invalidate cached settings return(flags); }
public PropertyGridHost(DecompilerSettings settings) { InitializeComponent(); this.propertyGrid.SelectedObject = Settings = settings; }
public override void Load(ILSpySettings settings) { this.settings = LoadDecompilerSettings(settings); }