private void StartMonitoring(bool AutoStarted) { if (!LogMonitor.IsValidLogPath(txtLogPath.Text)) { string ErrMsg = "Failed to start " + (AutoStarted ? "automatically " : "") + "as the log path is invalid."; if (AutoStarted) { LogMessage(ErrMsg, null, LogMessageType.Status); } else { MessageBox.Show(ErrMsg); } return; } if (new FileInfo(txtLogPath.Text).IsReadOnly) { LogMessage("Warning: Your client.txt file appears to be readonly. This will likely prevent the program from working.", null, LogMessageType.Status); } cmdStop.Enabled = true; cmdStart.Enabled = false; this.Monitor = new LogMonitor(txtLogPath.Text); Monitor.BeginMonitoring(); Monitor.MessageReceived += ProcessMessage; IdleManager.BeginMonitoring(); LogMessage("Program started at " + DateTime.Now.ToShortTimeString() + ".", null, LogMessageType.Status); }
private void Start(bool AutoStarted) { if (!LogMonitor.IsValidLogPath(txtLogPath.Text)) { string ErrMsg = "Failed to start " + (AutoStarted ? "automatically " : "") + "as the log path is invalid."; if (AutoStarted) { AppendMessage(ErrMsg); } else { MessageBox.Show(ErrMsg); } return; } cmdStop.Enabled = true; cmdStart.Enabled = false; this.Monitor = new LogMonitor(txtLogPath.Text); Monitor.BeginMonitoring(); Monitor.MessageReceived += ProcessMessage; IdleManager.BeginMonitoring(); AppendMessage("Program started at " + DateTime.Now.ToShortTimeString() + "."); }