本文整理汇总了C#中ITransferProgress.UpdateOutput方法的典型用法代码示例。如果您正苦于以下问题:C# ITransferProgress.UpdateOutput方法的具体用法?C# ITransferProgress.UpdateOutput怎么用?C# ITransferProgress.UpdateOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransferProgress
的用法示例。
在下文中一共展示了ITransferProgress.UpdateOutput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseOutput
public override void ParseOutput(Process sender, string data, ITransferProgress progress) {
// 3.51M 43% 177.98kB/s 0:00:25
// sent 1.39K bytes received 1.01K bytes 1.60K bytes/sec
// total size is 114.55K speedup is 47.57
if (data == null)
return;
progress.UpdateOutput(data);
var matches = RSYNC_START.Matches(data);
if (matches.Count > 0) {
var match = matches[0];
var speed = match.Groups[2].Value.TryDouble();
var speedUnit = match.Groups[3].Value;
progress.Update(GetByteSize(speed, speedUnit), match.Groups[1].Value.TryDouble());
TimeSpan ts;
if (TimeSpan.TryParse(match.Groups[4].Value, out ts))
progress.Eta = ts;
return;
}
matches = RSYNC_END.Matches(data);
if (matches.Count > 0) {
var match = matches[0];
var sent = match.Groups[1].Value.TryDouble();
var sentUnit = match.Groups[2].Value;
var received = match.Groups[3].Value.TryDouble();
var receivedUnit = match.Groups[4].Value;
// Rsync final message omits B(yte) indication
progress.FileSizeTransfered = GetByteSize(sent, sentUnit + "b") +
GetByteSize(received, receivedUnit + "b");
progress.Completed = true;
return;
}
progress.Eta = null;
progress.Update(null, 0);
}
示例2: ParseOutput
public override void ParseOutput(Process sender, string data, ITransferProgress progress) {
// ###################- 97.3% 141.5 kBps 0:00 ETA
// used 0 local, fetched 894
if (data == null)
return;
progress.UpdateOutput(data);
if (!VerifyZsyncCompatible(data))
progress.ZsyncIncompatible = true;
if (CheckZsyncLoop(sender, data, progress))
return;
var matches = ZSYNC_START.Matches(data);
if (matches.Count > 0) {
var match = matches[0];
var speed = match.Groups[2].Value.TryDouble();
var speedUnit = match.Groups[3].Value;
progress.Update(GetByteSize(speed, speedUnit), match.Groups[1].Value.TryDouble());
var eta = match.Groups[4].Value;
if (tspan.IsMatch(eta))
eta = "0:" + eta;
TimeSpan ts;
if (TimeSpan.TryParse(eta, out ts))
progress.Eta = ts;
return;
}
matches = ZSYNC_END.Matches(data);
if (matches.Count > 0) {
var match = matches[0];
progress.FileSizeTransfered = match.Groups[2].Value.TryInt();
progress.Completed = true;
return;
}
progress.Eta = null;
progress.Update(null, 0);
}