private void Reset() { ServerInfo = new ServerInfo(); _tcp = new TcpClient(); _cachedUsers = new ConcurrentDictionary <string, User>(); Users = new ReadOnlyDictionary <string, User>(_cachedUsers); _cachedChannels = new ConcurrentDictionary <string, Channel>(); Channels = new ReadOnlyDictionary <string, Channel>(_cachedChannels); _timeout = new TimeoutService(this); _tokenSource = new CancellationTokenSource(); new Thread(() => _timeout.Run(_tokenSource.Token)).Start(); }
/// <summary> /// Creates a new <see cref="IRCClient"/>. /// </summary> public IRCClient(IRCConfiguration configuration) { DataReceived += OnDataReceived; _configuration = new IRCConfiguration(configuration); ServerInfo = new ServerInfo(); _tcp = new TcpClient(); _cachedUsers = new ConcurrentDictionary <string, User>(); Users = new ReadOnlyDictionary <string, User>(_cachedUsers); _cachedChannels = new ConcurrentDictionary <string, Channel>(); Channels = new ReadOnlyDictionary <string, Channel>(_cachedChannels); _timeout = new TimeoutService(this); _tokenSource = new CancellationTokenSource(); new Thread(() => _timeout.Run(_tokenSource.Token)).Start(); }