Ejemplo n.º 1
0
        internal static W3dSoundRObj Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dSoundRObj();

                ParseChunks(reader, context.CurrentEndPosition, chunkType =>
                {
                    switch (chunkType)
                    {
                    case W3dChunkType.W3D_CHUNK_SOUNDROBJ_HEADER:
                        result.Header = W3dSoundRObjHeader.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_SOUNDROBJ_DEFINITION:
                        result.Definition = W3dSoundRObjDefinition.Parse(reader, context);
                        break;

                    default:
                        throw CreateUnknownChunkException(chunkType);
                    }
                });

                return result;
            }));
        }
Ejemplo n.º 2
0
        internal static W3dSoundRObjHeader Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dSoundRObjHeader
                {
                    Version = reader.ReadUInt32(),
                    Name = reader.ReadFixedLengthString((int)header.ChunkSize - 4)
                };

                return result;
            }));
        }