public DataBlockManager(INetworkingClient client) { Client = client; BlockEventManager = new BlockEventManager(Client); BlockEventManager.RegisterEvents(); SendBlockQueue = new ConcurrentQueue <IBlockEvent>(); Task.Factory.StartNew(() => Update()); }
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); } } }