Exemplo n.º 1
0
 public static bool IsAssemblyFile(string filePath)
 {
     using (var source = new FileBinarySource(filePath))
     {
         return(IsAssembly(source));
     }
 }
Exemplo n.º 2
0
        public static PEImage LoadFile(string filePath, FileLoadMode loadMode = FileLoadMode.OnDemand)
        {
            IBinarySource source;

            switch (loadMode)
            {
            case FileLoadMode.OnDemand:
                source = new FileBinarySource(filePath, false);
                break;

            case FileLoadMode.InMemory:
                source = new BlobBinarySource(File.ReadAllBytes(filePath), filePath);
                break;

            case FileLoadMode.MemoryMappedFile:
                source = new MemoryMappedFileBinarySource(filePath, 0L, 0L, false);
                break;

            default:
                throw new NotImplementedException();
            }

            return(new PEImage(source));
        }