本文整理汇总了C#中ProcessState.UpdateStamp方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessState.UpdateStamp方法的具体用法?C# ProcessState.UpdateStamp怎么用?C# ProcessState.UpdateStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessState
的用法示例。
在下文中一共展示了ProcessState.UpdateStamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMonitorElapsed
bool OnMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) {
var hasExited = TryCheckHasExited(process);
if (hasExited)
return false;
if (TryCheckResponding(process)) {
state.UpdateStamp();
return true;
}
if (Tools.Generic.LongerAgoThan(state.Stamp, timeout))
TryKillDueNotRespondingTimeout(process, timeout);
return false;
}
示例2: OnOutputMonitorElapsed
bool OnOutputMonitorElapsed(Process process, ProcessState state, TimeSpan timeout) {
if (TryCheckHasExited(process))
return false;
var lastResponse = state.Stamp;
if (!Tools.Generic.LongerAgoThan(lastResponse, timeout))
return true;
var lastStreamLengths = state.StreamLengths;
state.StreamLengths = new Tuple<long, long>(process.StandardOutput.BaseStream.Length,
process.StandardError.BaseStream.Length);
if (state.StreamLengths.Item1 != lastStreamLengths.Item1
|| state.StreamLengths.Item2 != lastStreamLengths.Item2) {
state.UpdateStamp();
return true;
}
TryKillDueToNoOutputReceivedTimeout(process, timeout);
return false;
}