public static void Menu_DownloadLatestDugite() { LogHelper.LogAdapter = new UnityLogAdapter(); var extensionInstallPath = Application.dataPath.ToSPath().Parent; var unityEnv = TheEnvironment.instance.Environment; var env = new ApplicationEnvironment(unityEnv); env.Initialize(extensionInstallPath, unityEnv); var platform = new Platform(env); platform.Initialize(); env.InitializeRepository(); var installer = new GitInstaller.GitInstallDetails(env.RepositoryPath, env); var manifest = DugiteReleaseManifest.Load(platform.TaskManager, installer.GitManifest, installer.GitManifestFeed, platform.Environment); var cts = new CancellationTokenSource(); var downloader = new Downloader(platform.TaskManager, cts.Token); var downloadPath = env.RepositoryPath.Combine("downloads"); foreach (var asset in manifest.Assets) { downloadPath.Combine(asset.Url.Filename).DeleteIfExists(); downloader.QueueDownload(asset.Url, downloadPath, retryCount: 3); } downloader.Progress(p => { platform.TaskManager.RunInUI(() => { if (EditorUtility.DisplayCancelableProgressBar(p.Message, p.InnerProgress?.InnerProgress?.Message ?? p.InnerProgress?.Message ?? p.Message, p.Percentage)) { cts.Cancel(); } }); }).FinallyInUI((success, ex) => { EditorUtility.ClearProgressBar(); if (success) { EditorUtility.DisplayDialog("Download done", downloadPath, "Ok"); } else { EditorUtility.DisplayDialog("Error!", ex.GetExceptionMessageShort(), "Ok"); } }).Start(); }