// Methods public void StoreChunk(ReplayFileChunk chunk) { // Cache the chunk if (loadedChunks.Contains(chunk) == false) { loadedChunks.Add(chunk); } }
/// <summary> /// Create a member clone of this chunk. /// </summary> /// <returns>A cloned version of this chunk</returns> public ReplayFileChunk Clone() { ReplayFileChunk result = new ReplayFileChunk(chunkID); // Store all chunks foreach (ReplaySnapshot snapshot in this) { result.Store(snapshot); } return(result); }
public void ReleaseOldChunks(float currentTimeStamp, ReplayFileEnumReleaseMode mode) { switch (mode) { case ReplayFileEnumReleaseMode.ChunksBefore: { // Process all chunks foreach (ReplayFileChunk chunk in loadedChunks) { // Check if the chunk ends before the current time stamp if (chunk.ChunkEndTime < currentTimeStamp) { // We should remove the chunk soon removeQueue.Enqueue(chunk); } } break; } case ReplayFileEnumReleaseMode.ChunksAfter: { // Process all chunks foreach (ReplayFileChunk chunk in loadedChunks) { // Check if the chunk starts before the current time stamp if (chunk.ChunkStartTime > currentTimeStamp) { // We should remove the chunk soon removeQueue.Enqueue(chunk); } } break; } } // Remove old chunks while (removeQueue.Count > 0) { // Get the ext chunk ReplayFileChunk current = removeQueue.Dequeue(); // Remove the chunk from loaded chunks if (loadedChunks.Contains(current) == true) { loadedChunks.Remove(current); } } }
// Methods public bool Equals(ReplayFileChunk other) { return(chunkID == other.chunkID); }