public static void monitoring() { string buffer = string.Empty; while (isRunning) { buffer = StandardStreamRedirector.getBuffer(StandardStreamRedirector.StreamFileDescriptor.Output); if (buffer.Length > 0) onRedirectionPerformed(buffer); } }
public void scanErrorLog() { onLogFileScanningStarted(); hasError = false; try { string[] prefixes = new string[] { "Saving file", "File", "Dimension", "Output", "Lossless", "* Header", "* Lossless", "* Precision", "* Palette size", "PREDICTION", "CROSS-COLOR-TRANSFORM", "SUBTRACT-GREEN", "PALETTE", "Saved file", "bytes used", "line count", "mode-partition", "Residuals bytes", "macroblocks", "quantizer", "filter level", "block count", "intra", "skipped block", "|" }; StringReader reader = new StringReader(StandardStreamRedirector.getBuffer(StandardStreamRedirector.StreamFileDescriptor.Error)); string line; while ((line = reader.ReadLine()) != null) { bool err = true; if (line.Trim().Length > 0) { foreach (string prefix in prefixes) { if (line.Trim().StartsWith(prefix)) { err = false; break; } } if (err) { hasError = true; break; } } } reader.Close(); } catch (Exception e) { Console.Error.WriteLine(e.ToString()); hasError = true; } finally { errorLogScanned = true; onLogFileScanningPerformed(hasError); } }