public async Task UpdateApplicationAsync(IProgress<ProgressStatus> progress = null)
{
progress = progress ?? new Progress<ProgressStatus>();
progress.Report(20, "更新を確認しています。");
await WaitAsync().ConfigureAwait(false);
var latest = await GetLatestSummaryAsync().ConfigureAwait(false);
using (var temp = new TempFile())
{
progress.Report(40, "パッケージをダウンロードしています。");
await WaitAsync().ConfigureAwait(false);
await DownloadPackageAsync(latest.PackagePath, temp.File.FullName).ConfigureAwait(false);
var processName = Path.GetFileNameWithoutExtension(_args.ApplicationExecutionPath);
progress.Report(60, String.Format("プロセス {0} の終了を待機しています。", processName));
await WaitAsync().ConfigureAwait(false);
await WaitProcessExitAsync(processName).ConfigureAwait(false);
progress.Report(80, "ファイルを最新に更新しています。");
await WaitAsync().ConfigureAwait(false);
await UpdateFilesAsync(temp.File, _args.ApplicationDirectory).ConfigureAwait(false);
await RemoveFilesAsync(latest.RemoveFiles, _args.ApplicationDirectory).ConfigureAwait(false);
}
if (_args.StartProcess)
{
progress.Report(100, "アプリケーションを起動します。");
await WaitAsync().ConfigureAwait(false);
Process.Start(_args.ApplicationExecutionPath);
}
}
private Task WaitAsync()