// 2. jsonを string 形式に 変換 public static void StringConvertJson(GitHubJson js) { convertstringjson = JsonUtility.ToJson(js); //3 のステップへ JsonFileExport(convertstringjson); }
public static void CheckAndApplyUpdates(bool cancel) { bool shouldRestart = false; GitHubJson[] gitHubJson = GitHubJson.FromJson(GetReleases("Psanyi89", "My_Softwares")); var downloadurl = gitHubJson.Select(x => x.Assets[0].BrowserDownloadUrl).FirstOrDefault().ToString().Replace("/RELEASES", ""); using (UpdateManager manager = new UpdateManager(downloadurl)) { var updateInfo = manager.CheckForUpdate().Result; if (updateInfo.CurrentlyInstalledVersion == null || updateInfo.CurrentlyInstalledVersion.Version < updateInfo.FutureReleaseEntry.Version) { var firstMessageBox = MessageBox.Show( $"New version available {updateInfo.FutureReleaseEntry.Version}!\n Would you like to download it?" , "Update available", MessageBoxButton.YesNo ); if (firstMessageBox == MessageBoxResult.Yes) { shouldRestart = true; manager.DownloadReleases(updateInfo.ReleasesToApply).Wait(); manager.ApplyReleases(updateInfo).Wait(); manager.CreateUninstallerRegistryEntry().Wait(); } else if (firstMessageBox == MessageBoxResult.No) { cancel = true; } } } if (shouldRestart) { if (MessageBox.Show("Would you like to restart application to run the updated version?" , "Update Finished!" , MessageBoxButton.YesNo ) == MessageBoxResult.Yes) { UpdateManager.RestartApp(); } } }