public static PEImage Load(byte[] buffer, int offset, int count, string location) { var blob = new Blob(buffer, offset, count, false); var source = new BlobBinarySource(blob, location); return(new PEImage(source)); }
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)); }