internal ManifestResource(PEFile pefile, ManifestResource mres, bool isPub) { this.pefile = pefile; mrName = mres.mrName; flags = mres.flags; this.impl = mres.impl; this.fileOffset = mres.fileOffset; this.resourceBytes = mres.resourceBytes; }
internal GenericParam(PEReader buff) : base(VAR) { index = buff.ReadUInt16(); flags = buff.ReadUInt16(); parentIx = buff.GetCodedIndex(CIx.TypeOrMethodDef); name = buff.GetString(); if (extraField) kind = buff.ReadUInt16(); sortTable = true; tabIx = MDTable.GenericParam; // resolve generic param immediately for signature resolution parent = buff.GetCodedElement(CIx.TypeOrMethodDef,parentIx); if (parent != null) { if (parent is MethodDef) { typeIndex = MVAR; ((MethodDef)parent).AddGenericParam(this); } else { ((ClassDef)parent).AddGenericParam(this); } } }
internal void SetClassParam(Class paren, int ix) { typeIndex = VAR; parent = paren; index = (ushort)ix; }
internal override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasDeclSecurity,parentIx); if (parent != null) { if (parent is ClassDef) ((ClassDef)parent).AddSecurity(this); if (parent is Assembly) ((Assembly)parent).AddSecurity(this); if (parent is MethodDef) ((MethodDef)parent).AddSecurity(this); } }
internal override void Resolve(PEReader buff) { field = buff.GetCodedElement(CIx.HasFieldMarshal,parentIx); nt = buff.GetBlobNativeType(ntIx); if (field is FieldDef) { ((FieldDef)field).SetMarshalType(nt); } else { ((Param)field).SetMarshalType(nt); } }
internal CustomAttribute(MetaDataElement paren, Method constrType, byte[] val) { parent = paren; type = constrType; tabIx = MDTable.CustomAttribute; byteVal = val; sortTable = true; changed = true; }
/*-------------------- Constructors ---------------------------------*/ internal DeclSecurity(MetaDataElement paren, SecurityAction act, byte[] perSet) { parent = paren; action = act; permissionSet = perSet; sortTable = true; tabIx = MDTable.DeclSecurity; }
internal override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasConstant,parentIx); if (parent != null) { if (parent is Param) ((Param)parent).AddDefaultValue(cValue); else if (parent is FieldDef) ((FieldDef)parent).AddValue(cValue); else ((Property)parent).AddInitValue(cValue); } }
internal void ClassToken(MetaDataElement cToken) { classToken = cToken; }
private Type SubstituteType(Type origType, MetaDataElement paren, Type[] genTypes) { if ((origType is GenericParam) && (((GenericParam)origType).GetParent() == paren)) return genTypes[((GenericParam)origType).Index]; return origType; }
/*-------------------- Constructors ---------------------------------*/ internal ConstantElem(MetaDataElement parent, Constant val) { this.parent = parent; cValue = val; sortTable = true; tabIx = MDTable.Constant; }
private Type[] ReplaceGenPars(Type[] typeList, MetaDataElement paren, Type[] genTypes) { if (typeList == null) return null; Type[] newList = new Type[typeList.Length]; for (int i=0; i < typeList.Length; i++) { newList[i] = SubstituteType(typeList[i],paren,genTypes); } return newList; }
internal void DescriptorError(MetaDataElement elem) { throw new DescriptorException(elem.NameString()); }
internal override void Resolve(PEReader buff) { impl = buff.GetCodedElement(CIx.Implementation,implIx); if (impl == null) { if (!buff.skipBody) resourceBytes = buff.GetResource(fileOffset); } }
internal void WriteCodedIndex(CIx code, MetaDataElement elem) { metaData.WriteCodedIndex(code,elem,this); }
/*-------------------- Constructors ---------------------------------*/ internal ExternClass(TypeAttr attr, string ns, string name, MetaDataElement paren) { flags = (uint)attr; nameSpace = ns; this.name = name; implementation = paren; tabIx = MDTable.ExportedType; }
/*-------------------- Constructors ---------------------------------*/ internal CustomAttribute(MetaDataElement paren, Method constrType, Constant[] val) { parent = paren; type = constrType; argVals = val; changed = true; sortTable = true; tabIx = MDTable.CustomAttribute; }
internal override sealed void BuildTables(MetaDataOut md) { md.AddToTable(MDTable.ExportedType,this); nameSpaceIx = md.AddToStringsHeap(nameSpace); nameIx = md.AddToStringsHeap(name); if (implementation is ModuleRef) { ModuleFile mFile = ((ModuleRef)implementation).modFile; mFile.BuildMDTables(md); implementation = mFile; } }
internal override void Resolve(PEReader buff) { parent = buff.GetCodedElement(CIx.HasCustomAttr,parentIx); if (parent == null) return; parent.AddCustomAttribute(this); type = (Method)buff.GetCodedElement(CIx.CustomAttributeType,typeIx); byteVal = buff.GetBlob(valIx); }
internal override void Resolve(PEReader buff) { implementation = buff.GetCodedElement(CIx.Implementation,implIx); while (implementation is ExternClass) implementation = ((ExternClass)implementation).implementation; ((ModuleFile)implementation).fileModule.AddExternClass(this); }
internal static DeclSecurity FindSecurity(PEReader buff, MetaDataElement paren, uint codedParIx) { buff.SetElementPosition(MDTable.DeclSecurity,0); for (int i=0; i < buff.GetTableSize(MDTable.DeclSecurity); i++) { uint act = buff.ReadUInt16(); if (buff.GetCodedIndex(CIx.HasDeclSecurity) == codedParIx) return new DeclSecurity(paren,(SecurityAction)act,buff.GetBlob()); uint junk = buff.GetBlobIx(); } return null; }
internal void AddToTable(MDTable tableIx, MetaDataElement elem) { // updates Row field of the element // Console.WriteLine("Adding element to table " + (uint)tableIx); ArrayList table = GetTable(tableIx); if (table.Contains(elem)) { Console.Out.WriteLine("ERROR - element already in table " + tableIx); return; } elem.Row = (uint)table.Count + 1; table.Add(elem); }
/*-------------------- Constructors ---------------------------------*/ internal FieldMarshal(MetaDataElement field, NativeType nType) { this.field = field; this.nt = nType; sortTable = true; tabIx = MDTable.FieldMarshal; }
internal void SetEntryPoint(MetaDataElement ep) { entryPoint = ep; }
internal GenericParam(string name, MetaDataElement parent, int index) : base(VAR) { this.name = name; this.parent = parent; this.index = (ushort)index; if (parent is Method) typeIndex = MVAR; sortTable = true; tabIx = MDTable.GenericParam; }
internal void WriteCodedIndex(CIx code, MetaDataElement elem, PEWriter output) { uint ix = 0; if (elem != null) { ix = (elem.Row << CIxShiftMap[(uint)code]) | elem.GetCodedIx(code); // Console.WriteLine("coded index = " + ix + " row = " + elem.Row); //} else { // Console.WriteLine("elem for coded index is null"); } if (lgeCIx[(uint)code]) output.Write(ix); else output.Write((ushort)ix); }
internal void CheckParent(MethodDef paren, PEReader buff) { if (paren == buff.GetCodedElement(CIx.TypeOrMethodDef,parentIx)) { parent = paren; paren.InsertGenericParam(this); } }
internal void InsertInTable(MDTable tabIx, uint ix, MetaDataElement elem) { tables[(int)tabIx][ix-1] = elem; }
internal void SetMethParam(Method paren,int ix) { typeIndex = MVAR; parent = paren; index = (ushort)ix; }
internal ManifestResource(PEFile pefile, string name, MetaDataElement fileRef, uint offset, bool isPub) { InitResource(pefile,name,isPub); impl = fileRef; fileOffset = offset; }