Пример #1
0
        public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
        {
            try {
                assembly.WaitUntilLoaded();                 // necessary so that load errors are passed on to the caller
            } catch (AggregateException ex) {
                language.WriteCommentLine(output, assembly.FileName);
                if (ex.InnerException is BadImageFormatException || ex.InnerException is IOException)
                {
                    language.WriteCommentLine(output, "This file does not contain a managed assembly.");
                    return;
                }
                else
                {
                    throw;
                }
            }
            if (assembly.ModuleDefinition == null)
            {
                language.WriteCommentLine(output, "This file does not contain a managed assembly.");
                return;
            }
            var flags = Parent is AssemblyTreeNode ? DecompileAssemblyFlags.Module : DecompileAssemblyFlags.Assembly;

            if (assembly.AssemblyDefinition == null)
            {
                flags = DecompileAssemblyFlags.Module;
            }
            if (options.FullDecompilation)
            {
                flags = DecompileAssemblyFlags.AssemblyAndModule;
            }
            language.DecompileAssembly(assembly, output, options, flags);
        }
Пример #2
0
        public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
        {
            void HandleException(Exception ex, string message)
            {
                language.WriteCommentLine(output, message);

                output.WriteLine();
                output.MarkFoldStart("Exception details", true);
                output.Write(ex.ToString());
                output.MarkFoldEnd();
            }

            try {
                assembly.WaitUntilLoaded();                 // necessary so that load errors are passed on to the caller
            } catch (AggregateException ex) {
                language.WriteCommentLine(output, assembly.FileName);
                switch (ex.InnerException)
                {
                case BadImageFormatException badImage:
                    HandleException(badImage, "This file does not contain a managed assembly.");
                    return;

                case FileNotFoundException fileNotFound:
                    HandleException(fileNotFound, "The file was not found.");
                    return;

                default:
                    throw;
                }
            }
            language.DecompileAssembly(assembly, output, options);
        }
Пример #3
0
 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     try {
         assembly.WaitUntilLoaded();                 // necessary so that load errors are passed on to the caller
     } catch (AggregateException ex) {
         language.WriteCommentLine(output, assembly.FileName);
         if (ex.InnerException is BadImageFormatException)
         {
             language.WriteCommentLine(output, "This file does not contain a managed assembly.");
             return;
         }
         else
         {
             throw;
         }
     }
     language.DecompileAssembly(assembly, output, options);
 }
Пример #4
0
 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     assembly.WaitUntilLoaded();             // necessary so that load errors are passed on to the caller
     language.DecompileAssembly(assembly.AssemblyDefinition, assembly.FileName, output, options);
 }