示例#1
0
 public static LoadedAssembly FromFile(string path)
 {
     using (var s = File.OpenRead(path))
         using (var pe = new System.Reflection.PortableExecutable.PEReader(s))
         {
             if (!pe.HasMetadata)
             {
                 return(null);
             }
             var holder = new MetadataBlockHolder(pe.GetMetadata());
             if (!holder.Reader.IsAssembly)
             {
                 holder.Dispose();
                 return(null);
             }
             return(new LoadedAssembly(holder));
         }
 }
示例#2
0
 public void Dispose()
 {
     _holder?.Dispose();
 }