Example #1
0
 internal override void Resolve(PEReader buff)
 {
     parent = (ClassDef)buff.GetElement(MDTable.TypeDef, parentIx);
     if (parent != null)
     {
         parent.Layout = this;
     }
 }
Example #2
0
 private void DoPars(PEReader buff, bool resolvePars)
 {
     if (sig == null)
     {
         sig = buff.ReadMethSig(this, sigIx);
     }
     sig.name = name;
     parList  = new Param[sig.numPars];
     if (parIx > buff.GetTableSize(MDTable.Param))
     {
         // EXPERIMENTAL kjg 19 November 2007
         //  It is actually allowed that a method def does not
         //  have corresponding Param metadata, provided the
         //  parameter types may be constructed from the sig.
         for (uint i = 0; i < sig.numPars; i++)
         {
             parList[i] = Param.DefaultParam();
             parList[i].SetParType(sig.parTypes[i]);
         }
     }
     else
     {
         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]);
             }
         }
     }
 }
Example #3
0
 internal sealed override void Resolve(PEReader buff)
 {
     field = (FieldDef)buff.GetElement(MDTable.Field, fieldIx);
     field.AddDataValue(buff.GetDataConstant(rva, field.GetFieldType()));
 }
Example #4
0
 internal sealed override void Resolve(PEReader buff)
 {
     field = (FieldDef)buff.GetElement(MDTable.Field, fieldIx);
     field.SetOffset(offset);
 }
Example #5
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);
     }
 }
Example #6
0
 internal static void Read(PEReader buff, TableRow[] maps, MDTable tab)
 {
     Contract.Requires(maps != null);
     Contract.Requires(buff != null);
     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;
         }
     }
 }
Example #7
0
 internal override void Resolve(PEReader buff)
 {
     meth = (MethodDef)buff.GetElement(MDTable.Method, methIx);
     eventOrProp = (Feature)buff.GetCodedElement(CIx.HasSemantics, assocIx);
     eventOrProp.AddMethod(this);
 }
Example #8
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;
 }