Ejemplo n.º 1
0
 public DataBlockManager(INetworkingClient client)
 {
     Client            = client;
     BlockEventManager = new BlockEventManager(Client);
     BlockEventManager.RegisterEvents();
     SendBlockQueue = new ConcurrentQueue <IBlockEvent>();
     Task.Factory.StartNew(() => Update());
 }
Ejemplo n.º 2
0
 public void AddBlock(byte[] block)
 {
     Array.Copy(block, 0, FullDataBlock, DataBlockPosition, block.Length);
     DataBlockPosition += (uint)block.Length;
     if (DataBlockPosition == FullDataBlock.Length)//we got a full block
     {
         var eventInstance = BlockEventManager.Trigger((BlockEventId)DataBlockEventId, new BitStream(FullDataBlock));
         if (BlockReceived != null)
         {
             BlockReceived(eventInstance);
         }
     }
 }