public static ITailWatcher CreateWatcher(string path, ISerialFileReader serialFileReader, Action<Exception> exceptionHandler) { switch (ReaderFactory.GetReaderType(path)) { case ReaderType.File: return new TailFileWatcher(serialFileReader, exceptionHandler); case ReaderType.EventLog: return new TailEventLogWatcher(serialFileReader, exceptionHandler); default: throw new NotImplementedException(); } }
public static ITailWatcher CreateWatcher(string path, ISerialFileReader serialFileReader, Action <Exception> exceptionHandler) { switch (ReaderFactory.GetReaderType(path)) { case ReaderType.File: return(new TailFileWatcher(serialFileReader, exceptionHandler)); case ReaderType.EventLog: return(new TailEventLogWatcher(serialFileReader, exceptionHandler)); default: throw new NotImplementedException(); } }
public virtual void StartTail(bool save = true, bool stop = true) { serialFileReader = new CallbackFileReader(new ReaderFactory()) { StartCallback = FormInterface.StartCallback, UpdateCallback = FormInterface.UpdateCallback, FinishCallback = FormInterface.FinishCallback, ExceptionCallback = FormInterface.ExceptionCallback, LoadLastLines = FormInterface.LoadLastLinesCallback, Filter = FormInterface.GetFilterCallback }; if (save) { Properties.Settings.Default.LastFile = FormInterface.GetFileNameCallback(); } if (stop && tailThread != null) { StopTail(); } if (tailThread == null) { tailThread = new TailThread(TailWatcherFactory.CreateWatcher(FormInterface.GetFileNameCallback(), serialFileReader, FormInterface.ExceptionCallback)); } FormInterface.ClearDisplayCallback(); var file = FormInterface.GetFileNameCallback(); try { if (string.IsNullOrEmpty(file)) { return; } serialFileReader.EnableQueue(true); tailThread.Start(file); FormInterface.SetStateCallback(true); } catch (Exception ex) { FormInterface.ExceptionCallback(ex); } }
public TailFileWatcher(ISerialFileReader serialFileReader, Action <Exception> exceptionHandler) { this.serialFileReader = serialFileReader; this.exceptionHandler = exceptionHandler; }
public TailFileWatcher(ISerialFileReader serialFileReader, Action<Exception> exceptionHandler) { this.serialFileReader = serialFileReader; this.exceptionHandler = exceptionHandler; }