/// <summary> /// Create the FieldRef equivalent to this FieldDef. If one does not /// exist then create it. /// </summary> /// <returns>FieldRef for this FieldDef</returns> public FieldRef MakeRefOf() { if (refOf != null) { return(refOf); } ClassRef parRef = ((ClassDef)parent).MakeRefOf(); refOf = parRef.GetField(name); if (refOf == null) { Type refType; if (type is ClassDef) { refType = ((ClassDef)type).MakeRefOf(); } else { refType = type; } refOf = new FieldRef(parRef, name, refType); refOf.defOf = this; } return(refOf); }
internal static void GetFieldRefs(PEReader buff, uint num, ClassRef parent) { for (int i = 0; i < num; i++) { uint flags = buff.ReadUInt16(); string name = buff.GetString(); uint sigIx = buff.GetBlobIx(); if ((flags & (uint)FieldAttr.Public) == (uint)FieldAttr.Public) { if (parent.GetField(name) == null) { //Console.WriteLine(parent.NameString()); buff.currentClassScope = parent; FieldRef fRef = new FieldRef(parent, name, buff.GetFieldType(sigIx)); buff.currentClassScope = null; parent.AddToFieldList(fRef); } } } }
/// <summary> /// Fetch the FieldRef descriptor for the field "name" in this module, /// if one exists /// </summary> /// <param name="name">field name</param> /// <returns>FieldRef descriptor for "name" or null</returns> public FieldRef GetField(string name) { Contract.Requires(name != null); return(defaultClass.GetField(name)); }