public Client(ITcpClientWrapper client) { _client = client; _messageHandler = MapMessageHandlers(); _userCommandHandler = MapUserCommandHandlers(); _cancellationTokenSource = new CancellationTokenSource(); }
public HttpProcessor(ITcpClientWrapper tcpClient, IStreamFactory streamFactory, Action <string> getHandler, Action <string, IMemoryStreamWrapper, IStreamWriterWrapper> postHandler) { this.tcpClient = tcpClient; this.streamFactory = streamFactory; this.getHandler = getHandler; this.postHandler = postHandler; }
private static void DisconnectUser(ITcpClientWrapper user) { var character = RepositoryManager.CHARACTERS.Values.OfType <PlayerInstance>().FirstOrDefault(x => x.Descriptor.User == user); if (character == null) { var descrip = db.DESCRIPTORS.FirstOrDefault(x => x.User == user); if (descrip == null) { throw new ObjectNotFoundException($"Character not found matching user {user.IpAddress}"); } db.DESCRIPTORS.Remove(descrip); return; } RepositoryManager.CHARACTERS.Delete(character.ID); }
/// <summary> /// Handles disconnections /// </summary> /// <param name="tcpUser"></param> private void DisconnectUser(ITcpClientWrapper tcpUser) { if (!_pendingRepository.Contains(tcpUser.IpAddress) && !_userRepository.Contains(tcpUser.IpAddress)) { Log.InfoFormat("User {0} does not exist.", tcpUser.IpAddress); return; } if (_pendingRepository.Contains(tcpUser.IpAddress)) { _pendingRepository.Delete(tcpUser.IpAddress); } else if (_userRepository.Contains(tcpUser.IpAddress)) { _userRepository.Delete(tcpUser.IpAddress); } else { Log.InfoFormat("User {0} not found.", tcpUser.IpAddress); } }
public GaugeApiConnection(ITcpClientWrapper clientWrapper) : base(clientWrapper) { }
public GaugeConnection(ITcpClientWrapper tcpClientWrapper) : base(tcpClientWrapper) { }
protected AbstractGaugeConnection(ITcpClientWrapper tcpClientWrapper) { TcpClientWrapper = tcpClientWrapper; }
public IHttpProcessor GetHttpProcessor(ITcpClientWrapper tcpClient, IStreamFactory streamFactory, Action <string> getHandler, Action <string, IMemoryStreamWrapper, IStreamWriterWrapper> postHandler) { return(new HttpProcessor(tcpClient, streamFactory, getHandler, postHandler)); }