diff options
author | jfrijters <jfrijters> | 2011-03-11 17:11:15 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-03-11 17:11:15 +0300 |
commit | 341a75d21d75ab3e6f4047498ceffddc00a81c55 (patch) | |
tree | de6c98a2e2784e791f495c7a596c6a496d5635a1 /reflect/Reader | |
parent | 71d2e9a31847836f0b202e068cc50e3d6e6dd59b (diff) |
Added API extension to get the file hash of a resource module.
Diffstat (limited to 'reflect/Reader')
-rw-r--r-- | reflect/Reader/AssemblyReader.cs | 2 | ||||
-rw-r--r-- | reflect/Reader/ResourceModule.cs | 28 |
2 files changed, 20 insertions, 10 deletions
diff --git a/reflect/Reader/AssemblyReader.cs b/reflect/Reader/AssemblyReader.cs index a71698e4..504d386f 100644 --- a/reflect/Reader/AssemblyReader.cs +++ b/reflect/Reader/AssemblyReader.cs @@ -200,7 +200,7 @@ namespace IKVM.Reflection.Reader { if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0) { - return externalModules[index] = new ResourceModule(this, manifestModule.GetString(manifestModule.File.records[index].Name), location); + return externalModules[index] = new ResourceModule(manifestModule, index, location); } else { diff --git a/reflect/Reader/ResourceModule.cs b/reflect/Reader/ResourceModule.cs index cc41fecb..6e3e3925 100644 --- a/reflect/Reader/ResourceModule.cs +++ b/reflect/Reader/ResourceModule.cs @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Jeroen Frijters + Copyright (C) 2009-2011 Jeroen Frijters This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,20 +23,21 @@ */ using System; using System.Collections.Generic; +using IKVM.Reflection.Metadata; namespace IKVM.Reflection.Reader { sealed class ResourceModule : NonPEModule { - private readonly Assembly assembly; - private readonly string scopeName; + private readonly ModuleReader manifest; + private readonly int index; private readonly string location; - internal ResourceModule(Assembly assembly, string scopeName, string location) - : base(assembly.universe) + internal ResourceModule(ModuleReader manifest, int index, string location) + : base(manifest.universe) { - this.assembly = assembly; - this.scopeName = scopeName; + this.manifest = manifest; + this.index = index; this.location = location; } @@ -52,7 +53,7 @@ namespace IKVM.Reflection.Reader public override Assembly Assembly { - get { return assembly; } + get { return manifest.Assembly; } } public override string FullyQualifiedName @@ -67,7 +68,7 @@ namespace IKVM.Reflection.Reader public override string ScopeName { - get { return scopeName; } + get { return manifest.GetString(manifest.File.records[index].Name); } } public override Guid ModuleVersionId @@ -75,6 +76,15 @@ namespace IKVM.Reflection.Reader get { throw new NotSupportedException(); } } + public override byte[] __ModuleHash + { + get + { + int blob = manifest.File.records[index].HashValue; + return blob == 0 ? Empty<byte>.Array : manifest.GetBlobCopy(blob); + } + } + internal override Type FindType(TypeName typeName) { return null; |