public IEnumerable <KeyValuePair <ChunkPlaybackInfo, IChunk> > GetChunks() { PMCEInfo lastComponent = null; IChunk lastChunk = null; for (int i = 0; i < ChunkedData.Chunks?.Length; i++) { if (ChunkedData?.Chunks[i]?.GetType() == typeof(teEffectChunkComponent)) { if (!(ChunkedData.Chunks[i] is teEffectChunkComponent component)) { continue; } lastComponent = new PMCEInfo { Hardpoint = component.Header.Hardpoint, StartTime = component.StartTime, EndTime = component.Duration }; // if (effect.Hardpoints == null) continue; // if (effect.Hardpoints.Length <= pmce.Data.Index) continue; continue; } ChunkPlaybackInfo playbackInfo = new ChunkPlaybackInfo(lastComponent, lastChunk); yield return(new KeyValuePair <ChunkPlaybackInfo, IChunk>(playbackInfo, ChunkedData.Chunks[i])); lastComponent = null; lastChunk = ChunkedData.Chunks[i]; } }
public IEnumerable <KeyValuePair <ChunkPlaybackInfo, IChunk> > GetChunks() { PMCEInfo lastComponent = null; IChunk lastChunk = null; // TCFE effect = Chunk.GetAllOfType<TCFE>().First().Value; for (int i = 0; i < Chunk.Chunks.Count; i++) { if (Chunk?.Chunks[i]?.GetType() == typeof(EffectChunkComponent)) { EffectChunkComponent pmce = Chunk.Chunks[i] as EffectChunkComponent; if (pmce == null) { continue; } lastComponent = new PMCEInfo { Hardpoint = pmce.Data.Hardpoint, StartTime = pmce.StartTime, EndTime = pmce.EndTime }; // if (effect.Hardpoints == null) continue; // if (effect.Hardpoints.Length <= pmce.Data.Index) continue; continue; } ChunkPlaybackInfo playbackInfo = new ChunkPlaybackInfo(lastComponent, lastChunk); yield return(new KeyValuePair <ChunkPlaybackInfo, IChunk>(playbackInfo, Chunk.Chunks[i])); lastComponent = null; lastChunk = Chunk.Chunks[i]; } }
public ChunkPlaybackInfo(PMCEInfo component, IChunk previousChunk) { if (component != null) { TimeInfo = new ChunkPlaybackTimeInfo { StartTime = component.StartTime, EndTime = component.EndTime }; Hardpoint = component.Hardpoint; } else { Hardpoint = 0; } PreviousChunk = previousChunk; }