public TypeSystem(MetadataImage image, bool isMsCorLib) { if (image == null) { throw new ArgumentNullException("image"); } _image = image; _isMsCorLib = isMsCorLib; if (isMsCorLib) { _typeDefinitions = image.Assembly.Modules[0].TopLevelTypes; } else { MsCorLibReference = image.Assembly.AssemblyReferences.FirstOrDefault(x => x.Name == "mscorlib"); if (MsCorLibReference == null) { MsCorLibReference = new AssemblyReference(new ReflectionAssemblyNameWrapper(typeof(object).Assembly.GetName())) { Referrer = image.Assembly, Culture = "neutral", Version = new Version(image.Header.VersionString[1] - 48, 0, 0, 0) }; } } Boolean = CreateSignature(ElementType.Boolean, "Boolean", true); SByte = CreateSignature(ElementType.I1, "SByte", true); Int16 = CreateSignature(ElementType.I2, "Int16", true); Int32 = CreateSignature(ElementType.I4, "Int32", true); Int64 = CreateSignature(ElementType.I8, "Int64", true); IntPtr = CreateSignature(ElementType.I, "IntPtr", true); Byte = CreateSignature(ElementType.U1, "Byte", true); UInt16 = CreateSignature(ElementType.U2, "UInt16", true); UInt32 = CreateSignature(ElementType.U4, "UInt32", true); UInt64 = CreateSignature(ElementType.U8, "UInt64", true); UIntPtr = CreateSignature(ElementType.U, "UIntPtr", true); Single = CreateSignature(ElementType.R4, "Single", true); Double = CreateSignature(ElementType.R8, "Double", true); Object = CreateSignature(ElementType.Object, "Object", false); Char = CreateSignature(ElementType.Char, "Char", true); String = CreateSignature(ElementType.String, "String", false); Type = CreateSignature(ElementType.Type, "Type", false); TypedReference = CreateSignature(ElementType.TypedByRef, "TypedReference", true); Void = CreateSignature(ElementType.Void, "Void", true); }
private static void SetOsOwner(AssemblyRefOs os, AssemblyReference reference) { os.Reference = reference; }
private static void SetProcessorOwner(AssemblyRefProcessor processor, AssemblyReference reference) { processor.Reference = reference; }
public AssemblyRefProcessor(AssemblyReference reference, uint processor) : base(new MetadataToken(MetadataTokenType.AssemblyRefProcessor)) { Processor = processor; _reference.Value = reference; }
private static AssemblyDefinition GetReferenceOwner(AssemblyReference arg) { return(arg.Referrer); }
private static void SetReferenceOwner(AssemblyReference reference, AssemblyDefinition definition) { reference.Referrer = definition; }