Exemple #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);
                }
Exemple #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"
         }
     });
 }
Exemple #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"));
                }
            }
Exemple #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));
            }
Exemple #5
0
 static string FriendlyName(SwVersResult result)
 {
     return("\"" + _FriendlyName(result.ProductVersion) + "\"");
 }
Exemple #6
0
 static string BuildVersion(SwVersResult result)
 {
     return(string.Format("Build {0}", result.BuildVersion));
 }