public AssetAssemblerFile() { Header = new Stream2ContainerHeader(); AllocatorTypes = new Dictionary <byte, string>(); PrimitiveTypes = new Dictionary <byte, string>(); ContainerTypes = new Dictionary <byte, string>(); Containers = new List <IContainer>(); }
public AssetAssemblerFile(Stream stream) { Header = stream.ReadStruct <Stream2ContainerHeader>(); AllocatorTypes = new Dictionary <byte, string>(); PrimitiveTypes = new Dictionary <byte, string>(); ContainerTypes = new Dictionary <byte, string>(); Containers = new List <IContainer>(); uint allocatorTypeCount = stream.ReadUInt32(); for (uint i = 0; i < allocatorTypeCount; i++) { UInt16 stringLength = stream.ReadUInt16(); string name = stream.ReadAsciiString(stringLength); byte id = stream.ReadUInt8(); AllocatorTypes.Add(id, name); } uint primitiveTypeCount = stream.ReadUInt32(); for (uint i = 0; i < primitiveTypeCount; i++) { UInt16 stringLength = stream.ReadUInt16(); string name = stream.ReadAsciiString(stringLength); byte id = stream.ReadUInt8(); PrimitiveTypes.Add(id, name); } uint containerTypeCount = stream.ReadUInt32(); for (uint i = 0; i < containerTypeCount; i++) { UInt16 stringLength = stream.ReadUInt16(); string name = stream.ReadAsciiString(stringLength); byte id = stream.ReadUInt8(); ContainerTypes.Add(id, name); } for (uint i = 0; i < Header.NumContainers; i++) { Container container = new Container(stream); Containers.Add(container); } }