PoEWhisperNotifier.LogMonitor.BeginMonitoring C# (CSharp) Method

BeginMonitoring() public method

Begins monitoring the log file for changes.
public BeginMonitoring ( ) : void
return void
		public void BeginMonitoring() {
			if(IsMonitoring)
				throw new InvalidOperationException("Already monitoring for changes.");
			this.IsMonitoring = true;
			this._LogStream = new FileStream(LogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
			_LogStream.Seek(0, SeekOrigin.End);
			// Instead of proper async handling, take the lazy way and ReadLine in a new thread.
			_LogThread = new Thread(RunReadLoop) { IsBackground = true };
			_LogThread.Start();
		}

Usage Example

Esempio n. 1
0
 private void Start()
 {
     if(!LogMonitor.IsValidLogPath(txtLogPath.Text)) {
         MessageBox.Show("The log path you have entered is invalid. Please select the client.txt file located in the PoE folder.");
         return;
     }
     cmdStop.Enabled = true;
     cmdStart.Enabled = false;
     this.Monitor = new LogMonitor(txtLogPath.Text);
     Monitor.BeginMonitoring();
     Monitor.MessageReceived += ProcessMessage;
     IdleManager.BeginMonitoring();
 }
All Usage Examples Of PoEWhisperNotifier.LogMonitor::BeginMonitoring