public PalBot(IPacketSerializer packetSerializer, IPacketDeserializer packetDeserializer, IPacketMapper packetMapper, IPacketWatcher packetWatcher, IPacketTemplates packetTemplates, IZLibCompression compression, IAuthenticationUtility authentication, IPacketHandlerHub handlerHub, ISubProfiling subProfiling, IPluginManager pluginManager, IRoleManager roleManager, IBroadcastUtility broadcast) { this.packetSerializer = packetSerializer; this.packetDeserializer = packetDeserializer; this.packetMapper = packetMapper; this.packetWatcher = packetWatcher; this.packetTemplates = packetTemplates; this.compression = compression; this.authentication = authentication; this.handlerHub = handlerHub; this.SubProfiling = subProfiling; this.pluginManager = pluginManager; this.RoleManager = roleManager; this.On = broadcast; this.broadcast = (BroadcastUtility)broadcast; _client = new NetworkClient(DefaultHost, DefaultPort); _client.OnDisconnected += (c) => _disconnected?.Invoke(); _client.OnDisconnected += (c) => ((BroadcastUtility)On).BroadcastDisconnected(); _client.OnException += (e, n) => _error?.Invoke(e, n); _client.OnException += (e, n) => ((BroadcastUtility)On).BroadcastException(e, n); _client.OnDataReceived += (c, b) => this.packetDeserializer.ReadPacket(c, b); On.Exception += (e, n) => _error?.Invoke(e, n); On.Message += (b, m) => _message?.Invoke(b, m); this.broadcast.PacketParsed += (c, p) => PacketReceived(p); }
protected AbstractReciver(IReciveTransmissionProtocol transmissionProtocol, IPacketDeserializer <T> deserializer) { _transmissionProtocol = transmissionProtocol; _deserializer = deserializer; }
public MockReciver(IReciveTransmissionProtocol transmissionProtocol, IPacketDeserializer <int> deserializer) : base(transmissionProtocol, deserializer) { }
public void Setup() { _protocol = Substitute.For <IReciveTransmissionProtocol>(); _parser = Substitute.For <IPacketDeserializer <int> >(); _reciver = new MockReciver(_protocol, _parser); }
public RecordedInputReciver(IReciveTransmissionProtocol transmissionProtocol, IPacketDeserializer <RecordedInput> deserializer) : base(transmissionProtocol, deserializer) { }
public TestMessagePacketDeserializer() { _customTypeDtoDeserializer = new CustomTypeDtoPacketDeserializer(); _stringsObjectDtoDeserializer = new StringsObjectDtoPacketDeserializer(); }
protected ClientHandlerDeserializer(MhfServer server, IPacketDeserializer <T> deserializer) : base(server) { _deserializer = deserializer; }