Exemple #1
0
        /// <summary>
        /// Indicates if the running OS version matches, or is greater than,
        /// the provided OS.
        /// </summary>
        /// <param name="os">OS to compare running OS to.</param>
        /// <returns>True if the the running OS matches, or is greater
        /// than, the specified OS; otherwise, false.</returns>
        public static bool IsWindowsVersionOrGreater(KnownOS os)
        {
            try {
                OsEntry osEntry = osEntries[os];
                if (!osEntry.MatchesOrGreater.HasValue) {
                    osEntry.MatchesOrGreater = IsWindowsVersionOrGreater(
                        osEntry.MajorVersion, osEntry.MinorVersion,
                        osEntry.ServicePackMajor);
                }

                return osEntry.MatchesOrGreater.Value;
            }
            catch (KeyNotFoundException e) {
                throw new ArgumentException(Resources.UnknownOS, e);
            }
        }
Exemple #2
0
        /// <summary>
        /// Indicates if the running OS version matches, or is greater than,
        /// the provided OS.
        /// </summary>
        /// <param name="os">OS to compare running OS to.</param>
        /// <returns>True if the the running OS matches, or is greater
        /// than, the specified OS; otherwise, false.</returns>
        public static bool IsWindowsVersionOrGreater(KnownOS os)
        {
            try
            {
                OsEntry osEntry = osEntries[os];
                if (!osEntry.MatchesOrGreater.HasValue)
                {
                    osEntry.MatchesOrGreater = IsWindowsVersionOrGreater(
                        osEntry.MajorVersion, osEntry.MinorVersion,
                        osEntry.ServicePackMajor);
                }

                return(osEntry.MatchesOrGreater.Value);
            }
            catch (KeyNotFoundException e)
            {
                throw new ArgumentException("Unknown operating system. " +
                                            "Use overloaded version of IsWindowsVersionOrGreater " +
                                            "with version parameters.", e);
            }
        }
        /// <summary>
        /// Indicates if the running OS version matches, or is greater than,
        /// the provided OS.
        /// </summary>
        /// <param name="os">OS to compare running OS to.</param>
        /// <returns>True if the the running OS matches, or is greater
        /// than, the specified OS; otherwise, false.</returns>
        public static bool IsWindowsVersionOrGreater(KnownOS os)
        {
            try
            {
                OsEntry osEntry = osEntries[os];
                if (!osEntry.MatchesOrGreater.HasValue)
                {
                    osEntry.MatchesOrGreater = IsWindowsVersionOrGreater(
                        osEntry.MajorVersion, osEntry.MinorVersion,
                        osEntry.ServicePackMajor);
                }

                return osEntry.MatchesOrGreater.Value;
            }
            catch (KeyNotFoundException e)
            {
                throw new ArgumentException("UnknownOS", e);
            }
        }