private void metroButton1_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(this.outputPath) && !string.IsNullOrWhiteSpace(this.psPath)) { var iDecryptorOptions = new Decoder.Option.DecryptorOptions(); iDecryptorOptions.InputPath = this.psPath + "\\courses"; iDecryptorOptions.DatabasePath = this.psPath + "\\pluralsight.db"; iDecryptorOptions.OutputPath = this.outputPath; if (this.useDatabaseCheckbox.Checked) { iDecryptorOptions.UseDatabase = true; } if (this.createSubsCheckbox.Checked) { iDecryptorOptions.CreateTranscript = true; } if (this.removeFolderCheckbox.Checked) { iDecryptorOptions.RemoveFolderAfterDecryption = true; } var iDecryptor = new Decoder.Decryptor(iDecryptorOptions); this.metroProgressSpinner1.Visible = true; Task.Factory.StartNew(async() => { await iDecryptor.DecryptAllFolders(iDecryptorOptions.InputPath, iDecryptorOptions.OutputPath); this.metroProgressSpinner1.Visible = false; this.metroLabel5.Text = "The decryption has been completed!"; this.metroLabel5.Visible = true; await setTimeout(this.metroLabel5, 3000); }, TaskCreationOptions.LongRunning); } else { this.metroLabel5.Text = "There was an error. Check paths!"; this.metroLabel5.Style = MetroFramework.MetroColorStyle.Red; this.metroLabel5.Visible = true; Task.Factory.StartNew(async() => { await setTimeout(this.metroLabel5, 3000); }); } }
private void metroButton1_Click(object sender, EventArgs e) { metroButton1.Enabled = false; Invoke((MethodInvoker)(() => this.metroLabel7.Text = "Completed:")); if (!string.IsNullOrWhiteSpace(this.outputPath) && !string.IsNullOrWhiteSpace(this.psPath)) { iDecryptorOptions = new Decoder.Option.DecryptorOptions(); iDecryptorOptions.InputPath = this.cursesPath; iDecryptorOptions.DatabasePath = this.dbPath; iDecryptorOptions.OutputPath = this.outputPath; if (this.useDatabaseCheckbox.Checked) { iDecryptorOptions.UseDatabase = true; } if (this.createSubsCheckbox.Checked) { iDecryptorOptions.CreateTranscript = true; } if (this.removeFolderCheckbox.Checked) { iDecryptorOptions.RemoveFolderAfterDecryption = true; } iDecryptor = new Decoder.Decryptor(iDecryptorOptions); this.metroProgressSpinner1.Visible = true; timer.Start(); Task.Factory.StartNew(async() => { // task decrypt PS videos await iDecryptor.DecryptAllFolders(iDecryptorOptions.InputPath, iDecryptorOptions.OutputPath); this.metroProgressSpinner1.Visible = false; this.metroLabel5.Text = "The decryption has been completed!"; this.metroLabel5.Visible = true; ChangeCurrentCourse("", await iDecryptor.GetCourse_Completed_Decrypt(), await iDecryptor.GetCourseCount()); await setTimeout(this.metroLabel5, this.metroButton1, 3000); this.timer.Stop(); }, TaskCreationOptions.LongRunning); } else { this.metroLabel5.Text = "There was an error. Check paths!"; this.metroLabel5.Style = MetroFramework.MetroColorStyle.Red; this.metroLabel5.Visible = true; Task.Factory.StartNew(async() => { ChangeCurrentCourse("", await iDecryptor.GetCourse_Completed_Decrypt(), await iDecryptor.GetCourseCount()); await setTimeout(this.metroLabel5, this.metroButton1, 3000); }); } }