/// <summary> /// Reads <see cref="LabelRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static LabelRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new LabelRecord { Kind = kind, Mode = (LabelType)reader.ReadUshort(), }); }
/// <summary> /// Reads <see cref="ListContinuationRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ListContinuationRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new ListContinuationRecord { Kind = kind, Padding = reader.ReadUshort(), ContinuationIndex = TypeIndex.Read(reader), }); }
/// <summary> /// Reads <see cref="StringIdRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static StringIdRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new StringIdRecord { Kind = kind, Id = TypeIndex.Read(reader), String = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="ModifierRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ModifierRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new ModifierRecord { Kind = kind, ModifiedType = TypeIndex.Read(reader), Modifiers = (ModifierOptions)reader.ReadUshort(), }); }
/// <summary> /// Reads <see cref="VirtualFunctionPointerRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static VirtualFunctionPointerRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new VirtualFunctionPointerRecord { Kind = kind, Padding = reader.ReadUshort(), Type = TypeIndex.Read(reader), }); }
/// <summary> /// Reads <see cref="EnumeratorRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static EnumeratorRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new EnumeratorRecord { Kind = kind, Attritubes = MemberAttributes.Read(reader), Value = reader.ReadEncodedInteger(), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="FunctionIdRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static FunctionIdRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new FunctionIdRecord { Kind = kind, ParentScope = TypeIndex.Read(reader), FunctionType = TypeIndex.Read(reader), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="BaseClassRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static BaseClassRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new BaseClassRecord { Kind = kind, Attributes = MemberAttributes.Read(reader), Type = TypeIndex.Read(reader), Offset = Convert.ToUInt64(reader.ReadEncodedConstant()), }); }
/// <summary> /// Reads <see cref="BitFieldRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static BitFieldRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new BitFieldRecord { Kind = kind, Type = TypeIndex.Read(reader), BitSize = reader.ReadByte(), BitOffset = reader.ReadByte(), }); }
/// <summary> /// Reads <see cref="OverloadedMethodRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static OverloadedMethodRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new OverloadedMethodRecord { Kind = kind, OverloadsCount = reader.ReadUshort(), MethodList = TypeIndex.Read(reader), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="NestedTypeRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static NestedTypeRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new NestedTypeRecord { Kind = kind, Padding = reader.ReadUshort(), Type = TypeIndex.Read(reader), Name = reader.ReadCString(), }); }
/// <summary> /// Gets all type indexes for the specified type record kind. /// </summary> /// <param name="kind">Type record kind.</param> public IEnumerable <TypeIndex> GetIndexes(TypeLeafKind kind) { for (int i = 0; i < references.Count; i++) { if (references[i].Kind == kind) { yield return(TypeIndex.FromArrayIndex(i)); } } }
/// <summary> /// Reads <see cref="MemberFunctionIdRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static MemberFunctionIdRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new MemberFunctionIdRecord { Kind = kind, ClassType = TypeIndex.Read(reader), FunctionType = TypeIndex.Read(reader), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="StaticDataMemberRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static StaticDataMemberRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new StaticDataMemberRecord { Kind = kind, Attributes = MemberAttributes.Read(reader), Type = TypeIndex.Read(reader), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="ArrayRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ArrayRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new ArrayRecord { Kind = kind, ElementType = TypeIndex.Read(reader), IndexType = TypeIndex.Read(reader), Size = Convert.ToUInt64(reader.ReadEncodedInteger()), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="UdtModuleSourceLineRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static UdtModuleSourceLineRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new UdtModuleSourceLineRecord { Kind = kind, UDT = TypeIndex.Read(reader), SourceFile = TypeIndex.Read(reader), LineNumber = reader.ReadUint(), Module = reader.ReadUshort(), }); }
/// <summary> /// Reads <see cref="DataMemberRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static DataMemberRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new DataMemberRecord { Kind = kind, Attributes = MemberAttributes.Read(reader), Type = TypeIndex.Read(reader), FieldOffset = Convert.ToUInt64(reader.ReadEncodedInteger()), Name = reader.ReadCString(), }); }
/// <summary> /// Reads <see cref="VirtualBaseClassRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static VirtualBaseClassRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new VirtualBaseClassRecord { Kind = kind, Attributes = MemberAttributes.Read(reader), BaseType = TypeIndex.Read(reader), VirtualBasePointerType = TypeIndex.Read(reader), VirtualBasePointerOffset = Convert.ToUInt64(reader.ReadEncodedInteger()), VirtualTableIndex = Convert.ToUInt64(reader.ReadEncodedInteger()), }); }
/// <summary> /// Reads <see cref="ProcedureRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ProcedureRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new ProcedureRecord { Kind = kind, ReturnType = TypeIndex.Read(reader), CallingConvention = (CallingConvention)reader.ReadByte(), Options = (FunctionOptions)reader.ReadByte(), ParameterCount = reader.ReadUshort(), ArgumentList = TypeIndex.Read(reader), }); }
/// <summary> /// Gets all <see cref="TypeRecord"/> entries associated with the specified <see cref="TypeLeafKind"/>. /// </summary> /// <param name="kind">Type record kind.</param> private TypeRecord[] GetTypesByKind(TypeLeafKind kind) { List <TypeRecord> records = new List <TypeRecord>(); for (int i = 0; i < references.Count; i++) { if (references[i].Kind == kind) { records.Add(typesCache[i]); } } return(records.ToArray()); }
/// <summary> /// Reads <see cref="MemberFunctionRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static MemberFunctionRecord Read(IBinaryReader reader, TypeLeafKind kind) { return(new MemberFunctionRecord { Kind = kind, ReturnType = TypeIndex.Read(reader), ClassType = TypeIndex.Read(reader), ThisType = TypeIndex.Read(reader), CallingConvention = (CallingConvention)reader.ReadByte(), Options = (FunctionOptions)reader.ReadByte(), ParameterCount = reader.ReadUshort(), ArgumentList = TypeIndex.Read(reader), ThisPointerAdjustment = reader.ReadInt(), }); }
/// <summary> /// Reads <see cref="PointerRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static PointerRecord Read(IBinaryReader reader, TypeLeafKind kind) { PointerRecord record = new PointerRecord { Kind = kind, ReferentType = TypeIndex.Read(reader), Attribute = reader.ReadUint(), }; if (record.IsPointerToMember) { record.MemberInfo = MemberPointerInfo.Read(reader); } return(record); }
/// <summary> /// Reads <see cref="MethodOverloadListRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> /// <param name="dataLength">Record data length.</param> public static MethodOverloadListRecord Read(IBinaryReader reader, TypeLeafKind kind, uint dataLength) { long endPosition = reader.Position + dataLength; List <OneMethodRecord> methods = new List <OneMethodRecord>(); while (reader.Position < endPosition) { methods.Add(OneMethodRecord.Read(reader, TypeLeafKind.LF_ONEMETHOD, isFromOverloadedList: true)); } return(new MethodOverloadListRecord { Kind = kind, Methods = methods, }); }
/// <summary> /// Reads <see cref="BuildInfoRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static BuildInfoRecord Read(IBinaryReader reader, TypeLeafKind kind) { uint count = reader.ReadUshort(); TypeIndex[] indexes = new TypeIndex[count]; for (int i = 0; i < indexes.Length; i++) { indexes[i] = TypeIndex.Read(reader); } return(new BuildInfoRecord { Kind = kind, Indexes = indexes, }); }
/// <summary> /// Reads <see cref="ArgumentListRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ArgumentListRecord Read(IBinaryReader reader, TypeLeafKind kind) { uint count = reader.ReadUint(); TypeIndex[] arguments = new TypeIndex[count]; for (int i = 0; i < arguments.Length; i++) { arguments[i] = TypeIndex.Read(reader); } return(new ArgumentListRecord { Kind = kind, Arguments = arguments, }); }
/// <summary> /// Reads <see cref="ModifierRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static StringListRecord Read(IBinaryReader reader, TypeLeafKind kind) { uint count = reader.ReadUint(); TypeIndex[] strings = new TypeIndex[count]; for (int i = 0; i < strings.Length; i++) { strings[i] = TypeIndex.Read(reader); } return(new StringListRecord { Kind = kind, StringIndices = strings, }); }
/// <summary> /// Reads <see cref="EnumRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static EnumRecord Read(IBinaryReader reader, TypeLeafKind kind) { EnumRecord record = new EnumRecord { Kind = kind, MemberCount = reader.ReadUshort(), Options = (ClassOptions)reader.ReadUshort(), UnderlyingType = TypeIndex.Read(reader), FieldList = TypeIndex.Read(reader), Name = reader.ReadCString(), }; if (record.HasUniqueName) { record.UniqueName = reader.ReadCString(); } return(record); }
/// <summary> /// Reads <see cref="UnionRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static UnionRecord Read(IBinaryReader reader, TypeLeafKind kind) { UnionRecord record = new UnionRecord { Kind = kind, MemberCount = reader.ReadUshort(), Options = (ClassOptions)reader.ReadUshort(), FieldList = TypeIndex.Read(reader), Size = Convert.ToUInt64(reader.ReadEncodedInteger()), Name = reader.ReadCString(), }; if (record.HasUniqueName) { record.UniqueName = reader.ReadCString(); } return(record); }
/// <summary> /// Reads <see cref="ClassRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> public static ClassRecord Read(IBinaryReader reader, TypeLeafKind kind) { ClassRecord record = new ClassRecord { Kind = kind, MemberCount = reader.ReadUshort(), Options = (ClassOptions)reader.ReadUshort(), FieldList = TypeIndex.Read(reader), DerivationList = TypeIndex.Read(reader), VirtualTableShape = TypeIndex.Read(reader), Size = Convert.ToUInt64(reader.ReadEncodedConstant()), Name = reader.ReadCString(), }; if (record.HasUniqueName) { record.UniqueName = reader.ReadCString(); } return(record); }
/// <summary> /// Reads <see cref="OneMethodRecord"/> from the stream. /// </summary> /// <param name="reader">Stream binary reader.</param> /// <param name="kind">Type record kind.</param> /// <param name="isFromOverloadedList"><c>true</c> if we are reading this from <see cref="MethodOverloadListRecord"/>.</param> public static OneMethodRecord Read(IBinaryReader reader, TypeLeafKind kind, bool isFromOverloadedList = false) { var record = new OneMethodRecord { Kind = kind, Attributes = MemberAttributes.Read(reader) }; if (isFromOverloadedList) { reader.Move(2); // 2 = sizeof(ushort) } record.Type = TypeIndex.Read(reader); record.VFTableOffset = record.Attributes.IsIntroducedVirtual ? reader.ReadInt() : -1; if (!isFromOverloadedList) { record.Name = reader.ReadCString(); } return(record); }