Exemple #1
0
        internal static W3dEmitter Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dEmitter();

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

                    case W3dChunkType.W3D_CHUNK_EMITTER_USER_DATA:
                        result.UserData = W3dEmitterUserData.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_INFO:
                        result.Info = W3dEmitterInfo.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_INFOV2:
                        result.InfoV2 = W3dEmitterInfoV2.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_PROPS:
                        result.Properties = W3dEmitterProperties.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES:
                        result.RotationKeyframes = W3dEmitterRotationKeyframes.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES:
                        result.FrameKeyframes = W3dEmitterFrameKeyframes.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_LINE_PROPERTIES:
                        result.LineProperties = W3dEmitterLineProperties.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES:
                        result.BlurTimeKeyframes = W3dEmitterBlurTimeKeyframes.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_EMITTER_EXTRA_INFO:
                        result.ExtraInfo = W3dEmitterExtraInfo.Parse(reader, context);
                        break;

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

                return result;
            }));
        }
Exemple #2
0
        internal static W3dEmitterUserData Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dEmitterUserData
                {
                    Type = reader.ReadUInt32AsEnum <W3dEmitterUserDataType>(),
                    Value = reader.ReadFixedLengthString((int)reader.ReadUInt32())
                };

                result.NumPadBytes = (uint)(context.CurrentEndPosition - reader.BaseStream.Position);
                reader.ReadBytes((int)result.NumPadBytes);

                return result;
            }));
        }