private void LoadProfilesClickedEventHandler(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show(
                "Should profiles be loaded using the profiles.ini file? " +
                "If not, the path to the profile directory will need to be specified.",
                "Load Profiles",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button1
                );

            if (result == DialogResult.Yes)
            {
                var dialog = new OpenFileDialog
                {
                    Title       = "Select a Firefox profiles.ini file",
                    Filter      = "INI files (*.ini)|*.ini|All files (*.*)|*.*",
                    FilterIndex = 1
                };

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var profiles = (BindingList <ProfileInfo>) this.comboProfile.DataSource;

                    foreach (ProfileInfo profile in ProfileParser.GetProfiles(dialog.FileNames).SkipExceptions())
                    {
                        profiles.Add(profile);
                    }
                }
            }
            else if (result == DialogResult.No)
            {
                var dialog = new FolderBrowserDialog
                {
                    Description         = "Select a Firefox Profile folder",
                    ShowNewFolderButton = false
                };

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var    profiles = (BindingList <ProfileInfo>) this.comboProfile.DataSource;
                    string dirName  = new DirectoryInfo(dialog.SelectedPath).Name;
                    var    profile  = new ProfileInfo
                    {
                        Name       = dirName.Substring(dirName.IndexOf('.') + 1),
                        Path       = dialog.SelectedPath,
                        Default    = false,
                        IsRelative = false
                    };

                    profiles.Add(profile);
                    this.comboProfile.SelectedItem = profile;
                }
            }
        }
        private void FormLoadEventHandler(object sender, EventArgs e)
        {
            this.Text = "Web Site Advantage Firefox to KeePass Importer (" + Version + ")";

            IEnumerable <string> paths = ProfileParser.GetProfilePaths();

            ProfileInfo[] profiles = ProfileParser.GetProfiles(paths).SkipExceptions().ToArray();

            this.comboProfile.DataSource    = new BindingList <ProfileInfo>(profiles);
            this.comboProfile.DisplayMember = "Name";
            this.comboProfile.SelectedItem  = ProfileParser.GetPrimaryProfile(profiles);

            string[] iconNames = Enum.GetNames(typeof(PwIcon));

            // Last item is an undesirable virtual identifier
            this.comboIcon.DataSource    = iconNames.Take(iconNames.Length - 1).ToArray();
            this.comboIcon.SelectedIndex = 16;
        }