Inheritance: IPGlobalProperties
Exemplo n.º 1
0
        /// <summary>Gets an object that provides information about the local computer's network connectivity and traffic statistics.</summary>
        /// <returns>A <see cref="T:System.Net.NetworkInformation.IPGlobalProperties" /> object that contains information about the local computer.</returns>
        /// <PermissionSet>
        ///   <IPermission class="System.Net.NetworkInformation.NetworkInformationPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Access="Read" />
        /// </PermissionSet>
        public static IPGlobalProperties GetIPGlobalProperties()
        {
            PlatformID platform = Environment.OSVersion.Platform;

            if (platform != PlatformID.Unix)
            {
                return(new Win32IPGlobalProperties());
            }
            if (Directory.Exists("/proc"))
            {
                MibIPGlobalProperties mibIPGlobalProperties = new MibIPGlobalProperties("/proc");
                if (File.Exists(mibIPGlobalProperties.StatisticsFile))
                {
                    return(mibIPGlobalProperties);
                }
            }
            if (Directory.Exists("/usr/compat/linux/proc"))
            {
                MibIPGlobalProperties mibIPGlobalProperties = new MibIPGlobalProperties("/usr/compat/linux/proc");
                if (File.Exists(mibIPGlobalProperties.StatisticsFile))
                {
                    return(mibIPGlobalProperties);
                }
            }
            throw new NotSupportedException("This platform is not supported");
        }
Exemplo n.º 2
0
        public static IPGlobalProperties GetIPGlobalProperties()
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                MibIPGlobalProperties impl = null;
                if (Directory.Exists(MibIPGlobalProperties.ProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.ProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                if (Directory.Exists(MibIPGlobalProperties.CompatProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.CompatProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                throw new NotSupportedException("This platform is not supported");

            default:
                return(new Win32IPGlobalProperties());
            }
        }
Exemplo n.º 3
0
        public static IPGlobalProperties GetIPGlobalProperties()
        {
#if MONODROID
            return(new AndroidIPGlobalProperties());
#else
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                MibIPGlobalProperties impl = null;
                if (Directory.Exists(MibIPGlobalProperties.ProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.ProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                if (Directory.Exists(MibIPGlobalProperties.CompatProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.CompatProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                return(new UnixIPGlobalProperties());

            default:
                return(new Win32IPGlobalProperties());
            }
#endif
        }
        public static IPGlobalProperties GetIPGlobalProperties()
        {
#if MONODROID
            return new AndroidIPGlobalProperties ();
#elif MONOTOUCH || XAMMAC || MOBILE
            return new UnixIPGlobalProperties ();
#elif MONO
            switch (Environment.OSVersion.Platform) {
            case PlatformID.Unix:
                MibIPGlobalProperties impl = null;
                if (Directory.Exists (MibIPGlobalProperties.ProcDir)) {
                    impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir);
                    if (File.Exists (impl.StatisticsFile))
                        return impl;
                }
                if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) {
                    impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir);
                    if (File.Exists (impl.StatisticsFile))
                        return impl;
                }
                return new UnixIPGlobalProperties ();
            default:
                return new Win32IPGlobalProperties ();
            }
#else          
            (new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
            return new SystemIPGlobalProperties();
#endif
        }
Exemplo n.º 5
0
		public static IPGlobalProperties GetIPGlobalProperties ()
		{
#if MONODROID
			return new AndroidIPGlobalProperties ();
#elif MONOTOUCH || XAMMAC || MOBILE_STATIC
			return new UnixIPGlobalProperties ();
#else
			switch (Environment.OSVersion.Platform) {
			case PlatformID.Unix:
				MibIPGlobalProperties impl = null;
				if (Directory.Exists (MibIPGlobalProperties.ProcDir)) {
					impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir);
					if (File.Exists (impl.StatisticsFile))
						return impl;
				}
				if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) {
					impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir);
					if (File.Exists (impl.StatisticsFile))
						return impl;
				}
				return new UnixIPGlobalProperties ();
			default:
				return new Win32IPGlobalProperties ();
			}
#endif
		}
Exemplo n.º 6
0
		public static IPGlobalProperties GetIPGlobalProperties ()
		{
			switch (Environment.OSVersion.Platform) {
			case PlatformID.Unix:
				MibIPGlobalProperties impl = null;
				if (Directory.Exists (MibIPGlobalProperties.ProcDir)) {
					impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir);
					if (File.Exists (impl.StatisticsFile))
						return impl;
				}
				if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) {
					impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir);
					if (File.Exists (impl.StatisticsFile))
						return impl;
				}
				throw new NotSupportedException ("This platform is not supported");
			default:
				return new Win32IPGlobalProperties ();
			}
		}
Exemplo n.º 7
0
        public static IPGlobalProperties GetIPGlobalProperties()
        {
#if MONODROID
            return(new AndroidIPGlobalProperties());
#elif MONOTOUCH || XAMMAC
            return(new UnixIPGlobalProperties());
#elif MONO
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                MibIPGlobalProperties impl = null;
                if (Directory.Exists(MibIPGlobalProperties.ProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.ProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                if (Directory.Exists(MibIPGlobalProperties.CompatProcDir))
                {
                    impl = new MibIPGlobalProperties(MibIPGlobalProperties.CompatProcDir);
                    if (File.Exists(impl.StatisticsFile))
                    {
                        return(impl);
                    }
                }
                return(new UnixIPGlobalProperties());

            default:
#if WIN_PLATFORM
                return(new Win32IPGlobalProperties());
#else
                return(new UnixIPGlobalProperties());
#endif
            }
#else
            (new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
            return(new SystemIPGlobalProperties());
#endif
        }