public async Task Execute(Action <IProgress> progressCallback) { var status = updater.Status(); if (!status.UpToDate) { DownloadResult downloadResult = await updater.Download(status.LatestVersion, (downloadProgress) => { progressCallback(downloadProgress); }); KillProcess(initiatingProcess); InstallResult installResult = updater.Install(status.LatestVersion, (installProcess) => { progressCallback(installProcess); }); if (installResult.IsSuccess) { this.manifest.Application.Version = status.LatestVersion; ISerializer serializer = SerializerFactory.GetInstance(); MethodInfo serializerGetInstance = serializer.GetType().GetMethod("Save"); Type manifestType = manifest.GetType(); MethodInfo genericSerializerGetInstance = serializerGetInstance.MakeGenericMethod(manifestType); genericSerializerGetInstance.Invoke(serializer, new object[] { manifestPath, manifest }); } StartProcess(followUpProcessPath); Environment.Exit(1); } }
public static KeyValuePair <IUpdateManifest, string> Retrieve(UpdateManifestType manifestType, string manifestPath) { IUpdateManifest manifest = null; if (manifestPath == null || manifestPath == string.Empty) { manifestPath = GitHubUpdateManifestFileName; } if (manifestType == UpdateManifestType.GitHub) { manifest = SerializerFactory.GetInstance().Load <GitHubUpdateManifest>(manifestPath); } else { throw new ArgumentException("Manifest type '" + manifestType + "' is not yet handled."); } return(new KeyValuePair <IUpdateManifest, string>(manifest, manifestPath)); }