示例#1
0
 public void addChunk(ChunksGroup chunk)
 {
     if (fileName != chunk.fileName)
     {
         throw new ArgumentException("Intent to add chunk to diffrent file");
     }
     if (chunk.chunkId < 0)
     {
         throw new ArgumentException("Chunk has negative id!");
     }
     if (chunks.Contains(chunk))
     {
         foreach (var c in chunks)
         {
             if (c.Equals(chunk))
             {
                 c.merge(chunk);
             }
         }
     }
     else
     {
         chunks.Add(chunk);
     }
 }
示例#2
0
 public void merge(ChunksGroup chunk)
 {
     if (!chunk.Equals(this))
     {
         throw new ArgumentException("Merging diffrent chunks!");
     }
     if (chunk.sizeInBytes != sizeInBytes)
     {
         throw new ArgumentException("Merging chunks error: the same name and id, but diffrent SIZE!");
     }
     storedInWorkers.UnionWith(chunk.storedInWorkers);
 }
示例#3
0
        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            ChunksGroup p = obj as ChunksGroup;

            if ((System.Object)p == null)
            {
                return(false);
            }
            return((fileName == p.fileName) && (chunkId == p.chunkId));
        }
示例#4
0
 public FileHeader(ChunksGroup chunk)
 {
     fileName = chunk.fileName;
     chunks   = new HashSet <ChunksGroup> ();
     chunks.Add(chunk);
 }