private void Trash_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Label label = sender as Label; if (label == null) { return; } string strB = label.ToolTip.ToString(); int num = 0; ProgramData foundItem = null; int num2 = -1; using (IEnumerator enumerator = ((IEnumerable)this.TorrentComboBox.Items).GetEnumerator()) { while (enumerator.MoveNext()) { ProgramData programData = enumerator.Current as ProgramData; if (programData != null && string.Compare(programData.ToolTip, strB, StringComparison.OrdinalIgnoreCase) == 0) { num2 = num; foundItem = programData; break; } num++; } } try { CgProfileAnonymousDownloading profileAnonymousDownloading = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading(); if (foundItem != null && num2 > -1) { CgProfileAnonymousDownloading arg_BE_0 = profileAnonymousDownloading; string downloadToolExeName; profileAnonymousDownloading.set_DownloadToolApplicationPath(downloadToolExeName = "empty"); arg_BE_0.set_DownloadToolExeName(downloadToolExeName); this.ProgramDataList.RemoveAt(num2); int index = profileAnonymousDownloading.get_CustomApps().FindIndex((string x) => x.Equals(foundItem.ApplicationExe, StringComparison.OrdinalIgnoreCase)); profileAnonymousDownloading.get_CustomApps().RemoveAt(index); SettingsHolder.get_Settings().SaveSettingsAsync(false); } } catch (ArgumentOutOfRangeException ex) { HelperFunctions.DebugLine(string.Format("{0}::{1}:index --> {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message)); } this.TorrentComboBox.SelectedIndex = 0; }
public void FeatureBoxButton_Click(object sender, RoutedEventArgs e) { try { if (this.FeatureBoxButton.IsChecked.HasValue) { this.Checked = this.FeatureBoxButton.IsChecked.Value; } if (this.DataContext is CgProfileAnonymousBrowsing) { CgProfileAnonymousBrowsing profileAnonymousBrowsing = SettingsHolder.get_Settings().get_ProfileAnonymousBrowsing(); this.SetFeaturesInSetting(profileAnonymousBrowsing); } if (this.DataContext is CgProfileAnonymousDownloading) { CgProfileAnonymousDownloading profileAnonymousDownloading = SettingsHolder.get_Settings().get_ProfileAnonymousDownloading(); this.SetFeaturesInSetting(profileAnonymousDownloading); } if (this.DataContext is CgProfileCustom) { CgProfileCustom profileCustom = SettingsHolder.get_Settings().get_ProfileCustom(); this.SetFeaturesInSetting(profileCustom); } if (this.DataContext is CgProfileNetwork) { CgProfileNetwork profileNetwork = SettingsHolder.get_Settings().get_ProfileNetwork(); this.SetFeaturesInSetting(profileNetwork); } if (this.DataContext is CgProfileUnblock) { CgProfileUnblock profileUnblock = SettingsHolder.get_Settings().get_ProfileUnblock(); this.SetFeaturesInSetting(profileUnblock); } if (this.DataContext is CgProfileUncensoring) { CgProfileUncensoring profileUncensoring = SettingsHolder.get_Settings().get_ProfileUncensoring(); this.SetFeaturesInSetting(profileUncensoring); } if (this.DataContext is CgProfileWifi) { CgProfileWifi profileWifi = SettingsHolder.get_Settings().get_ProfileWifi(); this.SetFeaturesInSetting(profileWifi); } if (this.Ident.Equals("FeatureSpeed")) { this.CurrentFeature = 9; } else if (this.Ident.Equals("FeatureMalware")) { this.CurrentFeature = 2; } else if (this.Ident.Equals("FeatureAdBlock")) { this.CurrentFeature = 1; } else if (this.Ident.Equals("FeatureTracking")) { this.CurrentFeature = 4; } else if (this.Ident.Equals("FeatureZip")) { this.CurrentFeature = 3; } else if (this.Ident.Equals("FeatureHttps")) { this.CurrentFeature = 8; } this.SetConversionPopUp(this.CurrentFeature); if (this.CurrentFeature == 9) { this.FeatureBoxButton.IsChecked = new bool?(!ObjectHolder.CurrentUser.IsFreeUser()); this.FeatureBoxButton.IsEnabled = ObjectHolder.CurrentUser.IsFreeUser(); } } catch (Exception arg_1FD_0) { HelperFunctions.DebugLine(arg_1FD_0.Message); } }
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); }