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()));
        }
        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()));
        }
 public void WindowsWithUbrIsPrettified(string originalVersion, int ubr, string prettifiedName) =>
 Assert.Equal(prettifiedName, OsBrandStringHelper.Prettify("Windows", originalVersion, ubr));
Beispiel #4
0
 internal static string GetOsVersion() => OsBrandStringHelper.Prettify(
     Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem,
     Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion,
     GetWindowsUbr());