// //Get Connection Profile name and cost information // string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } //Get Connection Cost information ConnectionCost connectionCost = connectionProfile.GetConnectionCost(); connectionProfileInfo += GetConnectionCostInfo(connectionCost); //Get Dataplan Status information DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus(); connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus); //Get Network Security Settings NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings; connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings); } return(connectionProfileInfo); }
// //Get Network Security Settings information // string GetNetworkSecuritySettingsInfo(NetworkSecuritySettings netSecuritySettings) { string networkSecurity = string.Empty; networkSecurity += "Network Security Settings: \n"; networkSecurity += "====================\n"; if (netSecuritySettings == null) { networkSecurity += "Network Security Settings not available\n"; return(networkSecurity); } //NetworkAuthenticationType switch (netSecuritySettings.NetworkAuthenticationType) { case NetworkAuthenticationType.None: networkSecurity += "NetworkAuthenticationType: None"; break; case NetworkAuthenticationType.Unknown: networkSecurity += "NetworkAuthenticationType: Unknown"; break; case NetworkAuthenticationType.Open80211: networkSecurity += "NetworkAuthenticationType: Open80211"; break; case NetworkAuthenticationType.SharedKey80211: networkSecurity += "NetworkAuthenticationType: SharedKey80211"; break; case NetworkAuthenticationType.Wpa: networkSecurity += "NetworkAuthenticationType: Wpa"; break; case NetworkAuthenticationType.WpaPsk: networkSecurity += "NetworkAuthenticationType: WpaPsk"; break; case NetworkAuthenticationType.WpaNone: networkSecurity += "NetworkAuthenticationType: WpaNone"; break; case NetworkAuthenticationType.Rsna: networkSecurity += "NetworkAuthenticationType: Rsna"; break; case NetworkAuthenticationType.RsnaPsk: networkSecurity += "NetworkAuthenticationType: RsnaPsk"; break; default: networkSecurity += "NetworkAuthenticationType: Error"; break; } networkSecurity += "\n"; //NetworkEncryptionType switch (netSecuritySettings.NetworkEncryptionType) { case NetworkEncryptionType.None: networkSecurity += "NetworkEncryptionType: None"; break; case NetworkEncryptionType.Unknown: networkSecurity += "NetworkEncryptionType: Unknown"; break; case NetworkEncryptionType.Wep: networkSecurity += "NetworkEncryptionType: Wep"; break; case NetworkEncryptionType.Wep40: networkSecurity += "NetworkEncryptionType: Wep40"; break; case NetworkEncryptionType.Wep104: networkSecurity += "NetworkEncryptionType: Wep104"; break; case NetworkEncryptionType.Tkip: networkSecurity += "NetworkEncryptionType: Tkip"; break; case NetworkEncryptionType.Ccmp: networkSecurity += "NetworkEncryptionType: Ccmp"; break; case NetworkEncryptionType.WpaUseGroup: networkSecurity += "NetworkEncryptionType: WpaUseGroup"; break; case NetworkEncryptionType.RsnUseGroup: networkSecurity += "NetworkEncryptionType: RsnUseGroup"; break; default: networkSecurity += "NetworkEncryptionType: Error"; break; } networkSecurity += "\n"; return(networkSecurity); }
// //Get Connection Profile name and cost information // string GetConnectionProfile(ConnectionProfile connectionProfile) { string connectionProfileInfo = string.Empty; if (connectionProfile != null) { connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n"; switch (connectionProfile.GetNetworkConnectivityLevel()) { case NetworkConnectivityLevel.None: connectionProfileInfo += "Connectivity Level : None\n"; break; case NetworkConnectivityLevel.LocalAccess: connectionProfileInfo += "Connectivity Level : Local Access\n"; break; case NetworkConnectivityLevel.ConstrainedInternetAccess: connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n"; break; case NetworkConnectivityLevel.InternetAccess: connectionProfileInfo += "Connectivity Level : Internet Access\n"; break; } switch (connectionProfile.GetDomainConnectivityLevel()) { case DomainConnectivityLevel.None: connectionProfileInfo += "Domain Connectivity Level : None\n"; break; case DomainConnectivityLevel.Unauthenticated: connectionProfileInfo += "Domain Connectivity Level : Unauthenticated\n"; break; case DomainConnectivityLevel.Authenticated: connectionProfileInfo += "Domain Connectivity Level : Authenticated\n"; break; } //Get Connection Cost information ConnectionCost connectionCost = connectionProfile.GetConnectionCost(); connectionProfileInfo += GetConnectionCostInfo(connectionCost); //Get Dataplan Status information DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus(); connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus); //Get Network Security Settings NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings; connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings); //Get Wlan Connection Profile Details if this is a Wlan ConnectionProfile if (connectionProfile.IsWlanConnectionProfile) { WlanConnectionProfileDetails wlanConnectionProfileDetails = connectionProfile.WlanConnectionProfileDetails; connectionProfileInfo += GetWlanConnectionProfileDetailsInfo(wlanConnectionProfileDetails); } //Get Wwan Connection Profile Details if this is a Wwan ConnectionProfile if (connectionProfile.IsWwanConnectionProfile) { WwanConnectionProfileDetails wwanConnectionProfileDetails = connectionProfile.WwanConnectionProfileDetails; connectionProfileInfo += GetWwanConnectionProfileDetailsInfo(wwanConnectionProfileDetails); } //Get the Service Provider GUID if (connectionProfile.ServiceProviderGuid.HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Service Provider GUID: " + connectionProfile.ServiceProviderGuid + "\n"; } //Get the number of signal bars if (connectionProfile.GetSignalBars().HasValue) { connectionProfileInfo += "====================\n"; connectionProfileInfo += "Signal Bars: " + connectionProfile.GetSignalBars() + "\n"; } } return(connectionProfileInfo); }