Esempio n. 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();
        }
Esempio n. 2
0
 public override void Dispose()
 {
     if (mWriter != null)
     {
         mWriter.Dispose();
     }
     base.Dispose();
 }
Esempio n. 3
0
 public void Stop()
 {
     stop = true;
     if (consumingThread.IsAlive)
     {
         consumingThread.Join();
     }
     fileWriter.Dispose();
 }
Esempio n. 4
0
 public void Dispose()
 {
     if (_disposed)
     {
         return;
     }
     _file.Dispose();
     _disposed = true;
 }
Esempio n. 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}");
     }
 }
Esempio n. 6
0
 public void Dispose() => decoratee.Dispose();
 public void Dispose()
 {
     _fileWriter.Dispose();
 }
Esempio n. 8
0
 public virtual void Dispose()
 {
     Reader.Dispose();
     Writer.Dispose();
 }
Esempio n. 9
0
 public void Dispose()
 {
     serialPort?.Dispose();
     fileWriter?.Dispose();
 }