Clone() public method

public Clone ( ) : DecompilerSettings
return DecompilerSettings
        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);
        }
        AstBuilder CreateAstBuilder(DecompilerSettings settings, ModuleDefinition currentModule = null, TypeDefinition currentType = null, bool isSingleMember = false)
        {
            if (currentModule == null)
                currentModule = currentType.Module;

            if (isSingleMember)
            {
                settings = settings.Clone();
                settings.UsingDeclarations = false;
            }

            return new AstBuilder(
                new DecompilerContext(currentModule)
                {
                    //CancellationToken = options.CancellationToken,
                    CurrentType = currentType,
                    Settings = settings
                });
        }
Beispiel #3
0
		internal static DecompilerSettings CreateDecompilerSettings(DecompilerSettings settings, bool useUsingDeclarations) {
			var newOne = settings.Clone();
			newOne.UsingDeclarations = useUsingDeclarations;
			newOne.FullyQualifyAllTypes = !useUsingDeclarations;
			return newOne;
		}
Beispiel #4
0
		BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef currentModule = null, TypeDef currentType = null, bool isSingleMember = false) {
			if (currentModule == null)
				currentModule = currentType.Module;
			if (isSingleMember) {
				settings = settings.Clone();
				settings.UsingDeclarations = false;
			}
			var cache = ctx.GetOrCreate<BuilderCache>();
			var state = new BuilderState(ctx, cache);
			state.AstBuilder.Context.CurrentModule = currentModule;
			state.AstBuilder.Context.CancellationToken = ctx.CancellationToken;
			state.AstBuilder.Context.CurrentType = currentType;
			state.AstBuilder.Context.Settings = settings;
			return state;
		}
		public CSharpDecompilerSettingsPage(DecompilerSettings decompilerSettings) {
			_global_decompilerSettings = decompilerSettings;
			this.decompilerSettings = decompilerSettings.Clone();

			var defObjs = typeof(DecompilationObject).GetEnumValues().Cast<DecompilationObject>().ToArray();
			decompilationObjectVMs = new DecompilationObjectVM[defObjs.Length];
			for (int i = 0; i < defObjs.Length; i++)
				decompilationObjectVMs[i] = new DecompilationObjectVM(defObjs[i], ToString(defObjs[i]));
			decompilationObjectVMs2 = decompilationObjectVMs.ToArray();

			DecompilationObject0 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject0);
			DecompilationObject1 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject1);
			DecompilationObject2 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject2);
			DecompilationObject3 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject3);
			DecompilationObject4 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject4);
		}
Beispiel #6
0
 AstBuilder CreateAstBuilder(TypeDefinition currentType, bool isSingleMember)
 {
     ModuleDefinition currentModule = currentType.Module;
     DecompilerSettings settings = new DecompilerSettings();
     if (isSingleMember)
     {
         settings = settings.Clone();
         settings.UsingDeclarations = false;
     }
     return new AstBuilder(new DecompilerContext(currentModule) { CurrentType = currentType, Settings = settings });
 }
Beispiel #7
0
		AstBuilder CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef currentModule = null, TypeDef currentType = null, bool isSingleMember = false) {
			if (currentModule == null)
				currentModule = currentType.Module;
			settings = settings.Clone();
			if (isSingleMember)
				settings.UsingDeclarations = false;
			settings.IntroduceIncrementAndDecrement = false;
			settings.MakeAssignmentExpressions = false;
			settings.QueryExpressions = false;
			settings.AlwaysGenerateExceptionVariableForCatchBlocks = true;
			return new AstBuilder(
				new DecompilerContext(currentModule) {
					CancellationToken = ctx.CancellationToken,
					CurrentType = currentType,
					Settings = settings
				}) {
			};
		}
Beispiel #8
0
		BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef currentModule = null, TypeDef currentType = null, bool isSingleMember = false) {
			if (currentModule == null)
				currentModule = currentType.Module;
			settings = settings.Clone();
			if (isSingleMember)
				settings.UsingDeclarations = false;
			settings.IntroduceIncrementAndDecrement = false;
			settings.MakeAssignmentExpressions = false;
			settings.QueryExpressions = false;
			settings.AlwaysGenerateExceptionVariableForCatchBlocksUnlessTypeIsObject = true;
			var cache = ctx.GetOrCreate<BuilderCache>();
			var state = new BuilderState(ctx, cache, MetadataTextColorProvider);
			state.AstBuilder.Context.CurrentModule = currentModule;
			state.AstBuilder.Context.CancellationToken = ctx.CancellationToken;
			state.AstBuilder.Context.CurrentType = currentType;
			state.AstBuilder.Context.Settings = settings;
			return state;
		}