public void Deserialize(BinaryReader inStream) { int count = inStream.ReadInt32(); _typeCache.Clear(); for (int i = 0; i < count; i++) { DefineType(TypeInfo.Deserialize(inStream)); } }
public StructTypeInfo(string name, TypeKind kind, BinaryReader reader) : base(name, kind, reader) { int fieldCount = reader.ReadInt32(); int currentPos = 0; for (int i = 0; i < fieldCount; i++) { string fieldName = reader.ReadString(); TypeInfo fieldType = TypeInfo.Deserialize(reader); Fields.Add(new FieldInfo() { Name = fieldName, Index = i, FieldOffset = currentPos, FieldType = fieldType }); currentPos += fieldType.SizeOf(); } }
public PointerTypeInfo(string name, TypeKind kind, BinaryReader reader) : base(name, kind, reader) { InnerType = TypeInfo.Deserialize(reader); }
public DynamicArrayTypeInfo(string name, TypeKind kind, BinaryReader reader) : base(name, kind, reader) { ElementType = TypeInfo.Deserialize(reader); }
public StaticArrayTypeInfo(string name, TypeKind kind, BinaryReader reader) : base(name, kind, reader) { ElementType = TypeInfo.Deserialize(reader); ArraySize = reader.ReadUInt32(); }
public VectorTypeInfo(string name, TypeKind kind, BinaryReader reader) : base(name, kind, reader) { InnerType = TypeInfo.Deserialize(reader); ElementCount = reader.ReadUInt32(); }
public ILModule(BinaryReader inStream) { Name = inStream.ReadString(); Types = new TypeRegistry(this); // deserialize module refs int moduleCount = inStream.ReadInt32(); for (int i = 0; i < moduleCount; i++) { ModuleRefs.Add(inStream.ReadString()); } // deserialize type refs int typeCount = inStream.ReadInt32(); for (int i = 0; i < typeCount; i++) { SerializedTypeRef typeRef = new SerializedTypeRef(); typeRef.ModuleID = inStream.ReadInt32(); typeRef.TypeID = inStream.ReadInt32(); typeRef.Ref = inStream.ReadBoolean(); typeRef.Pointer = inStream.ReadInt32(); typeRef.Array = inStream.ReadBoolean(); typeRef.ArraySize = inStream.ReadUInt32(); _typeRefs.Add(typeRef); } // deserialize func refs int funcRefCount = inStream.ReadInt32(); for (int i = 0; i < funcRefCount; i++) { SerializedFuncRef funcRef = new SerializedFuncRef(); funcRef.ModuleID = inStream.ReadInt32(); funcRef.FuncName = inStream.ReadString(); _funcRefs.Add(funcRef); } // deserialize string pool int strCount = inStream.ReadInt32(); for (int i = 0; i < strCount; i++) { StringPool.Add(inStream.ReadString()); } // deserialize types Types.Deserialize(inStream); // deserialize globals int globalCount = inStream.ReadInt32(); for (int i = 0; i < globalCount; i++) { var globalName = inStream.ReadString(); var globalType = TypeInfo.Deserialize(inStream); Globals.Add(new GlobalVarInfo() { Name = globalName, ID = Globals.Count, Type = globalType }); } int funcImageSize = inStream.ReadInt32(); _funcImage = inStream.ReadBytes(funcImageSize); }