// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.ComponentModel; using System.Runtime.CompilerServices; using ICSharpCode.Decompiler.CSharp.OutputVisitor; namespace ICSharpCode.Decompiler { /// /// Settings for the decompiler. /// public class DecompilerSettings : INotifyPropertyChanged { /// /// Equivalent to new DecompilerSettings(LanguageVersion.Latest) /// public DecompilerSettings() { } /// /// Creates a new DecompilerSettings instance with initial settings /// appropriate for the specified language version. /// /// /// This does not imply that the resulting code strictly uses only language features from /// that version. Language constructs like generics or ref locals cannot be removed from /// the compiled code. /// public DecompilerSettings(CSharp.LanguageVersion languageVersion) { SetLanguageVersion(languageVersion); } /// /// Deactivates all language features from versions newer than . /// public void SetLanguageVersion(CSharp.LanguageVersion languageVersion) { // By default, all decompiler features are enabled. // Disable some of them based on language version: if (languageVersion < CSharp.LanguageVersion.CSharp2) { anonymousMethods = false; liftNullables = false; yieldReturn = false; useImplicitMethodGroupConversion = false; } if (languageVersion < CSharp.LanguageVersion.CSharp3) { anonymousTypes = false; useLambdaSyntax = false; objectCollectionInitializers = false; automaticProperties = false; extensionMethods = false; queryExpressions = false; expressionTrees = false; } if (languageVersion < CSharp.LanguageVersion.CSharp4) { dynamic = false; namedArguments = false; optionalArguments = false; } if (languageVersion < CSharp.LanguageVersion.CSharp5) { asyncAwait = false; } if (languageVersion < CSharp.LanguageVersion.CSharp6) { awaitInCatchFinally = false; useExpressionBodyForCalculatedGetterOnlyProperties = false; nullPropagation = false; stringInterpolation = false; dictionaryInitializers = false; extensionMethodsInCollectionInitializers = false; getterOnlyAutomaticProperties = false; } if (languageVersion < CSharp.LanguageVersion.CSharp7) { outVariables = false; throwExpressions = false; tupleTypes = false; tupleConversions = false; discards = false; localFunctions = false; deconstruction = false; patternMatching = false; useRefLocalsForAccurateOrderOfEvaluation = false; } if (languageVersion < CSharp.LanguageVersion.CSharp7_2) { introduceReadonlyAndInModifiers = false; introduceRefModifiersOnStructs = false; nonTrailingNamedArguments = false; refExtensionMethods = false; introducePrivateProtectedAccessibilty = false; } if (languageVersion < CSharp.LanguageVersion.CSharp7_3) { introduceUnmanagedConstraint = false; stackAllocInitializers = false; tupleComparisons = false; patternBasedFixedStatement = false; } if (languageVersion < CSharp.LanguageVersion.CSharp8_0) { nullableReferenceTypes = false; readOnlyMethods = false; asyncUsingAndForEachStatement = false; asyncEnumerator = false; useEnhancedUsing = false; staticLocalFunctions = false; ranges = false; switchExpressions = false; recursivePatternMatching = false; } if (languageVersion < CSharp.LanguageVersion.CSharp9_0) { nativeIntegers = false; initAccessors = false; functionPointers = false; forEachWithGetEnumeratorExtension = false; recordClasses = false; withExpressions = false; usePrimaryConstructorSyntax = false; covariantReturns = false; relationalPatterns = false; patternCombinators = false; } if (languageVersion < CSharp.LanguageVersion.CSharp10_0) { fileScopedNamespaces = false; recordStructs = false; } if (languageVersion < CSharp.LanguageVersion.CSharp11_0) { scopedRef = false; requiredMembers = false; numericIntPtr = false; utf8StringLiterals = false; unsignedRightShift = false; checkedOperators = false; } if (languageVersion < CSharp.LanguageVersion.CSharp12_0) { refReadOnlyParameters = false; usePrimaryConstructorSyntaxForNonRecordTypes = false; } } public CSharp.LanguageVersion GetMinimumRequiredVersion() { if (refReadOnlyParameters || usePrimaryConstructorSyntaxForNonRecordTypes) return CSharp.LanguageVersion.CSharp12_0; if (scopedRef || requiredMembers || numericIntPtr || utf8StringLiterals || unsignedRightShift || checkedOperators) return CSharp.LanguageVersion.CSharp11_0; if (fileScopedNamespaces || recordStructs) return CSharp.LanguageVersion.CSharp10_0; if (nativeIntegers || initAccessors || functionPointers || forEachWithGetEnumeratorExtension || recordClasses || withExpressions || usePrimaryConstructorSyntax || covariantReturns || relationalPatterns || patternCombinators) return CSharp.LanguageVersion.CSharp9_0; if (nullableReferenceTypes || readOnlyMethods || asyncEnumerator || asyncUsingAndForEachStatement || staticLocalFunctions || ranges || switchExpressions || recursivePatternMatching) return CSharp.LanguageVersion.CSharp8_0; if (introduceUnmanagedConstraint || tupleComparisons || stackAllocInitializers || patternBasedFixedStatement) return CSharp.LanguageVersion.CSharp7_3; if (introduceRefModifiersOnStructs || introduceReadonlyAndInModifiers || nonTrailingNamedArguments || refExtensionMethods || introducePrivateProtectedAccessibilty) return CSharp.LanguageVersion.CSharp7_2; // C# 7.1 missing if (outVariables || throwExpressions || tupleTypes || tupleConversions || discards || localFunctions || deconstruction || patternMatching || useRefLocalsForAccurateOrderOfEvaluation) return CSharp.LanguageVersion.CSharp7; if (awaitInCatchFinally || useExpressionBodyForCalculatedGetterOnlyProperties || nullPropagation || stringInterpolation || dictionaryInitializers || extensionMethodsInCollectionInitializers || getterOnlyAutomaticProperties) return CSharp.LanguageVersion.CSharp6; if (asyncAwait) return CSharp.LanguageVersion.CSharp5; if (dynamic || namedArguments || optionalArguments) return CSharp.LanguageVersion.CSharp4; if (anonymousTypes || objectCollectionInitializers || automaticProperties || queryExpressions || expressionTrees) return CSharp.LanguageVersion.CSharp3; if (anonymousMethods || liftNullables || yieldReturn || useImplicitMethodGroupConversion) return CSharp.LanguageVersion.CSharp2; return CSharp.LanguageVersion.CSharp1; } bool nativeIntegers = true; /// /// Use C# 9 nint/nuint types. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.NativeIntegers")] public bool NativeIntegers { get { return nativeIntegers; } set { if (nativeIntegers != value) { nativeIntegers = value; OnPropertyChanged(); } } } bool numericIntPtr = true; /// /// Treat IntPtr/UIntPtr as nint/nuint. /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.NumericIntPtr")] public bool NumericIntPtr { get { return numericIntPtr; } set { if (numericIntPtr != value) { numericIntPtr = value; OnPropertyChanged(); } } } bool covariantReturns = true; /// /// Decompile C# 9 covariant return types. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.CovariantReturns")] public bool CovariantReturns { get { return covariantReturns; } set { if (covariantReturns != value) { covariantReturns = value; OnPropertyChanged(); } } } bool initAccessors = true; /// /// Use C# 9 init; property accessors. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.InitAccessors")] public bool InitAccessors { get { return initAccessors; } set { if (initAccessors != value) { initAccessors = value; OnPropertyChanged(); } } } bool recordClasses = true; /// /// Use C# 9 record classes. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.RecordClasses")] public bool RecordClasses { get { return recordClasses; } set { if (recordClasses != value) { recordClasses = value; OnPropertyChanged(); } } } bool recordStructs = true; /// /// Use C# 10 record structs. /// [Category("C# 10.0 / VS 2022")] [Description("DecompilerSettings.RecordStructs")] public bool RecordStructs { get { return recordStructs; } set { if (recordStructs != value) { recordStructs = value; OnPropertyChanged(); } } } bool withExpressions = true; /// /// Use C# 9 with initializer expressions. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.WithExpressions")] public bool WithExpressions { get { return withExpressions; } set { if (withExpressions != value) { withExpressions = value; OnPropertyChanged(); } } } bool usePrimaryConstructorSyntax = true; /// /// Use primary constructor syntax with records. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.UsePrimaryConstructorSyntax")] public bool UsePrimaryConstructorSyntax { get { return usePrimaryConstructorSyntax; } set { if (usePrimaryConstructorSyntax != value) { usePrimaryConstructorSyntax = value; OnPropertyChanged(); } } } bool functionPointers = true; /// /// Use C# 9 delegate* unmanaged types. /// If this option is disabled, function pointers will instead be decompiled with type `IntPtr`. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.FunctionPointers")] public bool FunctionPointers { get { return functionPointers; } set { if (functionPointers != value) { functionPointers = value; OnPropertyChanged(); } } } bool scopedRef = true; /// /// Use C# 11 scoped modifier. /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.ScopedRef")] public bool ScopedRef { get { return scopedRef; } set { if (scopedRef != value) { scopedRef = value; OnPropertyChanged(); } } } [Obsolete("Renamed to ScopedRef. This property will be removed in a future version of the decompiler.")] [Browsable(false)] public bool LifetimeAnnotations { get { return ScopedRef; } set { ScopedRef = value; } } bool requiredMembers = true; /// /// Use C# 11 required modifier. /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.RequiredMembers")] public bool RequiredMembers { get { return requiredMembers; } set { if (requiredMembers != value) { requiredMembers = value; OnPropertyChanged(); } } } bool switchExpressions = true; /// /// Use C# 8 switch expressions. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.SwitchExpressions")] public bool SwitchExpressions { get { return switchExpressions; } set { if (switchExpressions != value) { switchExpressions = value; OnPropertyChanged(); } } } bool fileScopedNamespaces = true; /// /// Use C# 10 file-scoped namespaces. /// [Category("C# 10.0 / VS 2022")] [Description("DecompilerSettings.FileScopedNamespaces")] public bool FileScopedNamespaces { get { return fileScopedNamespaces; } set { if (fileScopedNamespaces != value) { fileScopedNamespaces = value; OnPropertyChanged(); } } } bool anonymousMethods = true; /// /// Decompile anonymous methods/lambdas. /// [Category("C# 2.0 / VS 2005")] [Description("DecompilerSettings.DecompileAnonymousMethodsLambdas")] public bool AnonymousMethods { get { return anonymousMethods; } set { if (anonymousMethods != value) { anonymousMethods = value; OnPropertyChanged(); } } } bool anonymousTypes = true; /// /// Decompile anonymous types. /// [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.DecompileAnonymousTypes")] public bool AnonymousTypes { get { return anonymousTypes; } set { if (anonymousTypes != value) { anonymousTypes = value; OnPropertyChanged(); } } } bool useLambdaSyntax = true; /// /// Use C# 3 lambda syntax if possible. /// [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.UseLambdaSyntaxIfPossible")] public bool UseLambdaSyntax { get { return useLambdaSyntax; } set { if (useLambdaSyntax != value) { useLambdaSyntax = value; OnPropertyChanged(); } } } bool expressionTrees = true; /// /// Decompile expression trees. /// [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.DecompileExpressionTrees")] public bool ExpressionTrees { get { return expressionTrees; } set { if (expressionTrees != value) { expressionTrees = value; OnPropertyChanged(); } } } bool yieldReturn = true; /// /// Decompile enumerators. /// [Category("C# 2.0 / VS 2005")] [Description("DecompilerSettings.DecompileEnumeratorsYieldReturn")] public bool YieldReturn { get { return yieldReturn; } set { if (yieldReturn != value) { yieldReturn = value; OnPropertyChanged(); } } } bool dynamic = true; /// /// Decompile use of the 'dynamic' type. /// [Category("C# 4.0 / VS 2010")] [Description("DecompilerSettings.DecompileUseOfTheDynamicType")] public bool Dynamic { get { return dynamic; } set { if (dynamic != value) { dynamic = value; OnPropertyChanged(); } } } bool asyncAwait = true; /// /// Decompile async methods. /// [Category("C# 5.0 / VS 2012")] [Description("DecompilerSettings.DecompileAsyncMethods")] public bool AsyncAwait { get { return asyncAwait; } set { if (asyncAwait != value) { asyncAwait = value; OnPropertyChanged(); } } } bool awaitInCatchFinally = true; /// /// Decompile await in catch/finally blocks. /// Only has an effect if is enabled. /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.DecompileAwaitInCatchFinallyBlocks")] public bool AwaitInCatchFinally { get { return awaitInCatchFinally; } set { if (awaitInCatchFinally != value) { awaitInCatchFinally = value; OnPropertyChanged(); } } } bool asyncEnumerator = true; /// /// Decompile IAsyncEnumerator/IAsyncEnumerable. /// Only has an effect if is enabled. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.AsyncEnumerator")] public bool AsyncEnumerator { get { return asyncEnumerator; } set { if (asyncEnumerator != value) { asyncEnumerator = value; OnPropertyChanged(); } } } bool decimalConstants = true; /// /// Decompile [DecimalConstant(...)] as simple literal values. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DecompileDecimalConstantAsSimpleLiteralValues")] public bool DecimalConstants { get { return decimalConstants; } set { if (decimalConstants != value) { decimalConstants = value; OnPropertyChanged(); } } } bool fixedBuffers = true; /// /// Decompile C# 1.0 'public unsafe fixed int arr[10];' members. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DecompileC10PublicUnsafeFixedIntArr10Members")] public bool FixedBuffers { get { return fixedBuffers; } set { if (fixedBuffers != value) { fixedBuffers = value; OnPropertyChanged(); } } } bool stringConcat = true; /// /// Decompile 'string.Concat(a, b)' calls into 'a + b'. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.StringConcat")] public bool StringConcat { get { return stringConcat; } set { if (stringConcat != value) { stringConcat = value; OnPropertyChanged(); } } } bool liftNullables = true; /// /// Use lifted operators for nullables. /// [Category("C# 2.0 / VS 2005")] [Description("DecompilerSettings.UseLiftedOperatorsForNullables")] public bool LiftNullables { get { return liftNullables; } set { if (liftNullables != value) { liftNullables = value; OnPropertyChanged(); } } } bool nullPropagation = true; /// /// Decompile C# 6 ?. and ?[] operators. /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.NullPropagation")] public bool NullPropagation { get { return nullPropagation; } set { if (nullPropagation != value) { nullPropagation = value; OnPropertyChanged(); } } } bool automaticProperties = true; /// /// Decompile automatic properties /// [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.DecompileAutomaticProperties")] public bool AutomaticProperties { get { return automaticProperties; } set { if (automaticProperties != value) { automaticProperties = value; OnPropertyChanged(); } } } bool getterOnlyAutomaticProperties = true; /// /// Decompile getter-only automatic properties /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.GetterOnlyAutomaticProperties")] public bool GetterOnlyAutomaticProperties { get { return getterOnlyAutomaticProperties; } set { if (getterOnlyAutomaticProperties != value) { getterOnlyAutomaticProperties = value; OnPropertyChanged(); } } } bool automaticEvents = true; /// /// Decompile automatic events /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DecompileAutomaticEvents")] public bool AutomaticEvents { get { return automaticEvents; } set { if (automaticEvents != value) { automaticEvents = value; OnPropertyChanged(); } } } bool usingStatement = true; /// /// Decompile using statements. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DetectUsingStatements")] public bool UsingStatement { get { return usingStatement; } set { if (usingStatement != value) { usingStatement = value; OnPropertyChanged(); } } } bool useEnhancedUsing = true; /// /// Use enhanced using statements. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.UseEnhancedUsing")] public bool UseEnhancedUsing { get { return useEnhancedUsing; } set { if (useEnhancedUsing != value) { useEnhancedUsing = value; OnPropertyChanged(); } } } bool alwaysUseBraces = true; /// /// Gets/Sets whether to use braces for single-statement-blocks. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.AlwaysUseBraces")] public bool AlwaysUseBraces { get { return alwaysUseBraces; } set { if (alwaysUseBraces != value) { alwaysUseBraces = value; OnPropertyChanged(); } } } bool forEachStatement = true; /// /// Decompile foreach statements. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DetectForeachStatements")] public bool ForEachStatement { get { return forEachStatement; } set { if (forEachStatement != value) { forEachStatement = value; OnPropertyChanged(); } } } bool forEachWithGetEnumeratorExtension = true; /// /// Support GetEnumerator extension methods in foreach. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.DecompileForEachWithGetEnumeratorExtension")] public bool ForEachWithGetEnumeratorExtension { get { return forEachWithGetEnumeratorExtension; } set { if (forEachWithGetEnumeratorExtension != value) { forEachWithGetEnumeratorExtension = value; OnPropertyChanged(); } } } bool lockStatement = true; /// /// Decompile lock statements. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DetectLockStatements")] public bool LockStatement { get { return lockStatement; } set { if (lockStatement != value) { lockStatement = value; OnPropertyChanged(); } } } bool switchStatementOnString = true; [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DetectSwitchOnString")] public bool SwitchStatementOnString { get { return switchStatementOnString; } set { if (switchStatementOnString != value) { switchStatementOnString = value; OnPropertyChanged(); } } } bool sparseIntegerSwitch = true; [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.SparseIntegerSwitch")] public bool SparseIntegerSwitch { get { return sparseIntegerSwitch; } set { if (sparseIntegerSwitch != value) { sparseIntegerSwitch = value; OnPropertyChanged(); } } } bool usingDeclarations = true; [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.InsertUsingDeclarations")] public bool UsingDeclarations { get { return usingDeclarations; } set { if (usingDeclarations != value) { usingDeclarations = value; OnPropertyChanged(); } } } bool extensionMethods = true; [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.UseExtensionMethodSyntax")] public bool ExtensionMethods { get { return extensionMethods; } set { if (extensionMethods != value) { extensionMethods = value; OnPropertyChanged(); } } } bool queryExpressions = true; [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.UseLINQExpressionSyntax")] public bool QueryExpressions { get { return queryExpressions; } set { if (queryExpressions != value) { queryExpressions = value; OnPropertyChanged(); } } } bool useImplicitMethodGroupConversion = true; /// /// Gets/Sets whether to use C# 2.0 method group conversions. /// true: EventHandler h = this.OnClick; /// false: EventHandler h = new EventHandler(this.OnClick); /// [Category("C# 2.0 / VS 2005")] [Description("DecompilerSettings.UseImplicitMethodGroupConversions")] public bool UseImplicitMethodGroupConversion { get { return useImplicitMethodGroupConversion; } set { if (useImplicitMethodGroupConversion != value) { useImplicitMethodGroupConversion = value; OnPropertyChanged(); } } } bool alwaysCastTargetsOfExplicitInterfaceImplementationCalls = false; /// /// Gets/Sets whether to always cast targets to explicitly implemented methods. /// true: ((ISupportInitialize)pictureBox1).BeginInit(); /// false: pictureBox1.BeginInit(); /// default: false /// [Category("Other")] [Description("DecompilerSettings.AlwaysCastTargetsOfExplicitInterfaceImplementationCalls")] public bool AlwaysCastTargetsOfExplicitInterfaceImplementationCalls { get { return alwaysCastTargetsOfExplicitInterfaceImplementationCalls; } set { if (alwaysCastTargetsOfExplicitInterfaceImplementationCalls != value) { alwaysCastTargetsOfExplicitInterfaceImplementationCalls = value; OnPropertyChanged(); } } } bool alwaysQualifyMemberReferences = false; /// /// Gets/Sets whether to always qualify member references. /// true: this.DoSomething(); /// false: DoSomething(); /// default: false /// [Category("Other")] [Description("DecompilerSettings.AlwaysQualifyMemberReferences")] public bool AlwaysQualifyMemberReferences { get { return alwaysQualifyMemberReferences; } set { if (alwaysQualifyMemberReferences != value) { alwaysQualifyMemberReferences = value; OnPropertyChanged(); } } } bool alwaysShowEnumMemberValues = false; /// /// Gets/Sets whether to always show enum member values. /// true: enum Kind { A = 0, B = 1, C = 5 } /// false: enum Kind { A, B, C = 5 } /// default: false /// [Category("Other")] [Description("DecompilerSettings.AlwaysShowEnumMemberValues")] public bool AlwaysShowEnumMemberValues { get { return alwaysShowEnumMemberValues; } set { if (alwaysShowEnumMemberValues != value) { alwaysShowEnumMemberValues = value; OnPropertyChanged(); } } } bool useDebugSymbols = true; /// /// Gets/Sets whether to use variable names from debug symbols, if available. /// [Category("Other")] [Description("DecompilerSettings.UseVariableNamesFromDebugSymbolsIfAvailable")] public bool UseDebugSymbols { get { return useDebugSymbols; } set { if (useDebugSymbols != value) { useDebugSymbols = value; OnPropertyChanged(); } } } bool arrayInitializers = true; /// /// Gets/Sets whether to use array initializers. /// If set to false, might produce non-compilable code. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.ArrayInitializerExpressions")] public bool ArrayInitializers { get { return arrayInitializers; } set { if (arrayInitializers != value) { arrayInitializers = value; OnPropertyChanged(); } } } bool objectCollectionInitializers = true; /// /// Gets/Sets whether to use C# 3.0 object/collection initializers. /// [Category("C# 3.0 / VS 2008")] [Description("DecompilerSettings.ObjectCollectionInitializerExpressions")] public bool ObjectOrCollectionInitializers { get { return objectCollectionInitializers; } set { if (objectCollectionInitializers != value) { objectCollectionInitializers = value; OnPropertyChanged(); } } } bool dictionaryInitializers = true; /// /// Gets/Sets whether to use C# 6.0 dictionary initializers. /// Only has an effect if ObjectOrCollectionInitializers is enabled. /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.DictionaryInitializerExpressions")] public bool DictionaryInitializers { get { return dictionaryInitializers; } set { if (dictionaryInitializers != value) { dictionaryInitializers = value; OnPropertyChanged(); } } } bool extensionMethodsInCollectionInitializers = true; /// /// Gets/Sets whether to use C# 6.0 Extension Add methods in collection initializers. /// Only has an effect if ObjectOrCollectionInitializers is enabled. /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.AllowExtensionAddMethodsInCollectionInitializerExpressions")] public bool ExtensionMethodsInCollectionInitializers { get { return extensionMethodsInCollectionInitializers; } set { if (extensionMethodsInCollectionInitializers != value) { extensionMethodsInCollectionInitializers = value; OnPropertyChanged(); } } } bool useRefLocalsForAccurateOrderOfEvaluation = true; /// /// Gets/Sets whether to use local ref variables in cases where this is necessary /// for re-compilation with a modern C# compiler to reproduce the same behavior /// as the original assembly produced with an old C# compiler that used an incorrect /// order of evaluation. /// See https://github.com/icsharpcode/ILSpy/issues/2050 /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseRefLocalsForAccurateOrderOfEvaluation")] public bool UseRefLocalsForAccurateOrderOfEvaluation { get { return useRefLocalsForAccurateOrderOfEvaluation; } set { if (useRefLocalsForAccurateOrderOfEvaluation != value) { useRefLocalsForAccurateOrderOfEvaluation = value; OnPropertyChanged(); } } } bool refExtensionMethods = true; /// /// Gets/Sets whether to use C# 7.2 'ref' extension methods. /// [Category("C# 7.2 / VS 2017.4")] [Description("DecompilerSettings.AllowExtensionMethodSyntaxOnRef")] public bool RefExtensionMethods { get { return refExtensionMethods; } set { if (refExtensionMethods != value) { refExtensionMethods = value; OnPropertyChanged(); } } } bool stringInterpolation = true; /// /// Gets/Sets whether to use C# 6.0 string interpolation /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.UseStringInterpolation")] public bool StringInterpolation { get { return stringInterpolation; } set { if (stringInterpolation != value) { stringInterpolation = value; OnPropertyChanged(); } } } bool utf8StringLiterals = true; /// /// Gets/Sets whether to use C# 11.0 UTF-8 string literals /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.Utf8StringLiterals")] public bool Utf8StringLiterals { get { return utf8StringLiterals; } set { if (utf8StringLiterals != value) { utf8StringLiterals = value; OnPropertyChanged(); } } } bool switchOnReadOnlySpanChar = true; /// /// Gets/Sets whether to use C# 11.0 switch on (ReadOnly)Span<char> /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.SwitchOnReadOnlySpanChar")] public bool SwitchOnReadOnlySpanChar { get { return switchOnReadOnlySpanChar; } set { if (switchOnReadOnlySpanChar != value) { switchOnReadOnlySpanChar = value; OnPropertyChanged(); } } } bool unsignedRightShift = true; /// /// Gets/Sets whether to use C# 11.0 unsigned right shift operator. /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.UnsignedRightShift")] public bool UnsignedRightShift { get { return unsignedRightShift; } set { if (unsignedRightShift != value) { unsignedRightShift = value; OnPropertyChanged(); } } } bool checkedOperators = true; /// /// Gets/Sets whether to use C# 11.0 user-defined checked operators. /// [Category("C# 11.0 / VS 2022.4")] [Description("DecompilerSettings.CheckedOperators")] public bool CheckedOperators { get { return checkedOperators; } set { if (checkedOperators != value) { checkedOperators = value; OnPropertyChanged(); } } } bool showXmlDocumentation = true; /// /// Gets/Sets whether to include XML documentation comments in the decompiled code. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.IncludeXMLDocumentationCommentsInTheDecompiledCode")] public bool ShowXmlDocumentation { get { return showXmlDocumentation; } set { if (showXmlDocumentation != value) { showXmlDocumentation = value; OnPropertyChanged(); } } } bool foldBraces = false; [Browsable(false)] public bool FoldBraces { get { return foldBraces; } set { if (foldBraces != value) { foldBraces = value; OnPropertyChanged(); } } } bool expandMemberDefinitions = false; [Browsable(false)] public bool ExpandMemberDefinitions { get { return expandMemberDefinitions; } set { if (expandMemberDefinitions != value) { expandMemberDefinitions = value; OnPropertyChanged(); } } } bool expandUsingDeclarations = false; [Browsable(false)] public bool ExpandUsingDeclarations { get { return expandUsingDeclarations; } set { if (expandUsingDeclarations != value) { expandUsingDeclarations = value; OnPropertyChanged(); } } } bool decompileMemberBodies = true; /// /// Gets/Sets whether member bodies should be decompiled. /// [Category("DecompilerSettings.Other")] [Browsable(false)] public bool DecompileMemberBodies { get { return decompileMemberBodies; } set { if (decompileMemberBodies != value) { decompileMemberBodies = value; OnPropertyChanged(); } } } bool useExpressionBodyForCalculatedGetterOnlyProperties = true; /// /// Gets/Sets whether simple calculated getter-only property declarations /// should use expression body syntax. /// [Category("C# 6.0 / VS 2015")] [Description("DecompilerSettings.UseExpressionBodiedMemberSyntaxForGetOnlyProperties")] public bool UseExpressionBodyForCalculatedGetterOnlyProperties { get { return useExpressionBodyForCalculatedGetterOnlyProperties; } set { if (useExpressionBodyForCalculatedGetterOnlyProperties != value) { useExpressionBodyForCalculatedGetterOnlyProperties = value; OnPropertyChanged(); } } } bool outVariables = true; /// /// Gets/Sets whether out variable declarations should be used when possible. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseOutVariableDeclarations")] public bool OutVariables { get { return outVariables; } set { if (outVariables != value) { outVariables = value; OnPropertyChanged(); } } } bool discards = true; /// /// Gets/Sets whether discards should be used when possible. /// Only has an effect if is enabled. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseDiscards")] public bool Discards { get { return discards; } set { if (discards != value) { discards = value; OnPropertyChanged(); } } } bool introduceRefModifiersOnStructs = true; /// /// Gets/Sets whether IsByRefLikeAttribute should be replaced with 'ref' modifiers on structs. /// [Category("C# 7.2 / VS 2017.4")] [Description("DecompilerSettings.IsByRefLikeAttributeShouldBeReplacedWithRefModifiersOnStructs")] public bool IntroduceRefModifiersOnStructs { get { return introduceRefModifiersOnStructs; } set { if (introduceRefModifiersOnStructs != value) { introduceRefModifiersOnStructs = value; OnPropertyChanged(); } } } bool introduceReadonlyAndInModifiers = true; /// /// Gets/Sets whether IsReadOnlyAttribute should be replaced with 'readonly' modifiers on structs /// and with the 'in' modifier on parameters. /// [Category("C# 7.2 / VS 2017.4")] [Description("DecompilerSettings." + "IsReadOnlyAttributeShouldBeReplacedWithReadonlyInModifiersOnStructsParameters")] public bool IntroduceReadonlyAndInModifiers { get { return introduceReadonlyAndInModifiers; } set { if (introduceReadonlyAndInModifiers != value) { introduceReadonlyAndInModifiers = value; OnPropertyChanged(); } } } bool introducePrivateProtectedAccessibilty = true; /// /// Gets/Sets whether "private protected" should be used. /// [Category("C# 7.2 / VS 2017.4")] [Description("DecompilerSettings.IntroducePrivateProtectedAccessibility")] public bool IntroducePrivateProtectedAccessibility { get { return introducePrivateProtectedAccessibilty; } set { if (introducePrivateProtectedAccessibilty != value) { introducePrivateProtectedAccessibilty = value; OnPropertyChanged(); } } } bool readOnlyMethods = true; [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.ReadOnlyMethods")] public bool ReadOnlyMethods { get { return readOnlyMethods; } set { if (readOnlyMethods != value) { readOnlyMethods = value; OnPropertyChanged(); } } } bool asyncUsingAndForEachStatement = true; [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.DetectAsyncUsingAndForeachStatements")] public bool AsyncUsingAndForEachStatement { get { return asyncUsingAndForEachStatement; } set { if (asyncUsingAndForEachStatement != value) { asyncUsingAndForEachStatement = value; OnPropertyChanged(); } } } bool introduceUnmanagedConstraint = true; /// /// If this option is active, [IsUnmanagedAttribute] on type parameters /// is replaced with "T : unmanaged" constraints. /// [Category("C# 7.3 / VS 2017.7")] [Description("DecompilerSettings." + "IsUnmanagedAttributeOnTypeParametersShouldBeReplacedWithUnmanagedConstraints")] public bool IntroduceUnmanagedConstraint { get { return introduceUnmanagedConstraint; } set { if (introduceUnmanagedConstraint != value) { introduceUnmanagedConstraint = value; OnPropertyChanged(); } } } bool stackAllocInitializers = true; /// /// Gets/Sets whether C# 7.3 stackalloc initializers should be used. /// [Category("C# 7.3 / VS 2017.7")] [Description("DecompilerSettings.UseStackallocInitializerSyntax")] public bool StackAllocInitializers { get { return stackAllocInitializers; } set { if (stackAllocInitializers != value) { stackAllocInitializers = value; OnPropertyChanged(); } } } bool patternBasedFixedStatement = true; /// /// Gets/Sets whether C# 7.3 pattern based fixed statement should be used. /// [Category("C# 7.3 / VS 2017.7")] [Description("DecompilerSettings.UsePatternBasedFixedStatement")] public bool PatternBasedFixedStatement { get { return patternBasedFixedStatement; } set { if (patternBasedFixedStatement != value) { patternBasedFixedStatement = value; OnPropertyChanged(); } } } bool tupleTypes = true; /// /// Gets/Sets whether tuple type syntax (int, string) /// should be used for System.ValueTuple. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseTupleTypeSyntax")] public bool TupleTypes { get { return tupleTypes; } set { if (tupleTypes != value) { tupleTypes = value; OnPropertyChanged(); } } } bool throwExpressions = true; /// /// Gets/Sets whether throw expressions should be used. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseThrowExpressions")] public bool ThrowExpressions { get { return throwExpressions; } set { if (throwExpressions != value) { throwExpressions = value; OnPropertyChanged(); } } } bool tupleConversions = true; /// /// Gets/Sets whether implicit conversions between tuples /// should be used in the decompiled output. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.UseImplicitConversionsBetweenTupleTypes")] public bool TupleConversions { get { return tupleConversions; } set { if (tupleConversions != value) { tupleConversions = value; OnPropertyChanged(); } } } bool tupleComparisons = true; /// /// Gets/Sets whether tuple comparisons should be detected. /// [Category("C# 7.3 / VS 2017.7")] [Description("DecompilerSettings.DetectTupleComparisons")] public bool TupleComparisons { get { return tupleComparisons; } set { if (tupleComparisons != value) { tupleComparisons = value; OnPropertyChanged(); } } } bool namedArguments = true; /// /// Gets/Sets whether named arguments should be used. /// [Category("C# 4.0 / VS 2010")] [Description("DecompilerSettings.UseNamedArguments")] public bool NamedArguments { get { return namedArguments; } set { if (namedArguments != value) { namedArguments = value; OnPropertyChanged(); } } } bool nonTrailingNamedArguments = true; /// /// Gets/Sets whether C# 7.2 non-trailing named arguments should be used. /// [Category("C# 7.2 / VS 2017.4")] [Description("DecompilerSettings.UseNonTrailingNamedArguments")] public bool NonTrailingNamedArguments { get { return nonTrailingNamedArguments; } set { if (nonTrailingNamedArguments != value) { nonTrailingNamedArguments = value; OnPropertyChanged(); } } } bool optionalArguments = true; /// /// Gets/Sets whether optional arguments should be removed, if possible. /// [Category("C# 4.0 / VS 2010")] [Description("DecompilerSettings.RemoveOptionalArgumentsIfPossible")] public bool OptionalArguments { get { return optionalArguments; } set { if (optionalArguments != value) { optionalArguments = value; OnPropertyChanged(); } } } bool localFunctions = true; /// /// Gets/Sets whether C# 7.0 local functions should be transformed. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.IntroduceLocalFunctions")] public bool LocalFunctions { get { return localFunctions; } set { if (localFunctions != value) { localFunctions = value; OnPropertyChanged(); } } } bool deconstruction = true; /// /// Gets/Sets whether C# 7.0 deconstruction should be detected. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.Deconstruction")] public bool Deconstruction { get { return deconstruction; } set { if (deconstruction != value) { deconstruction = value; OnPropertyChanged(); } } } bool patternMatching = true; /// /// Gets/Sets whether C# 7.0 pattern matching should be detected. /// [Category("C# 7.0 / VS 2017")] [Description("DecompilerSettings.PatternMatching")] public bool PatternMatching { get { return patternMatching; } set { if (patternMatching != value) { patternMatching = value; OnPropertyChanged(); } } } bool recursivePatternMatching = true; /// /// Gets/Sets whether C# 8.0 recursive patterns should be detected. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.RecursivePatternMatching")] public bool RecursivePatternMatching { get { return recursivePatternMatching; } set { if (recursivePatternMatching != value) { recursivePatternMatching = value; OnPropertyChanged(); } } } bool patternCombinators = true; /// /// Gets/Sets whether C# 9.0 and, or, not patterns should be detected. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.PatternCombinators")] public bool PatternCombinators { get { return patternCombinators; } set { if (patternCombinators != value) { patternCombinators = value; OnPropertyChanged(); } } } bool relationalPatterns = true; /// /// Gets/Sets whether C# 9.0 relational patterns should be detected. /// [Category("C# 9.0 / VS 2019.8")] [Description("DecompilerSettings.RelationalPatterns")] public bool RelationalPatterns { get { return relationalPatterns; } set { if (relationalPatterns != value) { relationalPatterns = value; OnPropertyChanged(); } } } bool staticLocalFunctions = true; /// /// Gets/Sets whether C# 8.0 static local functions should be transformed. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.IntroduceStaticLocalFunctions")] public bool StaticLocalFunctions { get { return staticLocalFunctions; } set { if (staticLocalFunctions != value) { staticLocalFunctions = value; OnPropertyChanged(); } } } bool ranges = true; /// /// Gets/Sets whether C# 8.0 index and range syntax should be used. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.Ranges")] public bool Ranges { get { return ranges; } set { if (ranges != value) { ranges = value; OnPropertyChanged(); } } } bool nullableReferenceTypes = true; /// /// Gets/Sets whether C# 8.0 nullable reference types are enabled. /// [Category("C# 8.0 / VS 2019")] [Description("DecompilerSettings.NullableReferenceTypes")] public bool NullableReferenceTypes { get { return nullableReferenceTypes; } set { if (nullableReferenceTypes != value) { nullableReferenceTypes = value; OnPropertyChanged(); } } } bool showDebugInfo; [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.ShowInfoFromDebugSymbolsIfAvailable")] [Browsable(false)] public bool ShowDebugInfo { get { return showDebugInfo; } set { if (showDebugInfo != value) { showDebugInfo = value; OnPropertyChanged(); } } } #region Options to aid VB decompilation bool assumeArrayLengthFitsIntoInt32 = true; /// /// Gets/Sets whether the decompiler can assume that 'ldlen; conv.i4.ovf' /// does not throw an overflow exception. /// [Category("DecompilerSettings.VBSpecificOptions")] [Browsable(false)] public bool AssumeArrayLengthFitsIntoInt32 { get { return assumeArrayLengthFitsIntoInt32; } set { if (assumeArrayLengthFitsIntoInt32 != value) { assumeArrayLengthFitsIntoInt32 = value; OnPropertyChanged(); } } } bool introduceIncrementAndDecrement = true; /// /// Gets/Sets whether to use increment and decrement operators /// [Category("DecompilerSettings.VBSpecificOptions")] [Browsable(false)] public bool IntroduceIncrementAndDecrement { get { return introduceIncrementAndDecrement; } set { if (introduceIncrementAndDecrement != value) { introduceIncrementAndDecrement = value; OnPropertyChanged(); } } } bool makeAssignmentExpressions = true; /// /// Gets/Sets whether to use assignment expressions such as in while ((count = Do()) != 0) ; /// [Category("DecompilerSettings.VBSpecificOptions")] [Browsable(false)] public bool MakeAssignmentExpressions { get { return makeAssignmentExpressions; } set { if (makeAssignmentExpressions != value) { makeAssignmentExpressions = value; OnPropertyChanged(); } } } #endregion #region Options to aid F# decompilation bool removeDeadCode = false; [Category("DecompilerSettings.FSpecificOptions")] [Description("DecompilerSettings.RemoveDeadAndSideEffectFreeCodeUseWithCaution")] public bool RemoveDeadCode { get { return removeDeadCode; } set { if (removeDeadCode != value) { removeDeadCode = value; OnPropertyChanged(); } } } bool removeDeadStores = false; [Category("DecompilerSettings.FSpecificOptions")] [Description("DecompilerSettings.RemoveDeadStores")] public bool RemoveDeadStores { get { return removeDeadStores; } set { if (removeDeadStores != value) { removeDeadStores = value; OnPropertyChanged(); } } } #endregion #region Assembly Load and Resolve options bool loadInMemory = false; [Browsable(false)] public bool LoadInMemory { get { return loadInMemory; } set { if (loadInMemory != value) { loadInMemory = value; OnPropertyChanged(); } } } bool throwOnAssemblyResolveErrors = true; [Browsable(false)] public bool ThrowOnAssemblyResolveErrors { get { return throwOnAssemblyResolveErrors; } set { if (throwOnAssemblyResolveErrors != value) { throwOnAssemblyResolveErrors = value; OnPropertyChanged(); } } } bool applyWindowsRuntimeProjections = true; [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.ApplyWindowsRuntimeProjectionsOnLoadedAssemblies")] public bool ApplyWindowsRuntimeProjections { get { return applyWindowsRuntimeProjections; } set { if (applyWindowsRuntimeProjections != value) { applyWindowsRuntimeProjections = value; OnPropertyChanged(); } } } bool autoLoadAssemblyReferences = true; [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.AutoLoadAssemblyReferences")] public bool AutoLoadAssemblyReferences { get { return autoLoadAssemblyReferences; } set { if (autoLoadAssemblyReferences != value) { autoLoadAssemblyReferences = value; OnPropertyChanged(); } } } #endregion bool forStatement = true; /// /// Gets/sets whether the decompiler should produce for loops. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.ForStatement")] public bool ForStatement { get { return forStatement; } set { if (forStatement != value) { forStatement = value; OnPropertyChanged(); } } } bool doWhileStatement = true; /// /// Gets/sets whether the decompiler should produce do-while loops. /// [Category("C# 1.0 / VS .NET")] [Description("DecompilerSettings.DoWhileStatement")] public bool DoWhileStatement { get { return doWhileStatement; } set { if (doWhileStatement != value) { doWhileStatement = value; OnPropertyChanged(); } } } bool refReadOnlyParameters = true; /// /// Gets/sets whether RequiresLocationAttribute on parameters should be replaced with 'ref readonly' modifiers. /// [Category("C# 12.0 / VS 2022.8")] [Description("DecompilerSettings.RefReadOnlyParameters")] public bool RefReadOnlyParameters { get { return refReadOnlyParameters; } set { if (refReadOnlyParameters != value) { refReadOnlyParameters = value; OnPropertyChanged(); } } } bool usePrimaryConstructorSyntaxForNonRecordTypes = true; /// /// Use primary constructor syntax with classes and structs. /// [Category("C# 12.0 / VS 2022.8")] [Description("DecompilerSettings.UsePrimaryConstructorSyntaxForNonRecordTypes")] public bool UsePrimaryConstructorSyntaxForNonRecordTypes { get { return usePrimaryConstructorSyntaxForNonRecordTypes; } set { if (usePrimaryConstructorSyntaxForNonRecordTypes != value) { usePrimaryConstructorSyntaxForNonRecordTypes = value; OnPropertyChanged(); } } } bool separateLocalVariableDeclarations = false; /// /// Gets/sets whether the decompiler should separate local variable declarations /// from their initialization. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.SeparateLocalVariableDeclarations")] public bool SeparateLocalVariableDeclarations { get { return separateLocalVariableDeclarations; } set { if (separateLocalVariableDeclarations != value) { separateLocalVariableDeclarations = value; OnPropertyChanged(); } } } bool useSdkStyleProjectFormat = true; /// /// Gets or sets a value indicating whether the new SDK style format /// shall be used for the generated project files. /// [Category("DecompilerSettings.ProjectExport")] [Description("DecompilerSettings.UseSdkStyleProjectFormat")] public bool UseSdkStyleProjectFormat { get { return useSdkStyleProjectFormat; } set { if (useSdkStyleProjectFormat != value) { useSdkStyleProjectFormat = value; OnPropertyChanged(); } } } bool useNestedDirectoriesForNamespaces; /// /// Gets/sets whether namespaces and namespace-like identifiers should be split at '.' /// and each part should produce a new level of nesting in the output directory structure. /// [Category("DecompilerSettings.ProjectExport")] [Description("DecompilerSettings.UseNestedDirectoriesForNamespaces")] public bool UseNestedDirectoriesForNamespaces { get { return useNestedDirectoriesForNamespaces; } set { if (useNestedDirectoriesForNamespaces != value) { useNestedDirectoriesForNamespaces = value; OnPropertyChanged(); } } } bool aggressiveScalarReplacementOfAggregates = false; [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.AggressiveScalarReplacementOfAggregates")] // TODO : Remove once https://github.com/icsharpcode/ILSpy/issues/2032 is fixed. #if !DEBUG [Browsable(false)] #endif public bool AggressiveScalarReplacementOfAggregates { get { return aggressiveScalarReplacementOfAggregates; } set { if (aggressiveScalarReplacementOfAggregates != value) { aggressiveScalarReplacementOfAggregates = value; OnPropertyChanged(); } } } bool aggressiveInlining = false; /// /// If set to false (the default), the decompiler will inline local variables only when they occur /// in a context where the C# compiler is known to emit compiler-generated locals. /// If set to true, the decompiler will inline local variables whenever possible. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.AggressiveInlining")] public bool AggressiveInlining { get { return aggressiveInlining; } set { if (aggressiveInlining != value) { aggressiveInlining = value; OnPropertyChanged(); } } } bool alwaysUseGlobal = false; /// /// Always fully qualify namespaces using the "global::" prefix. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.AlwaysUseGlobal")] public bool AlwaysUseGlobal { get { return alwaysUseGlobal; } set { if (alwaysUseGlobal != value) { alwaysUseGlobal = value; OnPropertyChanged(); } } } bool sortCustomAttributes = false; /// /// Sort custom attributes. /// [Category("DecompilerSettings.Other")] [Description("DecompilerSettings.SortCustomAttributes")] public bool SortCustomAttributes { get { return sortCustomAttributes; } set { if (sortCustomAttributes != value) { sortCustomAttributes = value; OnPropertyChanged(); } } } CSharpFormattingOptions csharpFormattingOptions; [Browsable(false)] public CSharpFormattingOptions CSharpFormattingOptions { get { if (csharpFormattingOptions == null) { csharpFormattingOptions = FormattingOptionsFactory.CreateAllman(); csharpFormattingOptions.IndentSwitchBody = false; csharpFormattingOptions.ArrayInitializerWrapping = Wrapping.WrapIfTooLong; csharpFormattingOptions.AutoPropertyFormatting = PropertyFormatting.SingleLine; } return csharpFormattingOptions; } set { if (value == null) throw new ArgumentNullException(); if (csharpFormattingOptions != value) { csharpFormattingOptions = value; OnPropertyChanged(); } } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public DecompilerSettings Clone() { DecompilerSettings settings = (DecompilerSettings)MemberwiseClone(); if (csharpFormattingOptions != null) settings.csharpFormattingOptions = csharpFormattingOptions.Clone(); settings.PropertyChanged = null; return settings; } } }