Class used to pass information about the payload arrived from the sender peer.
 /// <summary>
 /// Method having a signature that match the one required by delegate to execute.
 /// This method is used to write the newly arrived chunk to the stream. If the chunk
 /// enables other following chunks to been written to the stream the method itself writes the
 /// other chunks to the stream.
 /// </summary>
 /// <param name="o">ND</param>
 /// <param name="e">Arguments regarding the chunk arrived</param>
 private void writeOnStream(Object o, NextArrivedEventArgs e)
 {
     log.Debug("Writing Chunk " + this.nextChunkToWrite + " to the stream");
     try
     {
         this.writer.Write(e.Payload, 0, e.Payload.Length);
     }
     catch (Exception ex)
     {
         log.Debug(ex.Message);
     }
     log.Debug("Written Chunk " + this.nextChunkToWrite + " to the stream");
     this.nextChunkToWrite++;
     while (this.buffer.ContainsKey(this.nextChunkToWrite) && this.buffer[this.nextChunkToWrite].ActualCondition == BufferChunk.condition.DOWNLOADED)
     {
         log.Debug("Writing Chunk " + this.nextChunkToWrite + " to the stream");
         try
         {
             this.writer.Write(this.buffer[this.nextChunkToWrite].Payload, 0, this.buffer[this.nextChunkToWrite].Payload.Length);
         }
         catch (Exception ex)
         {
             log.Debug(ex.Message);
         }
         log.Debug("Written Chunk " + this.nextChunkToWrite + " to the stream");
         this.nextChunkToWrite++;
     }
 }
 /// <summary>
 /// Method having a signature that match the one required by delegate to execute.
 /// This method is used to write the newly arrived chunk to the stream. If the chunk
 /// enables other following chunks to been written to the stream the method itself writes the
 /// other chunks to the stream.
 /// </summary>
 /// <param name="o">ND</param>
 /// <param name="e">Arguments regarding the chunk arrived</param>
 private void writeOnStream(Object o, NextArrivedEventArgs e)
 {
     log.Debug("Writing Chunk " + this.nextChunkToWrite + " to the stream");
     try
     {
         this.writer.Write(e.Payload, 0, e.Payload.Length);
     }
     catch (Exception ex)
     {
         log.Debug(ex.Message);
     }
     log.Debug("Written Chunk " + this.nextChunkToWrite + " to the stream");
     this.nextChunkToWrite++;
     while (this.buffer.ContainsKey(this.nextChunkToWrite) && this.buffer[this.nextChunkToWrite].ActualCondition == BufferChunk.condition.DOWNLOADED)
     {
         log.Debug("Writing Chunk " + this.nextChunkToWrite + " to the stream");
         try
         {
             this.writer.Write(this.buffer[this.nextChunkToWrite].Payload, 0, this.buffer[this.nextChunkToWrite].Payload.Length);
         }
         catch (Exception ex)
         {
             log.Debug(ex.Message);
         }
         log.Debug("Written Chunk " + this.nextChunkToWrite + " to the stream");
         this.nextChunkToWrite++;
     }
 }