private PEReader(PEFile pefile, System.IO.FileStream file, bool refs, bool skipBody)
: base(new MemoryStream(new BinaryReader(file).ReadBytes(System.Convert.ToInt32(file.Length))))
{
this.skipBody = skipBody;
thisScope = pefile;
refsOnly = refs;
verInfo.fromExisting = true;
try {
ReadDOSHeader();
} catch (PEFileException) {
Console.WriteLine("Bad DOS header");
return;
}
ReadFileHeader();
ReadSectionHeaders();
ReadCLIHeader();
ReadMetaData();
if (refsOnly)
ReadMetaDataTableRefs();
else {
ReadMetaDataTables();
pefile.metaDataTables = new MetaDataTables(tables);
}
file.Close();
if (thisScope != null) {
thisScope.buffer = this;
if (pefile != null) {
pefile.versionInfo = verInfo;
}
}
strings = null;
userstring = null;
blob = null;
guid = null;
}