public string GetName(TypeData t) { string n = "???"; if (t.Token == 0) { n = this.GetName(t.Element); } else { TableBase tb = this.GetTable(t.Token); if (tb is TypeDefTable) { n = this.GetName(tb as TypeDefTable); } else if (tb is TypeRefTable) { n = this.GetName(tb as TypeRefTable); } } if (t.Option == ELEMENT_TYPE.SZARRAY) n += "[]"; return n; }
public void GetSignatureInfo(StringBuilder sb, int offset, TypeData type, string comment) { sb.AppendFormat("{0:X8}:", offset); int len = 16; for (int i = 0; i < type.Size; i++) { if (i > 0) { sb.Append(' '); len--; } sb.AppendFormat("{0:X2}", this.Data[offset]); offset++; len -= 2; } for (int i = 0; i < len; i++) sb.Append(' '); if (comment != null && comment.Length > 0) { sb.Append(' '); sb.Append(comment); } if (type.Option != ELEMENT_TYPE.END) { sb.AppendFormat(" ELEMENT_TYPE_{0},", type.Option); } if (type.Token == 0) { sb.AppendFormat(" ELEMENT_TYPE_{0}\r\n", type.Element); } else { sb.AppendFormat(" {0}\r\n", this.GetInfo(type.Token)); } }
private void ReadSignature() { int sign; if (this.table is MethodDefTable) { sign =(this.table as MethodDefTable).Signature; } else if (this.table is MemberRefTable) { sign =(this.table as MemberRefTable).Signature; if (this.table.Children == null) { this.table.Children = new ArrayList[] { new ArrayList() } ; } } else { return; } int ad = this.data.idxm.BlobOffset + sign; DoubleInt dataSize = Util.GetDataSize(this.data.data, ad); ad += dataSize.A; this.SignatureFlags = this.data.data[ad++]; if (this.IsField) { this.RetType = this.data.idxm.ReadType(ad); return; } DoubleInt count = Util.GetDataSize(this.data.data, ad); this.ParamCount = count.B; ad += count.A; this.RetType = this.data.idxm.ReadType(ad); ad += this.RetType.Size; for (int i = 0; i < this.ParamCount; i++) { TypeData ds = this.data.idxm.ReadType(ad); if (table is MethodDefTable) { (this.table.Children[0][i] as ParamTable).Tag = ds; } else { this.table.Children[0].Add(ds); } ad += ds.Size; } }