Beispiel #1
0
		protected override Task<DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState) {
			var state = (EditMethodDecompileCodeState)decompileCodeState;
			state.CancellationToken.ThrowIfCancellationRequested();

			var type = methodToEdit.DeclaringType;
			while (type.DeclaringType != null)
				type = type.DeclaringType;

			DecompileTypeMethods options;

			state.DecompilationContext.CalculateBinSpans = true;
			options = new DecompileTypeMethods(state.MainOutput, state.DecompilationContext, type);
			options.Methods.Add(methodToEdit);
			options.DecompileHidden = false;
			options.MakeEverythingPublic = makeEverythingPublic;
			decompiler.Decompile(DecompilationType.TypeMethods, options);

			state.CancellationToken.ThrowIfCancellationRequested();

			state.DecompilationContext.CalculateBinSpans = false;
			options = new DecompileTypeMethods(state.HiddenOutput, state.DecompilationContext, type);
			options.Methods.Add(methodToEdit);
			options.DecompileHidden = true;
			options.MakeEverythingPublic = makeEverythingPublic;
			decompiler.Decompile(DecompilationType.TypeMethods, options);

			state.CancellationToken.ThrowIfCancellationRequested();

			var result = new DecompileAsyncResult();
			result.AddDocument(MAIN_CODE_NAME, state.MainOutput.ToString(), state.MainOutput.Span);
			result.AddDocument(MAIN_G_CODE_NAME, state.HiddenOutput.ToString(), null);
			return Task.FromResult(result);
		}
Beispiel #2
0
        protected override Task <DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState)
        {
            var state = (AddMembersDecompileCodeState)decompileCodeState;

            state.CancellationToken.ThrowIfCancellationRequested();

            DecompileTypeMethods options;

            options = new DecompileTypeMethods(state.MainOutput, state.DecompilationContext, nonNestedType);
            options.Types.Add(nonNestedType);
            options.Types.AddRange(nonNestedType.GetTypes());
            options.DecompileHidden = false;
            decompiler.Decompile(DecompilationType.TypeMethods, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            options = new DecompileTypeMethods(state.HiddenOutput, state.DecompilationContext, nonNestedType);
            options.Types.Add(nonNestedType);
            options.Types.AddRange(nonNestedType.GetTypes());
            options.DecompileHidden = true;
            decompiler.Decompile(DecompilationType.TypeMethods, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            var result = new DecompileAsyncResult();

            result.AddDocument(MainCodeName, state.MainOutput.ToString(), state.MainOutput.Span);
            result.AddDocument(MainGeneratedCodeName, state.HiddenOutput.ToString(), null);
            return(Task.FromResult(result));
        }
Beispiel #3
0
        protected override Task <DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState)
        {
            var result = new DecompileAsyncResult();

            result.AddDocument(MAIN_CODE_NAME, string.Empty, null);
            return(Task.FromResult(result));
        }
Beispiel #4
0
        protected override Task <DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState)
        {
            var state = (EditMethodDecompileCodeState)decompileCodeState;

            state.CancellationToken.ThrowIfCancellationRequested();

            var type = methodToEdit.DeclaringType;

            while (type.DeclaringType != null)
            {
                type = type.DeclaringType;
            }

            DecompileTypeMethods options;

            state.DecompilationContext.CalculateBinSpans = true;
            options = new DecompileTypeMethods(state.MainOutput, state.DecompilationContext, type);
            options.Methods.Add(methodToEdit);
            options.DecompileHidden      = false;
            options.MakeEverythingPublic = makeEverythingPublic;
            decompiler.Decompile(DecompilationType.TypeMethods, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            state.DecompilationContext.CalculateBinSpans = false;
            options = new DecompileTypeMethods(state.HiddenOutput, state.DecompilationContext, type);
            options.Methods.Add(methodToEdit);
            options.DecompileHidden      = true;
            options.MakeEverythingPublic = makeEverythingPublic;
            decompiler.Decompile(DecompilationType.TypeMethods, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            var result = new DecompileAsyncResult();

            result.AddDocument(MAIN_CODE_NAME, state.MainOutput.ToString(), state.MainOutput.Span);
            result.AddDocument(MAIN_G_CODE_NAME, state.HiddenOutput.ToString(), null);
            return(Task.FromResult(result));
        }
Beispiel #5
0
		protected override Task<DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState) {
			var state = (EditAssemblyDecompileCodeState)decompileCodeState;
			state.CancellationToken.ThrowIfCancellationRequested();

			var options = new DecompileAssemblyInfo(state.MainOutput, state.DecompilationContext, sourceModule);
			options.KeepAllAttributes = true;
			decompiler.Decompile(DecompilationType.AssemblyInfo, options);

			state.CancellationToken.ThrowIfCancellationRequested();

			var result = new DecompileAsyncResult();
			result.AddDocument(MAIN_CODE_NAME, state.MainOutput.ToString(), null);
			return Task.FromResult(result);
		}
Beispiel #6
0
		protected override Task<DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState) {
			var state = (EditMethodDecompileCodeState)decompileCodeState;
			state.CancellationToken.ThrowIfCancellationRequested();

			state.DecompilationContext.CalculateBinSpans = true;
			var options = new DecompileTypeMethods(state.MainOutput, state.DecompilationContext, nonNestedTypeToEdit);
			options.DecompileHidden = false;
			options.ShowAll = true;
			options.MakeEverythingPublic = makeEverythingPublic;
			decompiler.Decompile(DecompilationType.TypeMethods, options);

			state.CancellationToken.ThrowIfCancellationRequested();

			var result = new DecompileAsyncResult();
			result.AddDocument(MAIN_CODE_NAME, state.MainOutput.ToString(), state.MainOutput.Span);
			return Task.FromResult(result);
		}
Beispiel #7
0
        protected override Task <DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState)
        {
            var state = (EditAssemblyDecompileCodeState)decompileCodeState;

            state.CancellationToken.ThrowIfCancellationRequested();

            var options = new DecompileAssemblyInfo(state.MainOutput, state.DecompilationContext, sourceModule);

            options.KeepAllAttributes = true;
            decompiler.Decompile(DecompilationType.AssemblyInfo, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            var result = new DecompileAsyncResult();

            result.AddDocument(MainCodeName, state.MainOutput.ToString(), null);
            return(Task.FromResult(result));
        }
Beispiel #8
0
        protected override Task <DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState)
        {
            var state = (EditClassDecompileCodeState)decompileCodeState;

            state.CancellationToken.ThrowIfCancellationRequested();

            state.DecompilationContext.CalculateILSpans = true;
            var options = new DecompileTypeMethods(state.MainOutput, state.DecompilationContext, nonNestedTypeToEdit);

            options.DecompileHidden = false;
            options.ShowAll         = true;
            decompiler.Decompile(DecompilationType.TypeMethods, options);

            state.CancellationToken.ThrowIfCancellationRequested();

            var result = new DecompileAsyncResult();

            result.AddDocument(MainCodeName, state.MainOutput.ToString(), state.MainOutput.Span);
            return(Task.FromResult(result));
        }
Beispiel #9
0
		protected override Task<DecompileAsyncResult> DecompileAsync(DecompileCodeState decompileCodeState) {
			var result = new DecompileAsyncResult();
			result.AddDocument(MAIN_CODE_NAME, string.Empty, null);
			return Task.FromResult(result);
		}