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; })); }
public static W3dEmitter Parse(BinaryReader reader, uint chunkSize) { return(ParseChunk <W3dEmitter>(reader, chunkSize, (result, header) => { switch (header.ChunkType) { case W3dChunkType.W3D_CHUNK_EMITTER_HEADER: result.Header = W3dEmitterHeader.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_USER_DATA: result.UserData = W3dEmitterUserData.Parse(reader, header.ChunkSize); break; case W3dChunkType.W3D_CHUNK_EMITTER_INFO: result.Info = W3dEmitterInfo.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_INFOV2: result.InfoV2 = W3dEmitterInfoV2.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_PROPS: result.Properties = W3dEmitterProperties.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES: result.RotationKeyframes = W3dEmitterRotationKeyframes.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_FRAME_KEYFRAMES: result.FrameKeyframes = W3dEmitterFrameKeyframes.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_LINE_PROPERTIES: result.LineProperties = W3dEmitterLineProperties.Parse(reader); break; case W3dChunkType.W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES: result.BlurTimeKeyframes = W3dEmitterBlurTimeKeyframes.Parse(reader); break; case (W3dChunkType)1293: // TODO: What is this? reader.ReadBytes((int)header.ChunkSize); break; default: throw CreateUnknownChunkException(header); } })); }