コード例 #1
0
        public static string GetOsVersion()
        {
            if (IsMacOSX())
            {
                string systemVersion = ExternalToolsHelper.MacSystemProfilerData.Value.GetValueOrDefault("System Version") ?? "";
                string kernelVersion = ExternalToolsHelper.MacSystemProfilerData.Value.GetValueOrDefault("Kernel Version") ?? "";
                if (!string.IsNullOrEmpty(systemVersion) && !string.IsNullOrEmpty(kernelVersion))
                {
                    return($"{systemVersion} [{kernelVersion}]");
                }
            }

            return(OsBrandStringHelper.Prettify(
                       Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem,
                       Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion,
                       GetWindowsUbr()));
        }
コード例 #2
0
        public static string GetOsVersion()
        {
            if (IsMacOSX())
            {
                string systemVersion = ExternalToolsHelper.MacSystemProfilerData.Value.GetValueOrDefault("System Version") ?? "";
                string kernelVersion = ExternalToolsHelper.MacSystemProfilerData.Value.GetValueOrDefault("Kernel Version") ?? "";
                if (!string.IsNullOrEmpty(systemVersion) && !string.IsNullOrEmpty(kernelVersion))
                {
                    return(OsBrandStringHelper.PrettifyMacOSX(systemVersion, kernelVersion));
                }
            }

            return(OsBrandStringHelper.Prettify(
                       RuntimeEnvironment.OperatingSystem,
                       RuntimeEnvironment.OperatingSystemVersion,
                       GetWindowsUbr()));
        }
コード例 #3
0
 public void WindowsWithUbrIsPrettified(string originalVersion, int ubr, string prettifiedName) =>
 Assert.Equal(prettifiedName, OsBrandStringHelper.Prettify("Windows", originalVersion, ubr));
コード例 #4
0
 internal static string GetOsVersion() => OsBrandStringHelper.Prettify(
     Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem,
     Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion,
     GetWindowsUbr());