Ejemplo n.º 1
0
                public static SwVersResult Parse(IEnumerable <string> lines)
                {
                    var result = new SwVersResult();

                    foreach (var line in lines)
                    {
                        string[] parts = (line ?? string.Empty).Split(new [] { ':' }, 2);
                        switch (parts[0])
                        {
                        case "ProductName":
                            result.ProductName = parts[1].Trim();
                            break;

                        case "ProductVersion":
                            result.ProductVersion = parts[1].Trim();
                            break;

                        case "BuildVersion":
                            result.BuildVersion = parts[1].Trim();
                            break;
                        }
                    }
                    if (string.IsNullOrEmpty(result.ProductName) ||
                        string.IsNullOrEmpty(result.ProductVersion) ||
                        string.IsNullOrEmpty(result.BuildVersion))
                    {
                        return(null);
                    }
                    return(result);
                }
Ejemplo n.º 2
0
 private IEnumerable <PlatformVersion> ParseResultmacOS(SwVersResult result)
 {
     yield return(new PlatformVersion(result.ProductName.Replace(" ", ""), result.ProductVersion, "MacOSX")
     {
         Attributes =
         {
             BuildVersion(result),
             FriendlyName(result),
             "like MacOSX"
         }
     });
 }
Ejemplo n.º 3
0
            private IEnumerable <PlatformVersion> ParseResultMacOSX(SwVersResult result)
            {
                yield return(new PlatformVersion(result.ProductName.Replace(" ", ""), result.ProductVersion, "MacOSX")
                {
                    Attributes =
                    {
                        BuildVersion(result),
                        FriendlyName(result),
                    }
                });

                // Easing branding into macOS
                if (string.Compare(result.ProductVersion, "10.12") > 0)
                {
                    yield return(new PlatformVersion("macOS", result.ProductVersion, "MacOSX"));
                }
            }
Ejemplo n.º 4
0
            internal IEnumerable <PlatformVersion> ParseResult(IEnumerable <string> lines)
            {
                if (lines == null)
                {
                    return(Array.Empty <PlatformVersion>());
                }
                var result = SwVersResult.Parse(lines);

                if (result == null)
                {
                    return(Array.Empty <PlatformVersion>());
                }
                if (result.ProductName == "macOS")
                {
                    return(ParseResultmacOS(result));
                }
                return(ParseResultMacOSX(result));
            }
Ejemplo n.º 5
0
 static string FriendlyName(SwVersResult result)
 {
     return("\"" + _FriendlyName(result.ProductVersion) + "\"");
 }
Ejemplo n.º 6
0
 static string BuildVersion(SwVersResult result)
 {
     return(string.Format("Build {0}", result.BuildVersion));
 }