/// <summary> /// Called when [auction queued]. /// </summary> /// <param name="monitor">The monitor.</param> /// <param name="line">The line.</param> protected virtual void OnAuctionQueued(AuctionMonitor monitor, string line) { var evtArgs = new AuctionReadEventArgs(line) { CharacterName = monitor.CharacterName, FileName = monitor.File.Name }; AuctionRead?.Invoke(this, evtArgs); }
/// <summary> /// Called when [auction monitor started]. /// </summary> /// <param name="monitor">The monitor.</param> protected virtual void OnAuctionMonitorStarted(AuctionMonitor monitor) { var evtArgs = new AuctionLogFileEventArgs { CharacterName = monitor.CharacterName, FileName = monitor.File.Name }; AuctionMonitorStarted?.Invoke(this, evtArgs); if (evtArgs.Cancel) this.EndWatch(); }
/// <summary> /// Watcher_s the file changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.IO.FileSystemEventArgs" /> instance containing the event data.</param> private void watcher_FileChanged(object sender, FileSystemEventArgs e) { if (_ignorableCharacterProvider.IsIgnored(AuctionMonitor.ExtractCharacterName(e.Name))) return; AuctionMonitor monitor; bool blnFound = false, blnNewlyAdded = false; blnFound = _dicMonitors.TryGetValue(e.FullPath, out monitor); if (!blnFound) { monitor = new AuctionMonitor(e.FullPath, _noActivitySeconds); blnFound = _dicMonitors.TryAdd(e.FullPath, monitor); blnNewlyAdded = true; } if (blnFound) { if (blnNewlyAdded) { monitor.AuctionRead += this.Monitor_AuctionQueued; this.OnAuctionMonitorStarted(monitor); } if (!_timerFileChecker.Enabled) _timerFileChecker.Start(); monitor.ScanNewContent(); } }
/// <summary> /// Called when [auction monitor ended]. /// </summary> /// <param name="monitor">The monitor.</param> protected virtual void OnAuctionMonitorEnded(AuctionMonitor monitor) { var evtArgs = new AuctionLogFileEventArgs { CharacterName = monitor.CharacterName, FileName = monitor.File.Name }; AuctionMonitorEnded?.Invoke(this, evtArgs); }