private void Process_ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data == null) { return; } //Console.WriteLine("Dur!"); //Console.WriteLine(e.Data); _errorData.AppendLine(e.Data); ErrorCount++; }
void process_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data == null) { return; } if (e.Data.Contains("Press ENTER to quit agent")) { startEvent.Set(); } }
private void HtmlToPdf_LogReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { string PDFLogPath = DownloadPath + "\\pdf_log.txt"; try { System.IO.File.AppendAllText(PDFLogPath, e.Data); } catch { // } }
private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e == null || string.IsNullOrEmpty(e.Data)) { return; } Logger.Log(e.Data); Message = e.Data; _isError = true; _isProcessing = false; }
/// <summary> /// Private handler used when the encapsulating process emits data to stdout /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Process_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (null != OnDataLineOutput) { OnDataLineOutput(sender, e.Data, interrupt); } if (interrupt.StopProcess) { KillThisApplication(); } }
private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e == null || string.IsNullOrEmpty(e.Data)) { return; } Logger.Log(e.Data); Message = e.Data; _isError = true; IsVisible = Visibility.Visible; ProgressbarVisible = Visibility.Collapsed; }
private void GotStderr(object sender, System.Diagnostics.DataReceivedEventArgs data) { var line = data.Data; if (String.IsNullOrEmpty(line)) { return; } lock (dataLock) { stderr.Add(line); needFlush++; } }
private void OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e == null || string.IsNullOrEmpty(e.Data)) { return; } if (e.Data.Contains("Public key token is")) { StrongKey = e.Data.Replace("Public key token is ", ""); } Logger.Log(e.Data); }
protected override void OutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs ConsoleOutput) { try { string StdOut; int StartPos, EndPos; float perc; base.OutputHandler(sendingProcess, ConsoleOutput); if (ConsoleOutput.Data == null) { return; } if (!String.IsNullOrEmpty(ConsoleOutput.Data)) { StdOut = ConsoleOutput.Data; if (StdOut.Contains("/100")) { EndPos = StdOut.IndexOf("/100"); for (StartPos = EndPos - 1; StartPos > -1; StartPos--) { if ((!char.IsNumber(StdOut[StartPos])) && (StdOut[StartPos] != '.') && (StdOut[StartPos] != ' ')) { StartPos++; break; } } float.TryParse(StdOut.Substring(StartPos, EndPos - StartPos).Trim(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out perc); _jobStatus.PercentageComplete = perc; UpdateETAByPercentageComplete(); } if (StdOut.Contains("Error importing")) { _success = false; } if (StdOut.Contains("Error writing data (Invalid argument): -1 blocks to write but 0 blocks written")) { _success = false; _unrecoverableError = true; // This is just going to hang forever in this loop, terminate the process } } } catch (Exception e) { _jobLog.WriteEntry(this, "ERROR Processing Console Output.\n" + e.ToString(), Log.LogEntryType.Error); } }
private static void OnErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs args) { if (!string.IsNullOrEmpty(args.Data)) { try { streamWriter.WriteLine(args.Data); streamWriter.Flush(); } catch (System.Exception) { } } }
/// <summary> /// Event Handler for output received from the Register Process /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data != null) { if (e.Data.Contains("Error:")) { _errors += e.Data + "\n"; } else { _message += e.Data + "\n"; } } }
/// <summary> /// Asynchronous reading DataReceived event handler. /// </summary> private void OutputHandler(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (!String.IsNullOrEmpty(e.Data)) { // convert and log first Print(e.Data + Environment.NewLine); // test if it is command Match result = Patterns.fileReg.Match(e.Data); if (result.Success) { progressBarX264.InvokeIfRequired(() => progressBarX264.Style = ProgressBarStyle.Blocks ); bgworker.ReportProgress(0, 0.0); frameCount = EstimateFrame(workPath, result.Groups["fileIn"].Value); } result = Patterns.fileCompletedReg.Match(e.Data); if (result.Success) { UpdateWorkCountUI(); } // try ffms pattern result = Patterns.ffmsReg.Match(e.Data); if (result.Success) { bgworker.ReportProgress(0, Double.Parse(result.Groups["percent"].Value) / 100); } else { // try lavf pattern result = Patterns.lavfReg.Match(e.Data); if (result.Success) { bgworker.ReportProgress(0, Double.Parse(result.Groups["frame"].Value) / frameCount); } else { // try nero pattern result = Patterns.neroReg.Match(e.Data); if (!result.Success) { internellog.AppendLine(e.Data); } } } } }
/// <summary> /// 文字が出力されたことを検知 /// </summary> /// <param name="sender"></param> /// <param name="e">e.Dataで出力された文字を検知</param> public void process_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { Console.WriteLine(e.Data); if (e.Data != null) { // 文字の出力が終わっていない場合 InvokeIfRequired( (Action) delegate() { AddText(e.Data, processDialog); }, true); } }
} /// <summary> /// On Data Received event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void p_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data != null) { System.Diagnostics.Debug.WriteLine(e.Data); if (e.Data.Contains("Error:")) { _errors += e.Data + "\n"; } else if (e.Data.Contains("scmbundle::")) { _deviceosversion = e.Data.Substring(e.Data.LastIndexOf("::") + 2); } } }
private void ConsoleOutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs outLine) { if (!String.IsNullOrEmpty(outLine.Data)) { //this.Invoke(new fpTextBoxCallback_t(AddTextToOutputTextBox), Environment.NewLine + outLine.Data); if (this.InvokeRequired) { this.Invoke(fpTextBoxCallback, Environment.NewLine + outLine.Data); } else { fpTextBoxCallback(Environment.NewLine + outLine.Data); } } }
private void MinerCli_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { var data = e.Data; // Check for matches. if (_stratumDifficulty.IsMatch(data)) { var match = _stratumDifficulty.Match(data); _minerReport.StratumDifficulty = Convert.ToDecimal(match.Groups[1].Value); } if (_blockNumber.IsMatch(data)) { var match = _blockNumber.Match(data); _minerReport.Block = Convert.ToInt32(match.Groups[1].Value); } if (_gpuMatch.IsMatch(data)) { var match = _gpuMatch.Match(data); if (match.Groups[2].Value == "MH/s") { _minerReport.TotalHashrate = Convert.ToDecimal(match.Groups[1].Value); } else { _minerReport.TotalHashrate = (Convert.ToDecimal(match.Groups[1].Value) / 1000); } } if (_sharesMatch.IsMatch(data)) { var match = _sharesMatch.Match(data); _minerReport.AcceptedShares = Convert.ToInt32(match.Groups[1].Value); _minerReport.TotalShares = Convert.ToInt32(match.Groups[2].Value); _minerReport.BlockDifficulty = Convert.ToDecimal(match.Groups[3].Value); _minerReport.StaleShares = _minerReport.TotalShares - _minerReport.AcceptedShares; if (match.Groups[5].Value == "MH/s") { _minerReport.TotalHashrate = Convert.ToDecimal(match.Groups[4].Value); } else { _minerReport.TotalHashrate = (Convert.ToDecimal(match.Groups[4].Value) / 1000); } } }
private static void OutputDataHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs outputLine) { if (outputLine.Data == null) { return; } if (!Outputs.ContainsKey(sendingProcess)) { return; } var commandOutput = Outputs[sendingProcess]; commandOutput.Output = commandOutput.Output + outputLine.Data + "\n"; }
//OutputDataReceivedイベントハンドラ //行が出力されるたびに呼び出される void p_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data == null) { return; } if (textBoxLogs.InvokeRequired) { this.Invoke((MethodInvoker)(() => textBoxLogs.AppendText(e.Data + "\r\n"))); } else { textBoxLogs.AppendText(e.Data + "\r\n"); } }
/// <summary> /// On Error received event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void p_ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data != null) { System.Diagnostics.Debug.WriteLine(e.Data); if (e.Data.Contains("-password")) { _errors += "The password supplied for connecting to your device is not set or invalid\n"; } else { _errors += e.Data + "\n"; } } }
public void ExeOutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs outLine) { string Output = outLine.Data; if (string.IsNullOrWhiteSpace(Output) == false) { if (ExeLogToFile) { System.IO.File.AppendAllText(ExeLogPath, Tag(Output + Environment.NewLine)); } if (ExeLogToConsole) { Console.WriteLine(Tag(Output)); } } }
ErrorDataReceived( object sender, System.Diagnostics.DataReceivedEventArgs e) { if (System.String.IsNullOrEmpty(e.Data)) { return; } if (this.UseDeferredOutput) { this.ErrorStringBuilder.AppendLine(e.Data); } else { Log.ErrorMessage("stderr: {0}", e.Data); } }
//ErrorDataReceivedイベントハンドラ void p_ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { try { if (e.Data.Trim() != "") { this.InvokeOnUiThreadIfRequired(() => label1.Text = e.Data); } string message = e.Data.ToLower(); MessageHandler(message); } catch { } }
protected override void OutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs ConsoleOutput) { try { string StdOut; float perc; base.OutputHandler(sendingProcess, ConsoleOutput); if (ConsoleOutput.Data == null) { return; } if (!String.IsNullOrEmpty(ConsoleOutput.Data)) { StdOut = ConsoleOutput.Data; if (StdOut.Contains("%") && StdOut.Contains("|") && StdOut.Contains(":")) { string[] details = StdOut.Split('|'); // Update the % completion string percStr = details[0].Substring(0, details[0].IndexOf('%')); float.TryParse(percStr, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out perc); _jobStatus.PercentageComplete = perc; UpdateETAByPercentageComplete(); } // Potential format reading error if (StdOut.Contains("Not a recognized header. Searching for next header.")) { _formatError = true; } // Success Criteria if (StdOut.Contains("Done, processing time")) { _success = true; } } } catch (Exception e) { _jobLog.WriteEntry(this, "ERROR Processing Console Output.\n" + e.ToString(), Log.LogEntryType.Error); } }
/// <summary> /// On Data Received event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InstallDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (e.Data != null) { if ((e.Data.ToLower().Contains("error")) || (_error != "")) { _error = _error + e.Data + "\n"; } else { if ((!isConfiguring) && (e.Data.Contains("Configuring"))) { isConfiguring = true; } Status = e.Data; } } }
private void Conversion_OnDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { if (this.IsDisposed) { return; } this.Invoke(new Action(() => { string[] lines = e .Data .Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (string l in lines) { txtOutput.AppendText(l + Environment.NewLine); } })); }
protected override void OutputHandler(object sendingProcess, System.Diagnostics.DataReceivedEventArgs ConsoleOutput) { try { string StdOut; int StartPos, EndPos; float Perc; base.OutputHandler(sendingProcess, ConsoleOutput); if (ConsoleOutput.Data == null) { return; } if (!String.IsNullOrEmpty(ConsoleOutput.Data)) { StdOut = ConsoleOutput.Data; if (StdOut.Contains("Progress:") && StdOut.Contains("%")) { EndPos = StdOut.IndexOf("%"); for (StartPos = EndPos - 1; StartPos > -1; StartPos--) { if (!char.IsNumber(StdOut[StartPos])) { StartPos++; break; } } float.TryParse(StdOut.Substring(StartPos, EndPos - StartPos).Trim(), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out Perc); _jobStatus.PercentageComplete = Perc; } if (StdOut.Contains("Finished writing") || StdOut.Contains("completed")) // new ones say finished wirting, updating says completed { _success = true; } } } catch (Exception e) { _jobLog.WriteEntry(this, "ERROR Processing Console Output.\n" + e.ToString(), Log.LogEntryType.Error); } }
private void process_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { //Debug.Log(e.Data); string reply = e.Data; if (!string.IsNullOrEmpty(reply)) { if (!reply.StartsWith("Pty")) //ignore header { voices.Add(Util.Config.TTS_LINUX.CTContains("espeak-ng") ? new Model.Voice(reply.Substring(30, 19).Trim().Replace("_", " "), reply.Substring(50).Trim(), Util.Helper.StringToGender(reply.Substring(23, 1)), "unknown", reply.Substring(4, 15).Trim(), "", "espeak-ng") : new Model.Voice(reply.Substring(22, 20).Trim(), reply.Substring(43).Trim(), Util.Helper.StringToGender(reply.Substring(19, 1)), "unknown", reply.Substring(4, 15).Trim(), "", "espeak")); } } }
private void errHandler(object sender, System.Diagnostics.DataReceivedEventArgs args) { if (String.IsNullOrEmpty(args.Data)) { return; } if (m_mergeErr) { if (m_out != null) { m_out.printLine(args.Data); } } else { if (m_err != null) { m_err.printLine(args.Data); } } }
//OutputDataReceivedイベントハンドラ //行が出力されるたびに呼び出される void p_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) { try { if (e.Data.Trim() != "") { this.InvokeOnUiThreadIfRequired(() => label1.Text = e.Data); } if (!e.Data.Contains(" ") && e.Data.Last() == '>') { this.Close(); } //エラー出力された文字列を表示する Console.WriteLine(e.Data); } catch { } }
private System.Diagnostics.DataReceivedEventArgs createMockDataReceivedEventArgs(string data) { if (String.IsNullOrEmpty(data)) { throw new ArgumentException("Data is null or empty.", "Data"); } System.Diagnostics.DataReceivedEventArgs mockEventArgs = (System.Diagnostics.DataReceivedEventArgs)System.Runtime.Serialization.FormatterServices .GetUninitializedObject(typeof(System.Diagnostics.DataReceivedEventArgs)); if (eventFields.Length > 0) { eventFields[0].SetValue(mockEventArgs, data); } else { Debug.LogError("Could not create 'DataReceivedEventArgs'!"); } return(mockEventArgs); }