本文整理汇总了C#中IKVM.Reflection.Reader.ModuleReader类的典型用法代码示例。如果您正苦于以下问题:C# ModuleReader类的具体用法?C# ModuleReader怎么用?C# ModuleReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleReader类属于IKVM.Reflection.Reader命名空间,在下文中一共展示了ModuleReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ResourceModule
internal ResourceModule(ModuleReader manifest, int index, string location)
: base(manifest.universe)
{
this.manifest = manifest;
this.index = index;
this.location = location;
}
开发者ID:ngraziano,项目名称:mono,代码行数:7,代码来源:ResourceModule.cs
示例2: TypeDefImpl
internal TypeDefImpl(ModuleReader module, int index)
{
this.module = module;
this.index = index;
this.typeName = module.GetString(module.TypeDef.records[index].TypeName);
this.typeNamespace = module.GetString(module.TypeDef.records[index].TypeNamespace);
}
开发者ID:ztzg,项目名称:mono,代码行数:7,代码来源:TypeDefImpl.cs
示例3: AssemblyReader
internal AssemblyReader(string location, ModuleReader manifestModule)
: base(manifestModule.universe)
{
this.location = location;
this.manifestModule = manifestModule;
externalModules = new Module[manifestModule.File.records.Length];
}
开发者ID:mono,项目名称:ikvm,代码行数:7,代码来源:AssemblyReader.cs
示例4: ReadSig
internal static FieldSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
{
if (br.ReadByte() != FIELD)
{
throw new BadImageFormatException();
}
CustomModifiers mods = CustomModifiers.Read(module, br, context);
Type fieldType = ReadType(module, br, context);
return new FieldSignature(fieldType, mods);
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:10,代码来源:FieldSignature.cs
示例5: ExceptionHandlingClause
internal ExceptionHandlingClause(ModuleReader module, int flags, int tryOffset, int tryLength, int handlerOffset, int handlerLength, int classTokenOrfilterOffset, IGenericContext context)
{
this.flags = flags;
this.tryOffset = tryOffset;
this.tryLength = tryLength;
this.handlerOffset = handlerOffset;
this.handlerLength = handlerLength;
this.catchType = flags == (int)ExceptionHandlingClauseOptions.Clause && classTokenOrfilterOffset != 0 ? module.ResolveType(classTokenOrfilterOffset, context) : null;
this.filterOffset = flags == (int)ExceptionHandlingClauseOptions.Filter ? classTokenOrfilterOffset : 0;
}
开发者ID:koush,项目名称:mono,代码行数:10,代码来源:ExceptionHandlingClause.cs
示例6: ReadGenericInst
private static Type ReadGenericInst(ModuleReader module, ByteReader br, IGenericContext context)
{
Type type;
switch (br.ReadByte())
{
case ELEMENT_TYPE_CLASS:
type = ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
break;
case ELEMENT_TYPE_VALUETYPE:
type = ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
break;
default:
throw new BadImageFormatException();
}
if (!type.__IsMissing && !type.IsGenericTypeDefinition)
{
throw new BadImageFormatException();
}
int genArgCount = br.ReadCompressedInt();
Type[] args = new Type[genArgCount];
Type[][] reqmod = null;
Type[][] optmod = null;
for (int i = 0; i < genArgCount; i++)
{
// LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for genericinst, but C++ uses it, the verifier allows it and ildasm also supports it
CustomModifiers mods = ReadCustomModifiers(module, br, context);
if (mods.required != null || mods.optional != null)
{
if (reqmod == null)
{
reqmod = new Type[genArgCount][];
optmod = new Type[genArgCount][];
}
reqmod[i] = mods.required;
optmod[i] = mods.optional;
}
args[i] = ReadType(module, br, context);
}
return GenericTypeInstance.Make(type, args, reqmod, optmod);
}
开发者ID:ngraziano,项目名称:mono,代码行数:40,代码来源:Signature.cs
示例7: ReadTypeDefOrRefEncoded
internal static Type ReadTypeDefOrRefEncoded(ModuleReader module, ByteReader br, IGenericContext context)
{
int encoded = br.ReadCompressedUInt();
switch (encoded & 3)
{
case 0:
return module.ResolveType((TypeDefTable.Index << 24) + (encoded >> 2), null, null);
case 1:
return module.ResolveType((TypeRefTable.Index << 24) + (encoded >> 2), null, null);
case 2:
return module.ResolveType((TypeSpecTable.Index << 24) + (encoded >> 2), context);
default:
throw new BadImageFormatException();
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:Signature.cs
示例8: ReadTypeOrByRef
private static Type ReadTypeOrByRef(ModuleReader module, ByteReader br, IGenericContext context)
{
if (br.PeekByte() == ELEMENT_TYPE_BYREF)
{
br.ReadByte();
// LAMESPEC it is allowed (by C++/CLI, ilasm and peverify) to have custom modifiers after the BYREF
// (which makes sense, as it is analogous to pointers)
CustomModifiers mods = CustomModifiers.Read(module, br, context);
// C++/CLI generates void& local variables, so we need to use ReadTypeOrVoid here
return ReadTypeOrVoid(module, br, context).__MakeByRefType(mods);
}
else
{
return ReadType(module, br, context);
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:16,代码来源:Signature.cs
示例9: ReadParam
protected static Type ReadParam(ModuleReader module, ByteReader br, IGenericContext context)
{
switch (br.PeekByte())
{
case ELEMENT_TYPE_TYPEDBYREF:
br.ReadByte();
return module.universe.System_TypedReference;
default:
return ReadTypeOrByRef(module, br, context);
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:11,代码来源:Signature.cs
示例10: ReadType
// see ECMA 335 CLI spec June 2006 section 23.2.12 for this production
protected static Type ReadType(ModuleReader module, ByteReader br, IGenericContext context)
{
CustomModifiers mods;
switch (br.ReadByte())
{
case ELEMENT_TYPE_CLASS:
return ReadTypeDefOrRefEncoded(module, br, context).MarkNotValueType();
case ELEMENT_TYPE_VALUETYPE:
return ReadTypeDefOrRefEncoded(module, br, context).MarkValueType();
case ELEMENT_TYPE_BOOLEAN:
return module.universe.System_Boolean;
case ELEMENT_TYPE_CHAR:
return module.universe.System_Char;
case ELEMENT_TYPE_I1:
return module.universe.System_SByte;
case ELEMENT_TYPE_U1:
return module.universe.System_Byte;
case ELEMENT_TYPE_I2:
return module.universe.System_Int16;
case ELEMENT_TYPE_U2:
return module.universe.System_UInt16;
case ELEMENT_TYPE_I4:
return module.universe.System_Int32;
case ELEMENT_TYPE_U4:
return module.universe.System_UInt32;
case ELEMENT_TYPE_I8:
return module.universe.System_Int64;
case ELEMENT_TYPE_U8:
return module.universe.System_UInt64;
case ELEMENT_TYPE_R4:
return module.universe.System_Single;
case ELEMENT_TYPE_R8:
return module.universe.System_Double;
case ELEMENT_TYPE_I:
return module.universe.System_IntPtr;
case ELEMENT_TYPE_U:
return module.universe.System_UIntPtr;
case ELEMENT_TYPE_STRING:
return module.universe.System_String;
case ELEMENT_TYPE_OBJECT:
return module.universe.System_Object;
case ELEMENT_TYPE_VAR:
return context.GetGenericTypeArgument(br.ReadCompressedUInt());
case ELEMENT_TYPE_MVAR:
return context.GetGenericMethodArgument(br.ReadCompressedUInt());
case ELEMENT_TYPE_GENERICINST:
return ReadGenericInst(module, br, context);
case ELEMENT_TYPE_SZARRAY:
mods = CustomModifiers.Read(module, br, context);
return ReadType(module, br, context).__MakeArrayType(mods);
case ELEMENT_TYPE_ARRAY:
mods = CustomModifiers.Read(module, br, context);
return ReadType(module, br, context).__MakeArrayType(br.ReadCompressedUInt(), ReadArraySizes(br), ReadArrayBounds(br), mods);
case ELEMENT_TYPE_PTR:
mods = CustomModifiers.Read(module, br, context);
return ReadTypeOrVoid(module, br, context).__MakePointerType(mods);
case ELEMENT_TYPE_FNPTR:
return ReadFunctionPointer(module, br, context);
default:
throw new BadImageFormatException();
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:63,代码来源:Signature.cs
示例11: ReadLocalVarSig
internal static void ReadLocalVarSig(ModuleReader module, ByteReader br, IGenericContext context, List<LocalVariableInfo> list)
{
if (br.Length < 2 || br.ReadByte() != LOCAL_SIG)
{
throw new BadImageFormatException("Invalid local variable signature");
}
int count = br.ReadCompressedUInt();
for (int i = 0; i < count; i++)
{
if (br.PeekByte() == ELEMENT_TYPE_TYPEDBYREF)
{
br.ReadByte();
list.Add(new LocalVariableInfo(i, module.universe.System_TypedReference, false, new CustomModifiers()));
}
else
{
CustomModifiers mods1 = CustomModifiers.Read(module, br, context);
bool pinned = false;
if (br.PeekByte() == ELEMENT_TYPE_PINNED)
{
br.ReadByte();
pinned = true;
}
CustomModifiers mods2 = CustomModifiers.Read(module, br, context);
Type type = ReadTypeOrByRef(module, br, context);
list.Add(new LocalVariableInfo(i, type, pinned, CustomModifiers.Combine(mods1, mods2)));
}
}
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:29,代码来源:Signature.cs
示例12: LoadModule
private Module LoadModule(int index, byte[] rawModule, string location)
{
if ((manifestModule.File.records[index].Flags & ContainsNoMetaData) != 0)
{
return externalModules[index] = new ResourceModule(manifestModule, index, location);
}
else
{
if (rawModule == null)
{
rawModule = File.ReadAllBytes(location);
}
return externalModules[index] = new ModuleReader(this, manifestModule.universe, new MemoryStream(rawModule), location);
}
}
开发者ID:mono,项目名称:ikvm,代码行数:15,代码来源:AssemblyReader.cs
示例13: ReadCustomModifiers
private static CustomModifiers ReadCustomModifiers(ModuleReader module, ByteReader br, IGenericContext context)
{
CustomModifiers mods = new CustomModifiers();
byte b = br.PeekByte();
if (IsCustomModifier(b))
{
List<Type> required = new List<Type>();
List<Type> optional = new List<Type>();
while (IsCustomModifier(b))
{
bool req = br.ReadByte() == ELEMENT_TYPE_CMOD_REQD;
Type type = ReadTypeDefOrRefEncoded(module, br, context);
(req ? required : optional).Add(type);
b = br.PeekByte();
}
mods.required = required.ToArray();
mods.optional = optional.ToArray();
}
return mods;
}
开发者ID:koush,项目名称:mono,代码行数:20,代码来源:Signature.cs
示例14: GetAssemblyName
public static AssemblyName GetAssemblyName(string path)
{
try
{
path = Path.GetFullPath(path);
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
ModuleReader module = new ModuleReader(null, null, fs, path, false);
if (module.Assembly == null)
{
throw new BadImageFormatException("Module does not contain a manifest");
}
return module.Assembly.GetName();
}
}
catch (IOException x)
{
throw new FileNotFoundException(x.Message, x);
}
catch (UnauthorizedAccessException x)
{
throw new FileNotFoundException(x.Message, x);
}
}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:24,代码来源:AssemblyName.cs
示例15: ReadSig
internal static MethodSignature ReadSig(ModuleReader module, ByteReader br, IGenericContext context)
{
CallingConventions callingConvention;
int genericParamCount;
Type returnType;
Type[] parameterTypes;
byte flags = br.ReadByte();
switch (flags & 7)
{
case DEFAULT:
callingConvention = CallingConventions.Standard;
break;
case VARARG:
callingConvention = CallingConventions.VarArgs;
break;
default:
throw new BadImageFormatException();
}
if ((flags & HASTHIS) != 0)
{
callingConvention |= CallingConventions.HasThis;
}
if ((flags & EXPLICITTHIS) != 0)
{
callingConvention |= CallingConventions.ExplicitThis;
}
genericParamCount = 0;
if ((flags & GENERIC) != 0)
{
genericParamCount = br.ReadCompressedInt();
context = new UnboundGenericMethodContext(context);
}
int paramCount = br.ReadCompressedInt();
Type[][][] modifiers = null;
Type[] optionalCustomModifiers;
Type[] requiredCustomModifiers;
ReadCustomModifiers(module, br, context, out requiredCustomModifiers, out optionalCustomModifiers);
returnType = ReadRetType(module, br, context);
parameterTypes = new Type[paramCount];
PackedCustomModifiers.SetModifiers(ref modifiers, 0, 0, optionalCustomModifiers, paramCount + 1);
PackedCustomModifiers.SetModifiers(ref modifiers, 0, 1, requiredCustomModifiers, paramCount + 1);
for (int i = 0; i < parameterTypes.Length; i++)
{
if ((callingConvention & CallingConventions.VarArgs) != 0 && br.PeekByte() == SENTINEL)
{
Array.Resize(ref parameterTypes, i);
if (modifiers != null)
{
Array.Resize(ref modifiers, i + 1);
}
break;
}
ReadCustomModifiers(module, br, context, out requiredCustomModifiers, out optionalCustomModifiers);
PackedCustomModifiers.SetModifiers(ref modifiers, i + 1, 0, optionalCustomModifiers, paramCount + 1);
PackedCustomModifiers.SetModifiers(ref modifiers, i + 1, 1, requiredCustomModifiers, paramCount + 1);
parameterTypes[i] = ReadParam(module, br, context);
}
return new MethodSignature(returnType, parameterTypes, modifiers, callingConvention, genericParamCount);
}
开发者ID:ngraziano,项目名称:mono,代码行数:59,代码来源:MethodSignature.cs
示例16: RawModule
internal RawModule(ModuleReader module)
{
this.module = module;
this.isManifestModule = module.Assembly != null;
}
开发者ID:nestalk,项目名称:mono,代码行数:5,代码来源:Module.cs
示例17: PropertyInfoImpl
internal PropertyInfoImpl(ModuleReader module, Type declaringType, int index)
{
this.module = module;
this.declaringType = declaringType;
this.index = index;
}
开发者ID:koush,项目名称:mono,代码行数:6,代码来源:PropertyInfoImpl.cs
示例18: MethodDefImpl
internal MethodDefImpl(ModuleReader module, TypeDefImpl declaringType, int index)
{
this.module = module;
this.index = index;
this.declaringType = declaringType;
}
开发者ID:ngraziano,项目名称:mono,代码行数:6,代码来源:Method.cs
示例19: ReadOptionalParameterTypes
// this reads just the optional parameter types, from a MethodRefSig
internal static Type[] ReadOptionalParameterTypes(ModuleReader module, ByteReader br)
{
br.ReadByte();
int paramCount = br.ReadCompressedInt();
SkipCustomModifiers(br);
ReadRetType(module, br, null);
for (int i = 0; i < paramCount; i++)
{
if (br.PeekByte() == SENTINEL)
{
br.ReadByte();
Type[] types = new Type[paramCount - i];
for (int j = 0; j < types.Length; j++)
{
SkipCustomModifiers(br);
types[j] = ReadType(module, br, null);
}
return types;
}
SkipCustomModifiers(br);
ReadType(module, br, null);
}
return Type.EmptyTypes;
}
开发者ID:koush,项目名称:mono,代码行数:25,代码来源:Signature.cs
示例20: ReadOptionalParameterTypes
// this reads just the optional parameter types, from a MethodRefSig
internal static Type[] ReadOptionalParameterTypes(ModuleReader module, ByteReader br, IGenericContext context, out CustomModifiers[] customModifiers)
{
br.ReadByte();
int paramCount = br.ReadCompressedUInt();
CustomModifiers.Skip(br);
ReadRetType(module, br, context);
for (int i = 0; i < paramCount; i++)
{
if (br.PeekByte() == SENTINEL)
{
br.ReadByte();
Type[] types = new Type[paramCount - i];
customModifiers = new CustomModifiers[types.Length];
for (int j = 0; j < types.Length; j++)
{
customModifiers[j] = CustomModifiers.Read(module, br, context);
types[j] = ReadType(module, br, context);
}
return types;
}
CustomModifiers.Skip(br);
ReadType(module, br, context);
}
customModifiers = Empty<CustomModifiers>.Array;
return Type.EmptyTypes;
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:27,代码来源:Signature.cs
注:本文中的IKVM.Reflection.Reader.ModuleReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论