Exemple #1
0
 /// <summary>
 ///     Creates a copy of the specified <see cref="IRCConfiguration"/>.
 /// </summary>
 /// <param name="copy">Instance of <see cref="IRCConfiguration"/> to copy.</param>
 public IRCConfiguration(IRCConfiguration copy)
 {
     Hostname        = copy.Hostname;
     Port            = copy.Port;
     Username        = copy.Username;
     Identd          = copy.Identd;
     RealName        = copy.RealName;
     Password        = copy.Password;
     ThrowsOnTimeout = copy.ThrowsOnTimeout;
 }
Exemple #2
0
        /// <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();
        }