private async Task DoConfigurePack(bool forceRebuild) { var updating = this.currentPackState == PackMode.NeedsUpdate; var actionName = updating ? "Updating" : forceRebuild ? "Rebuilding" : "Installing"; var dialog = new ProgressDialog($"{actionName} Mod Pack") { ConfirmCancel = true }; var cancelSource = new CancellationTokenSource(); var successful = false; // Don't need to do this, necessarily, but to be polite to Mojang, we should check // for a valid session *before* downloading all of the Minecraft assets. var session = await SessionUtil.GetSessionAsync(this); if (session == null) { return; } dialog.Cancel += (_, _) => { cancelSource.Cancel(); dialog.Reporter.ReportProgress(-1, "Cancelling...please wait"); }; dialog.Show(this); try { var useCanaryVersion = this.chkUseCanaryVersion.Checked; await this.packBuilder.SetupPackAsync(this.packMetadata, forceRebuild || !updating, useCanaryVersion, cancelSource.Token, dialog.Reporter); successful = true; } catch (Exception ex) when(ex is TaskCanceledException or OperationCanceledException or WebException { Status: WebExceptionStatus.RequestCanceled })