public PasswordGuessForm()
        {
            InitializeComponent();

            OpenArchiveDialog.Filter = supportedFileTypes;
            unarchiver = new Unarchiver();
        }
        private void HandlePasswordExtractFileCodes(Unarchiver.ArchiveExtractStatusCode extractStatusCode, string successPassword)
        {
            switch (extractStatusCode)
            {
                case Unarchiver.ArchiveExtractStatusCode.SUCCESS:
                    MessageBox.Show("The operation has been completed.",
                    "Success!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                    UnguessedPassListBox.Items.Clear();
                    UnguessedPassListBox.Items.Add(successPassword);
                    break;

                case Unarchiver.ArchiveExtractStatusCode.WRONG_PASSWORD:
                    UnguessedPassListBox.Items.Clear();
                    MessageBox.Show("The operation failed. The following may have occurred:\n\n" +
                        "All passwords are wrong.",
                            "Failure",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    break;

                case Unarchiver.ArchiveExtractStatusCode.ARCHIVE_NOT_FOUND:
                    //
                    // Should not be possible!
                    //
                    MessageBox.Show("The operation failed. The following may have occurred:\n\n" +
                        "Could not find the archive file specified.",
                            "Failure",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    break;

                default:
                    throw new NotImplementedException();
            }
        }
        private void HandleNoPasswordExtractFileCodes(Unarchiver.ArchiveExtractStatusCode extractStatusCode)
        {
            switch (extractStatusCode)
            {
                case Unarchiver.ArchiveExtractStatusCode.ARCHIVE_NOT_FOUND:
                    MessageBox.Show("The operation failed. The following may have occurred:\n\n" +
                                "Could not find the archive file specified.",
                                    "Failure",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    break;

                case Unarchiver.ArchiveExtractStatusCode.SUCCESS:
                    PasswordCrackProgressBar.Value = PasswordCrackProgressBar.Maximum;
                    MessageBox.Show("The operation has been completed.",
                        "Success!",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    break;

                case Unarchiver.ArchiveExtractStatusCode.WRONG_PASSWORD:
                    string successPassword = string.Empty;

                    // Since there is a password, guess all of them.
                    //
                    var passwordList = UnguessedPassListBox.Items;

                    foreach (string password in passwordList)
                    {
                        // Progress bar progresses equally.
                        //
                        PasswordCrackProgressBar.Value += (PasswordCrackProgressBar.Maximum / passwordList.Count);
                        extractStatusCode = unarchiver.ExtractFile(password);

                        if (extractStatusCode == Unarchiver.ArchiveExtractStatusCode.SUCCESS)
                        {
                            successPassword = password;
                            break;
                        }
                        else
                        {
                            GuessedPassListBox.Items.Add(password);
                        }
                    }

                    // Progress bar progression set to max value.
                    //
                    PasswordCrackProgressBar.Value = PasswordCrackProgressBar.Maximum;

                    // Report success or failure.
                    //
                    HandlePasswordExtractFileCodes(extractStatusCode, successPassword);
                    break;
            }
        }