2 Copyright (C) 2009-2011 Jeroen Frijters
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
25 using System.Collections.Generic;
26 using IKVM.Reflection.Metadata;
28 namespace IKVM.Reflection.Reader
30 sealed class ResourceModule : NonPEModule
32 private readonly ModuleReader manifest;
33 private readonly int index;
34 private readonly string location;
36 internal ResourceModule(ModuleReader manifest, int index, string location)
37 : base(manifest.universe)
39 this.manifest = manifest;
41 this.location = location;
44 public override int MDStreamVersion
46 get { throw new NotSupportedException(); }
49 public override bool IsResource()
54 public override Assembly Assembly
56 get { return manifest.Assembly; }
59 public override string FullyQualifiedName
61 get { return location ?? "<Unknown>"; }
64 public override string Name
66 get { return location == null ? "<Unknown>" : System.IO.Path.GetFileName(location); }
69 public override string ScopeName
71 get { return manifest.GetString(manifest.File.records[index].Name); }
74 public override Guid ModuleVersionId
76 get { throw new NotSupportedException(); }
79 public override byte[] __ModuleHash
83 int blob = manifest.File.records[index].HashValue;
84 return blob == 0 ? Empty<byte>.Array : manifest.GetBlobCopy(blob);
88 internal override Type FindType(TypeName typeName)
93 internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
98 internal override void GetTypesImpl(List<Type> list)
102 protected override Exception ArgumentOutOfRangeException()
104 return new NotSupportedException();