/// <summary>t /// Removes the chunk from the file /// </summary> /// <param name="chunkHash">Chunk to be added</param> /// <returns>Rather the chunk was removed</returns> public bool RemoveChunk(string chunkHash) { P2PChunk correctChunk = null; foreach (P2PChunk currentChunkInListOfChunks in this.chunks) { if (currentChunkInListOfChunks.hash.Equals(chunkHash)) { correctChunk = currentChunkInListOfChunks; break; } } if (correctChunk != null) { this.chunks.Remove(correctChunk); return(true); } return(false); }
/// <summary> /// Adds a chunk to the file /// </summary> /// <param name="chunk">Chunk to be added to the file</param> public void AddChunk(P2PChunk chunk) { chunk.originalHash = this.hash; this.chunks.Add(chunk); }