GetElement() private method

private GetElement ( MDTable tabIx, uint ix ) : MetaDataElement
tabIx MDTable
ix uint
return MetaDataElement
Ejemplo n.º 1
0
 internal override void Resolve(PEReader buff)
 {
     theClass = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx);
     theInterface = (Class)buff.GetCodedElement(CIx.TypeDefOrRef,interfacesIndex);
     theClass.AddImplementedInterface(this);
 }
Ejemplo n.º 2
0
 internal override void Resolve(PEReader buff)
 {
     parent = (GenericParam)buff.GetElement(MDTable.GenericParam,parentIx);
     parent.AddConstraint((Class)buff.GetCodedElement(CIx.TypeDefOrRef,constraintIx));
 }
Ejemplo n.º 3
0
 internal override void Resolve(PEReader buff)
 {
     meth = (MethodDef)buff.GetCodedElement(CIx.MemberForwarded,memForIndex);
     importScope = (ModuleRef)buff.GetElement(MDTable.ModuleRef,scopeIx);
     if (meth != null) meth.AddPInvokeInfo(this);
 }
Ejemplo n.º 4
0
 internal override sealed void Resolve(PEReader buff)
 {
     field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx);
     field.SetOffset(offset);
 }
Ejemplo n.º 5
0
 internal override sealed void Resolve(PEReader buff)
 {
     field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx);
     field.AddDataValue(buff.GetDataConstant(rva,field.GetFieldType()));
 }
Ejemplo n.º 6
0
 internal override void Resolve(PEReader buff)
 {
     parent = (ClassDef)buff.GetElement(MDTable.TypeDef,parentIx);
     if (parent != null) parent.Layout = this;
 }
Ejemplo n.º 7
0
 internal override void Resolve(PEReader buff)
 {
     buff.currentClassScope = this;
     superType = (Class)buff.GetCodedElement(CIx.TypeDefOrRef,extendsIx);
     if ((superType != null) && superType.isValueType())
         typeIndex = (byte)ElementType.ValueType;
     for (int i=0; fieldIx < fieldEndIx; i++, fieldIx++) {
         FieldDef field = (FieldDef)buff.GetElement(MDTable.Field,fieldIx);
         field.SetParent(this);
         fields.Add(field);
     }
     for (int i=0; methodIx < methodEndIx; i++, methodIx++) {
         MethodDef meth = (MethodDef)buff.GetElement(MDTable.Method,methodIx);
         if (Diag.DiagOn) Console.WriteLine("Adding method " + meth.Name() + " to class " + name);
         meth.SetParent(this);
         methods.Add(meth);
     }
     buff.currentClassScope = null;
 }
Ejemplo n.º 8
0
 internal override void Resolve(PEReader buff)
 {
     meth = (MethodDef)buff.GetElement(MDTable.Method,methIx);
     eventOrProp = (Feature)buff.GetCodedElement(CIx.HasSemantics,assocIx);
     eventOrProp.AddMethod(this);
 }
Ejemplo n.º 9
0
 internal override void Resolve(PEReader buff)
 {
     body = (Method)buff.GetCodedElement(CIx.MethodDefOrRef,methBodyIx);
     header = (Method)buff.GetCodedElement(CIx.MethodDefOrRef,methDeclIx);
     parent = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx);
     parent.AddMethodImpl(this);
     resolved = true;
 }
Ejemplo n.º 10
0
        /*

            internal static void GetMemberNames(PEReader buff, uint start, uint end, ArrayList membs) {
              buff.SetElementPosition(MDTable.Field,start);
              for (int i=0; i < (end - start); i++, insIx++) {
                uint junk = buff.ReadUInt32();
                junk = buff.ReadUInt16();
                uint flags = buff.ReadUInt16();
                if ((flags & MethAttr.Public) == MethAttr.Public)
                  membs.Add(new MemberIndex(buff,buff.GetString(),buff.GetBlobIx(),false));
                else {
                  junk = buff.GetStringIx();
                  junk = buff.GetBlobIx();
                }
                junk = buff.GetIndex(MDTable.Param);
              }
            }

        */
        /*    internal static MethSig[] GetMethSigs(PEReader buff, int num) {
          MethSig[] meths = new MethSig[num];
          for (int i=0; i < num; i++) {
            uint junk = buff.ReadUInt32();
            junk = buff.ReadUInt16();
            junk = buff.ReadUInt16();
            string mName = new MethSig(buff.GetString());
            meths[i] = buff.ReadMethSig(buff.GetBlobIx());
            junk = buff.GetIndex(MDTable.Param);
          }
        }
        */
        private void DoPars(PEReader buff, bool resolvePars)
        {
            if (sig == null) sig = buff.ReadMethSig(this,sigIx);
            sig.name = name;
            parList = new Param[sig.numPars];
            for (uint i=0; i < sig.numPars; i++) {
                parList[i] = (Param)buff.GetElement(MDTable.Param,i+parIx);
                if (resolvePars) parList[i].Resolve(buff,i+parIx,sig.parTypes[i]);
                else parList[i].SetParType(sig.parTypes[i]);
            }
            //parsDone = true;
        }
Ejemplo n.º 11
0
 internal override void Resolve(PEReader buff)
 {
     theClass = (ClassDef)buff.GetElement(MDTable.TypeDef,classIx);
     if (tabIx == MDTable.EventMap) {
         for (uint i=elemIx; i < endIx; i++)
             theClass.AddEvent((Event)buff.GetElement(MDTable.Event,i));
     } else if (tabIx == MDTable.PropertyMap) {
         for (uint i=elemIx; i < endIx; i++)
             theClass.AddProperty((Property)buff.GetElement(MDTable.Property,i));
     } else { // must be nested class -- already done
         //ClassDef parent = (ClassDef)buff.GetElement(MDTable.TypeDef,elemIx);
         //parent.MakeNested(theClass);
     }
 }
Ejemplo n.º 12
0
 internal static void Read(PEReader buff, TableRow[] maps, MDTable tab)
 {
     if (tab == MDTable.NestedClass) {
         for (int i=0; i < maps.Length; i++) {
             //maps[i] = new MapElem(buff,tab);
             uint nestClassIx = buff.GetIndex(MDTable.TypeDef);
             uint enclClassIx = buff.GetIndex(MDTable.TypeDef);
             ClassDef parent = (ClassDef)buff.GetElement(MDTable.TypeDef,enclClassIx);
             ClassDef nestClass = ((ClassDef)buff.GetElement(MDTable.TypeDef,nestClassIx)).MakeNestedClass(parent);
             buff.InsertInTable(MDTable.TypeDef,nestClass.Row,nestClass);
         }
     } else { // event or property map
         MapElem prev = new MapElem(buff,tab);
         maps[0] = prev;
         for (int i=1; i < maps.Length; i++) {
             maps[i] = new MapElem(buff,tab);
             prev.endIx = ((MapElem)maps[i]).elemIx;
             prev = (MapElem)maps[i];
         }
         switch (tab) {
             case MDTable.PropertyMap:
                 prev.endIx = buff.GetTableSize(MDTable.Property) + 1;
                 break;
             case MDTable.EventMap:
                 prev.endIx = buff.GetTableSize(MDTable.Event) + 1;
                 break;
             default:
                 prev.endIx = buff.GetTableSize(tab)+1;
                 break;
         }
     }
 }