Server/NetworkManager.cs
changeset 118 606c22398045
parent 117 9e48cc704a69
child 123 0df386e37e29
     1.1 --- a/Server/NetworkManager.cs	Mon Feb 09 18:25:14 2015 +0100
     1.2 +++ b/Server/NetworkManager.cs	Mon Feb 09 20:06:30 2015 +0100
     1.3 @@ -62,70 +62,5 @@
     1.4  			Debug.WriteLine("Un-subscribing to INetworkListManagerEvents");
     1.5  			iConnectionPoint.Unadvise(iCookie);
     1.6  		} 
     1.7 -
     1.8 -		/// <summary>
     1.9 -		/// Indicates whether any network connection is available
    1.10 -		/// Filter connections below a specified speed, as well as virtual network cards.
    1.11 -		/// </summary>
    1.12 -		/// <returns>
    1.13 -		///     <c>true</c> if a network connection is available; otherwise, <c>false</c>.
    1.14 -		/// </returns>
    1.15 -		public static bool IsAvailable()
    1.16 -		{
    1.17 -			return IsAvailable(0);
    1.18 -		}
    1.19 -
    1.20 -		/// <summary>
    1.21 -		/// Indicates whether any network connection is available.
    1.22 -		/// Filter connections below a specified speed, as well as virtual network cards.
    1.23 -		/// </summary>
    1.24 -		/// <param name="minimumSpeed">The minimum speed required. Passing 0 will not filter connection using speed.</param>
    1.25 -		/// <returns>
    1.26 -		///     <c>true</c> if a network connection is available; otherwise, <c>false</c>.
    1.27 -		/// </returns>
    1.28 -		public static bool IsAvailable(long minimumSpeed)
    1.29 -		{
    1.30 -			if (!NetworkInterface.GetIsNetworkAvailable())
    1.31 -				return false;
    1.32 -
    1.33 -			foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
    1.34 -			{
    1.35 -				// discard because of standard reasons
    1.36 -				if ((ni.OperationalStatus != OperationalStatus.Up) ||
    1.37 -					(ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) ||
    1.38 -					(ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))
    1.39 -					continue;
    1.40 -
    1.41 -				// this allow to filter modems, serial, etc.
    1.42 -				// I use 10000000 as a minimum speed for most cases
    1.43 -				if (ni.Speed < minimumSpeed)
    1.44 -					continue;
    1.45 -
    1.46 -				// discard virtual cards (virtual box, virtual pc, etc.)
    1.47 -				if ((ni.Description.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0) ||
    1.48 -					(ni.Name.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0))
    1.49 -					continue;
    1.50 -
    1.51 -				// discard "Microsoft Loopback Adapter", it will not show as NetworkInterfaceType.Loopback but as Ethernet Card.
    1.52 -				if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))
    1.53 -					continue;
    1.54 -
    1.55 -				return true;
    1.56 -			}
    1.57 -			return false;
    1.58 -		}
    1.59 -
    1.60 -		/// <summary>
    1.61 -		/// 
    1.62 -		/// </summary>
    1.63 -		/// <returns></returns>
    1.64 -		public static bool HasInternet()
    1.65 -		{
    1.66 -			return false;
    1.67 -			//ConnectionProfile connections = NetworkInformation.GetInternetConnectionProfile();
    1.68 -			//bool internet = connections != null && connections.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
    1.69 -			//return internet;
    1.70 -		}
    1.71 -
    1.72  	}
    1.73  }