public Form1() { InitializeComponent(); iDecryptor = new Decoder.Decryptor(); FistRun = true; this.timer = new System.Timers.Timer(500); timer.Elapsed += Timer_Elapsed; this.metroStyleManager1.Theme = MetroFramework.MetroThemeStyle.Dark; this.metroTabControl1.Location = new Point(this.Width, this.metroTabControl1.Location.Y); this.metroPanel2.Location = new Point(this.metroPanel2.Location.X, 0); this.ShadowType = MetroFormShadowType.AeroShadow; this.psPath = GetDefaultpsPath(); this.cursesPath = this.psPath + "\\courses"; this.dbPath = this.psPath + "\\pluralsight.db"; Transitions.Transition iTransition = new Transitions.Transition(new Transitions.TransitionType_Deceleration(1000)); iTransition.add(this.metroTabControl1, "Left", this.Width - 777); iTransition.add(this.metroPanel2, "Top", this.Height - 422); iTransition.run(); timer.Enabled = true; timer.Start(); this.metroTextBox3.Text = dbPath; }
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); }); } }