Пример #1
0
        private void MainLoop()
        {
            while (!_exit)
            {
                LogLine logLine = null;
                try
                {
                    logLine = _lines.Take();
                }
                catch (Exception)
                {
                    _exit = true;
                }

                if (logLine != null && (!_exit || _quitWithFlush))
                {
                    _writer.Write(logLine);
                }

                if (_quitWithFlush && _lines.Count == 0)
                {
                    _exit = true;
                }
            }

            _lines?.Dispose();
            _writer?.Dispose();
        }
Пример #2
0
 public override void Dispose()
 {
     if (mWriter != null)
     {
         mWriter.Dispose();
     }
     base.Dispose();
 }
Пример #3
0
 public void Stop()
 {
     stop = true;
     if (consumingThread.IsAlive)
     {
         consumingThread.Join();
     }
     fileWriter.Dispose();
 }
Пример #4
0
 public void Dispose()
 {
     if (_disposed)
     {
         return;
     }
     _file.Dispose();
     _disposed = true;
 }
Пример #5
0
 public override void Close()
 {
     if (_fileWriter == null)
     {
         return;
     }
     try
     {
         _fileWriter.Dispose();
     }
     catch (Exception)
     {
         //Ignore this exception, since it will always(?) happen but we still want to make sure the writer is disposed.
         //Debug.WriteLine($"Exception in writer dispose. {e.Message} {e.StackTrace}");
     }
 }
Пример #6
0
 public void Dispose() => decoratee.Dispose();
 public void Dispose()
 {
     _fileWriter.Dispose();
 }
Пример #8
0
 public virtual void Dispose()
 {
     Reader.Dispose();
     Writer.Dispose();
 }
Пример #9
0
 public void Dispose()
 {
     serialPort?.Dispose();
     fileWriter?.Dispose();
 }