/// <summary> /// Determines whether the type is definitely unsupported for schema generation. /// </summary> /// <param name="type">The type.</param> /// <returns> /// <c>true</c> if the type is unsupported; otherwise, <c>false</c>. /// </returns> public static bool IsUnsupported(this Type type) => type == typeof(IntPtr) || type == typeof(UIntPtr) || type == typeof(object) || type.GetTypeInfo().ContainsGenericParameters || (!type.IsArray && !type.GetTypeInfo().IsValueType && !type.HasSupportedParameterizedConstructor() && !type.HasParameterlessConstructor() && type != typeof(string) && type != typeof(Uri) && !type.GetTypeInfo().IsAbstract && !type.GetTypeInfo().IsInterface && !(type.GetTypeInfo().IsGenericType&& SupportedInterfaces.Contains(type.GetGenericTypeDefinition())));
/// <summary> /// Determines whether the type is definitely unsupported for schema generation. /// </summary> /// <param name="type">The type.</param> /// <returns> /// <c>true</c> if the type is unsupported; otherwise, <c>false</c>. /// </returns> public static bool IsUnsupported(this Type type) { return(type == typeof(IntPtr) || type == typeof(UIntPtr) || type == typeof(object) || type.ContainsGenericParameters() || (!type.IsArray && !type.IsValueType() && !type.IsAnonymous() && !type.HasParameterlessConstructor() && type != typeof(string) && type != typeof(Uri) && !type.IsAbstract() && !type.IsInterface() && !(type.IsGenericType() && SupportedInterfaces.Contains(type.GetGenericTypeDefinition())))); }
private void ButtonApply_Click(object sender, RoutedEventArgs e) { ButtonApply.IsEnabled = false; if (GoogleRadioButton.IsChecked == true) { PrimaryDNSServer = PrimaryDNSServerGoogle; SecondaryDNSServer = SecondaryDNSServerGoogle; } else if (OpenDNSRadioButton.IsChecked == true) { PrimaryDNSServer = PrimaryDNSServerOpenDNS; SecondaryDNSServer = SecondaryDNSServerOpenDNS; } else if (OpenNICRadioButton.IsChecked == true) { PrimaryDNSServer = PrimaryDNSServerOpenNIC; SecondaryDNSServer = SecondaryDNSServerOpenNIC; } OutputTextBox.Text += Environment.NewLine; OutputTextBox.Text += Environment.NewLine; OutputTextBox.Text += "AutomaticRepair found the following compatible network adapters:"; NetworkInterface[] Interfaces = NetworkInterface.GetAllNetworkInterfaces(); List <NetworkInterface> SupportedInterfaces = null; foreach (NetworkInterface Adapter in Interfaces) { if (Adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet && Adapter.Description.Contains("Virtual") == false || Adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 && Adapter.Description.Contains("Virtual") == false) { OutputTextBox.Text += Environment.NewLine; OutputTextBox.Text += Environment.NewLine + ("Name: " + Adapter.Name); OutputTextBox.Text += Environment.NewLine + (Adapter.Description); OutputTextBox.Text += Environment.NewLine + (String.Empty.PadLeft(Adapter.Description.Length, '=')); if (SupportedInterfaces == null) { SupportedInterfaces = new List <NetworkInterface>(); } SupportedInterfaces.Add(Adapter); } } if (SupportedInterfaces != null) { OutputTextBox.Text += Environment.NewLine; OutputTextBox.Text += Environment.NewLine; OutputTextBox.Text += "AutomaticRepair is starting the command prompt with the command to change all adapters to the selected DNS servers..."; foreach (NetworkInterface Adapter in SupportedInterfaces) { FixNetworkAdapter(Adapter); } } MessageBox.Show("Your DNS server was succesfully changed, all actions are completed.", "", MessageBoxButton.OK, MessageBoxImage.Information); if (AdvancedSettingsExpander.IsExpanded == false) { Close(); } }