/// <summary>
 ///
 /// </summary>
 /// <param name="blockId"></param>
 /// <param name="data"></param>
 /// <returns>True if data completely received, false otherwise</returns>
 public async Task <bool> ReceiveBlock(uint blockId, byte[] data)
 {
     using (await _lockSem.GetDisposable().ConfigureAwait(false))
     {
         if (Status == InMessageStatus.AllBlocksReceived)
         {
             return(false);
         }
         if (blockId >= BlockCount)
         {
             throw new ArgumentOutOfRangeException(
                       MyNameof.GetLocalVarName(() => blockId));
         }
         if (data.Length != ReceivedDataChunkSizes[(int)blockId])
         {
             throw new ArgumentOutOfRangeException("data");
         }
         if (BlocksReceived[(int)blockId])
         {
             return(false);
         }
         ReceivedData[(int)blockId] = new byte[ReceivedDataChunkSizes[(int)blockId]];
         Array.Copy(
             data,
             ReceivedData[(int)blockId],
             data.Length
             );
         BlocksReceived[(int)blockId] = true;
         BlocksReceivedCount++;
         if (Status == InMessageStatus.HandshakeReceived)
         {
             Status = InMessageStatus.FirstBlockReceived;
         }
         if (BlocksReceivedCount == BlockCount)
         {
             Status = InMessageStatus.AllBlocksReceived;
             return(true);
         }
         return(false);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="blockId"></param>
 /// <param name="data"></param>
 /// <returns>True if data completely received, false otherwise</returns>
 public async Task<bool> ReceiveBlock(uint blockId, byte[] data)
 {
     using (await _lockSem.GetDisposable().ConfigureAwait(false))
     {
         if (Status == InMessageStatus.AllBlocksReceived)
             return false;
         if (blockId >= BlockCount)
             throw new ArgumentOutOfRangeException(
                 MyNameof.GetLocalVarName(() => blockId));
         if (data.Length != ReceivedDataChunkSizes[(int)blockId])
             throw new ArgumentOutOfRangeException("data");
         if (BlocksReceived[(int)blockId])
             return false;
         ReceivedData[(int)blockId] = new byte[ReceivedDataChunkSizes[(int)blockId]];
         Array.Copy(
             data,
             ReceivedData[(int)blockId],
             data.Length
         );
         BlocksReceived[(int)blockId] = true;
         BlocksReceivedCount++;
         if (Status == InMessageStatus.HandshakeReceived)
             Status = InMessageStatus.FirstBlockReceived;
         if (BlocksReceivedCount == BlockCount)
         {
             Status = InMessageStatus.AllBlocksReceived;
             return true;
         }
         return false;
     }
 }