/// <summary> /// Constructor /// </summary> /// <param name="config">The configuration to use.</param> public IrcConnection(IIrcConfig config, INonDisposableStringParsingQueue parsingQueue, IIrcMac macLayer) { ArgumentChecker.IsNotNull(config, nameof(config)); ArgumentChecker.IsNotNull(parsingQueue, nameof(parsingQueue)); ArgumentChecker.IsNotNull(macLayer, nameof(macLayer)); this.inited = false; this.Config = new ReadOnlyIrcConfig(config); this.IsConnected = false; this.connection = macLayer; this.keepReadingObject = new object(); this.KeepReading = false; this.writerQueue = new EventExecutor(config.Server + " IRC Writer Queue"); this.writerQueue.OnError += this.WriterQueue_OnError; this.ircWriterLock = new object(); this.reconnectAbortEvent = new ManualResetEvent(false); this.eventScheduler = new EventScheduler(); this.parsingQueue = parsingQueue; this.watchDog = new IrcWatchdog( StaticLogger.Log, () => this.SendPing(watchdogStr), this.Watchdog_OnFailure, 60 * 1000 ); }
// -------- Constructor -------- /// <summary> /// Constructor. /// </summary> /// <param name="ircConfig">The irc config object to use. This will be cloned after being passed in.</param> /// <param name="parsingQueue">The global parsing queue we are using.</param> public IrcBot(IIrcConfig ircConfig, INonDisposableStringParsingQueue parsingQueue) { ArgumentChecker.IsNotNull(ircConfig, nameof(ircConfig)); ArgumentChecker.IsNotNull(parsingQueue, nameof(parsingQueue)); this.ircConfig = ircConfig.Clone(); this.IrcConfig = new ReadOnlyIrcConfig(this.ircConfig); IrcConnection connection = new IrcConnection(ircConfig, parsingQueue); this.ircConnection = connection; this.parsingQueue = parsingQueue; }
// -------- Constructor -------- public IrcConnection(IIrcConfig config, INonDisposableStringParsingQueue parsingQueue) : this(config, parsingQueue, new IrcMac(config, StaticLogger.Log)) { }