private void OnCountrySelectionChanged(object sender, UserSelectionChangedEventArgs e)
 {
     if (e.get_SelectionChangedByUser())
     {
         GuiHelper.CountryComboBoxChanged((ComboBox)sender);
     }
 }
        private void OnTorrentStartProgramChanged(object sender, UserSelectionChangedEventArgs e)
        {
            if (!e.get_SelectionChangedByUser())
            {
                return;
            }
            if (sender == null)
            {
                return;
            }
            CgProfileAnonymousDownloading profileAnonymousDownloading = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading();
            ProgramData programData = (ProgramData)this.TorrentComboBox.SelectedItem;

            if (programData == null)
            {
                return;
            }
            if (programData.ToolTip != "empty" && programData.ToolTip != "browser" && programData.ToolTip != "custom")
            {
                profileAnonymousDownloading.set_DownloadToolExeName(programData.ExeName);
                profileAnonymousDownloading.set_DownloadToolApplicationPath(programData.ApplicationExe);
                SettingsHolder.get_Settings().SaveSettingsAsync(false);
                return;
            }
            string downloadToolExeName;

            if (programData.ToolTip == "browser")
            {
                CgProfileAnonymousDownloading arg_A9_0 = profileAnonymousDownloading;
                profileAnonymousDownloading.set_DownloadToolApplicationPath(downloadToolExeName = "browser");
                arg_A9_0.set_DownloadToolExeName(downloadToolExeName);
                SettingsHolder.get_Settings().SaveSettingsAsync(false);
                return;
            }
            if (programData.ToolTip == "empty")
            {
                CgProfileAnonymousDownloading arg_DC_0 = profileAnonymousDownloading;
                profileAnonymousDownloading.set_DownloadToolApplicationPath(downloadToolExeName = string.Empty);
                arg_DC_0.set_DownloadToolExeName(downloadToolExeName);
                SettingsHolder.get_Settings().SaveSettingsAsync(false);
                return;
            }
            CgProfileAnonymousDownloading arg_FD_0 = profileAnonymousDownloading;

            profileAnonymousDownloading.set_DownloadToolApplicationPath(downloadToolExeName = "custom");
            arg_FD_0.set_DownloadToolExeName(downloadToolExeName);
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter      = "Executable files (*.exe)|*.exe",
                Multiselect = false
            };

            if (openFileDialog.ShowDialog() == true)
            {
                ProgramData programData2 = null;
                string[]    fileNames    = openFileDialog.FileNames;
                for (int i = 0; i < fileNames.Length; i++)
                {
                    string text = fileNames[i];
                    if (text.ToLower().Contains("cyberghost"))
                    {
                        ModernDialogExtension.ShowDialogOk(General.AnonymousDownloading_CyberghostMustNotBeSelected, General.AnonymousDownloading_PleaseSelectOtherApp);
                        return;
                    }
                    if (!SettingsHolder.get_Settings().get_ProfileAnonymousDownloading().get_CustomApps().Contains(text))
                    {
                        ProgramData programData3 = new ProgramData(text, true);
                        programData2 = programData3;
                        int num = -1;
                        using (IEnumerator <ProgramData> enumerator = this.ProgramDataList.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                ProgramData arg_1BA_0 = enumerator.Current;
                                num++;
                                if (arg_1BA_0.ToolTip.Equals("custom", StringComparison.CurrentCultureIgnoreCase))
                                {
                                    break;
                                }
                            }
                            goto IL_232;
                        }
IL_1E5:
                        programData3.RegName = this.FindRegistryInfo(Path.GetDirectoryName(text) + "\\");
                        this.ProgramDataList.Insert(num, programData3);
                        profileAnonymousDownloading.get_CustomApps().Add(text);
                        this.SendCustomProgramInfoToApi(programData3);
                        goto IL_227;
IL_232:
                        if (num > -1)
                        {
                            goto IL_1E5;
                        }
                    }
                    IL_227 :;
                }
                if (programData2 != null)
                {
                    this.TorrentComboBox.SelectedItem = programData2;
                    profileAnonymousDownloading.set_DownloadToolExeName(programData2.ExeName);
                    profileAnonymousDownloading.set_DownloadToolApplicationPath(programData2.ApplicationExe);
                }
                else
                {
                    this.TorrentComboBox.SelectedIndex = this.TorrentComboBox.Items.Count - 1;
                }
                SettingsHolder.get_Settings().SaveSettingsAsync(false);
                return;
            }
            this.SetSelectedIndexToLastUsedOption(this.TorrentComboBox);
        }