public static void ImportSmartProfile(SmartProfile sp) { Settings.Default.Smart_HTTP_List = string.Join(Environment.NewLine, sp.HttpRules); Settings.Default.Smart_Direct_List = string.Join(Environment.NewLine, sp.DirectRules); Settings.Default.Smart_AntiDNSPattern = sp.AntiDnsPoisoningRule; Settings.Default.Smart_HTTP_AutoRoute_Pattern = sp.AntiBlockPageRule; Settings.Default.Smart_HTTP_Enable = sp.IsHttpSupported; Settings.Default.Smart_HTTPS_Enable = sp.IsHttpsSupported; Settings.Default.Smart_SOCKS_Enable = sp.IsSocksSupported; Settings.Default.Smart_HTTP_AutoRoute_Enable = sp.HttpBlockPageDetection; Settings.Default.Smart_AntiDNS_Enable = sp.DnsPoisoningDetection; Settings.Default.Smart_Timeout_Enable = sp.TimeoutDetection; Settings.Default.Smart_Timeout_Value = (ushort)sp.DirectTimeout; Settings.Default.Smart_Direct_AutoRoutePort80AsHTTP = sp.TreatPort80AsHttp; }
private void WizardPanelPageChanged(object sender, RoutedEventArgs e) { try { if (this.WizardPanel.CurrentPage != null && this.WizardPanel.CurrentPage.Equals(this.FinishPage)) { this.WizardPanel.CanCancel = false; this.SummeryListBox.Items.Clear(); ListBoxItem selectedItem = this.CountryPage.SelectedItem as ListBoxItem; if (selectedItem != null) { Settings.Default.SelectedProfile = (selectedItem.Tag as string ?? string.Empty).Trim(); switch (selectedItem.Tag as string) { case "IR": ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart_IR)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Enable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Enable"); this.SummeryListBox.Items.Add("SmartPear Profile: Iran"); break; case "CH": ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart_CH)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Disable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Disable"); this.SummeryListBox.Items.Add("SmartPear Profile: China"); break; case "AE": ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart_AE)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Disable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Disable"); break; case "SA": ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart_SA)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Disable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Disable"); break; case "PK": ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart_PK)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Disable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Disable"); break; default: ImportSmartProfile(SmartProfile.FromXml(Properties.Resources.Smart)); this.SummeryListBox.Items.Add("SmartPear for HTTP connections: Disable"); this.SummeryListBox.Items.Add("SmartPear for Direct connections: Disable"); break; } } if (this.TapRadioButton.IsChecked == true) { Settings.Default.Grabber = (int)Grabber.GrabberType.Tap; } else if (this.HookRadioButton.IsChecked == true) { Settings.Default.Grabber = (int)Grabber.GrabberType.Hook; } else if (this.ProxyRadioButton.IsChecked == true) { Settings.Default.Grabber = (int)Grabber.GrabberType.Proxy; } else { Settings.Default.Grabber = (int)Grabber.GrabberType.None; } this.SummeryListBox.Items.Add( "Selected Traffic Grabber: " + (Grabber.GrabberType)Settings.Default.Grabber); if (this.HookRadioButton.IsChecked == true) { Settings.Default.Hook_Processes = string.Join( Environment.NewLine, this.ApplicationsListBox.Items.OfType <string>().ToArray()); this.SummeryListBox.Items.Add( "Hook into following applications: " + string.Join(" | ", this.ApplicationsListBox.Items.OfType <string>().ToArray())); } } else { this.WizardPanel.CanCancel = true; } } catch (Exception) { } }