示例#1
0
文件: P2PFile.cs 项目: tlorentzen/P2
        /// <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);
        }
示例#2
0
文件: P2PFile.cs 项目: tlorentzen/P2
 /// <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);
 }