Ejemplo n.º 1
0
        bool IsSupportedLanguage(IDecompiler decompiler, CompilationKind kind)
        {
            if (decompiler == null)
            {
                return(false);
            }

            switch (kind)
            {
            case CompilationKind.Assembly:
                if (!decompiler.CanDecompile(DecompilationType.AssemblyInfo))
                {
                    return(false);
                }
                break;

            case CompilationKind.Method:
            case CompilationKind.EditClass:
                if (!decompiler.CanDecompile(DecompilationType.TypeMethods))
                {
                    return(false);
                }
                break;

            case CompilationKind.AddClass:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(kind));
            }

            return(languageCompilerProviders.Any(a => a.Language == decompiler.GenericGuid));
        }
Ejemplo n.º 2
0
 protected EditCodeVM(IRawModuleBytesProvider rawModuleBytesProvider, IOpenFromGAC openFromGAC, IOpenAssembly openAssembly, ILanguageCompiler languageCompiler, IDecompiler decompiler, ModuleDef sourceModule)
 {
     Debug.Assert(decompiler.CanDecompile(DecompilationType.TypeMethods));
     this.openFromGAC               = openFromGAC;
     this.openAssembly              = openAssembly;
     this.languageCompiler          = languageCompiler;
     this.decompiler                = decompiler;
     this.sourceModule              = sourceModule;
     this.assemblyReferenceResolver = new AssemblyReferenceResolver(rawModuleBytesProvider, sourceModule.Context.AssemblyResolver, sourceModule, makeEverythingPublic);
 }
Ejemplo n.º 3
0
 bool IsSupportedLanguage(IDecompiler decompiler)
 {
     if (decompiler == null)
     {
         return(false);
     }
     if (!decompiler.CanDecompile(DecompilationType.TypeMethods))
     {
         return(false);
     }
     return(languageCompilerProviders.Any(a => a.Language == decompiler.GenericGuid));
 }
Ejemplo n.º 4
0
        public EditCodeVM(IOpenFromGAC openFromGAC, IOpenAssembly openAssembly, ILanguageCompiler languageCompiler, IDecompiler decompiler, MethodDef methodToEdit, IList <MethodSourceStatement> statementsInMethodToEdit)
        {
            Debug.Assert(decompiler.CanDecompile(DecompilationType.TypeMethods));
            this.openFromGAC      = openFromGAC;
            this.openAssembly     = openAssembly;
            this.languageCompiler = languageCompiler;
            this.decompiler       = decompiler;
            this.methodToEdit     = methodToEdit;
            var methodSourceStatement = statementsInMethodToEdit.Count == 0 ? (MethodSourceStatement?)null : statementsInMethodToEdit[0];

            this.assemblyReferenceResolver = new AssemblyReferenceResolver(methodToEdit.Module.Context.AssemblyResolver, methodToEdit.Module, makeEverythingPublic);
            StartDecompileAsync(methodToEdit, methodSourceStatement).ContinueWith(t => {
                var ex = t.Exception;
                Debug.Assert(ex == null);
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
Ejemplo n.º 5
0
 public bool CanDecompile(DecompilationType decompilationType) => implementation.CanDecompile(decompilationType);
Ejemplo n.º 6
0
		bool IsSupportedLanguage(IDecompiler decompiler, CompilationKind kind) {
			if (decompiler == null)
				return false;

			switch (kind) {
			case CompilationKind.Assembly:
				if (!decompiler.CanDecompile(DecompilationType.AssemblyInfo))
					return false;
				break;

			case CompilationKind.Method:
			case CompilationKind.EditClass:
				if (!decompiler.CanDecompile(DecompilationType.TypeMethods))
					return false;
				break;

			case CompilationKind.AddClass:
				break;

			default:
				throw new ArgumentOutOfRangeException(nameof(kind));
			}

			return languageCompilerProviders.Any(a => a.Language == decompiler.GenericGuid);
		}