IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
MissingModule.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2011-2012 Jeroen Frijters
3
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.
7
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:
11
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.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24using System;
25using System.Collections.Generic;
26using System.Reflection.Metadata;
27
28namespace IKVM.Reflection
29{
30
32 {
33
34 readonly Assembly assembly;
35 readonly int index;
36
42 internal MissingModule(Assembly assembly, int index) :
43 base(assembly.Universe)
44 {
45 this.assembly = assembly;
46 this.index = index;
47 }
48
49 public override int MDStreamVersion
50 {
51 get { throw new MissingModuleException(this); }
52 }
53
54 public override Assembly Assembly
55 {
56 get { return assembly; }
57 }
58
59 public override string FullyQualifiedName
60 {
61 get { throw new MissingModuleException(this); }
62 }
63
64 public override string Name
65 {
66 get
67 {
68 if (index == -1)
69 throw new MissingModuleException(this);
70
71 return assembly.ManifestModule.GetString(assembly.ManifestModule.FileTable.records[index].Name);
72 }
73 }
74
75 public override Guid ModuleVersionId
76 {
77 get { throw new MissingModuleException(this); }
78 }
79
80 public override string ScopeName
81 {
82 get { throw new MissingModuleException(this); }
83 }
84
85 internal override Type FindType(TypeName typeName)
86 {
87 return null;
88 }
89
90 internal override Type FindTypeIgnoreCase(TypeName lowerCaseName)
91 {
92 return null;
93 }
94
95 internal override void GetTypesImpl(List<Type> list)
96 {
97 throw new MissingModuleException(this);
98 }
99
100 public override void __GetDataDirectoryEntry(int index, out int rva, out int length)
101 {
102 throw new MissingModuleException(this);
103 }
104
105 public override IList<CustomAttributeData> __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
106 {
107 throw new MissingModuleException(this);
108 }
109
110 public override long __RelativeVirtualAddressToFileOffset(int rva)
111 {
112 throw new MissingModuleException(this);
113 }
114
115 public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
116 {
117 throw new MissingModuleException(this);
118 }
119
120 public override int __Subsystem
121 {
122 get { throw new MissingModuleException(this); }
123 }
124
125 internal override void ExportTypes(AssemblyFileHandle handle, IKVM.Reflection.Emit.ModuleBuilder manifestModule)
126 {
127 throw new MissingModuleException(this);
128 }
129
130 public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
131 {
132 throw new MissingModuleException(this);
133 }
134
135 public override bool __IsMissing
136 {
137 get { return true; }
138 }
139
140 protected override Exception InvalidOperationException()
141 {
142 return new MissingModuleException(this);
143 }
144
145 protected override Exception NotSupportedException()
146 {
147 return new MissingModuleException(this);
148 }
149
150 protected override Exception ArgumentOutOfRangeException()
151 {
152 return new MissingModuleException(this);
153 }
154
155 public override byte[] __ModuleHash
156 {
157 get
158 {
159 if (index == -1)
160 throw new MissingModuleException(this);
161 if (assembly.ManifestModule.FileTable.records[index].HashValue.IsNil)
162 return null;
163
164 var br = assembly.ManifestModule.GetBlobReader(assembly.ManifestModule.FileTable.records[index].HashValue);
165 return br.ReadBytes(br.Length);
166 }
167 }
168
169 }
170
171}
IKVM.Reflection.Type Type
global::java.lang.invoke.LambdaForm.Name Name
override void __GetDataDirectoryEntry(int index, out int rva, out int length)
override string FullyQualifiedName
override Exception InvalidOperationException()
override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
override IList< CustomAttributeData > __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security)
override long __RelativeVirtualAddressToFileOffset(int rva)
override Exception NotSupportedException()
override Exception ArgumentOutOfRangeException()