private void thread_run() { while (!m_bStop) { m_oPauseEvent.WaitOne(Timeout.Infinite); if (File.Exists(m_sFileName) && LogReader.s_readPosition != new FileInfo(m_sFileName).Length) { if (LogReader.s_readPosition > new FileInfo(m_sFileName).Length) { LogReader.reset(); } LogReader logReader = null; if (m_eDriverVersion == enumDriverVersion.CP5000) { logReader = new LogCPReader(m_sFileName, m_bTail); } else if (m_eDriverVersion == enumDriverVersion.MCD5x) { logReader = new LogMCDReader(m_sFileName, m_bTail); } Thread logThread = new Thread(new ParameterizedThreadStart(ThreadLogUpdate)); logThread.Name = "LogReaderThread"; logThread.Priority = ThreadPriority.Lowest; logThread.IsBackground = true; logThread.Start(logReader); logThread.Join(); } Thread.Sleep(100); } }
public LogFileWatcher(string filename, enumDriverVersion driverVersion, bool tail, frmCSMDH form) { m_sFileName = filename; m_eDriverVersion = driverVersion; m_bTail = tail; LogReader.reset(); m_fParentForm = form; }