示例#1
0
        private static PlatformDimension Parse(string userAgent)
        {
            PlatformDimension result;

            var parsed = _parser.ParseOS(userAgent);
            if (parsed != null)
            {
                result = new PlatformDimension();
                result.OSFamily = parsed.Family;
                result.Major = string.IsNullOrWhiteSpace(parsed.Major) ? _zeroString : parsed.Major;
                result.Minor = string.IsNullOrWhiteSpace(parsed.Minor) ? _zeroString : parsed.Minor;
                result.Patch = string.IsNullOrWhiteSpace(parsed.Patch) ? _zeroString : parsed.Patch;
                result.PatchMinor = string.IsNullOrWhiteSpace(parsed.PatchMinor) ? _zeroString : parsed.PatchMinor;
            }
            else
            {
                // Unknown platform
                result = Unknown;
            }
            return result;
        }
示例#2
0
        private static PlatformDimension Parse(string userAgent)
        {
            PlatformDimension result;

            var parsed = _parser.ParseOS(userAgent);

            if (parsed != null)
            {
                result            = new PlatformDimension();
                result.OSFamily   = parsed.Family;
                result.Major      = string.IsNullOrWhiteSpace(parsed.Major) ? _zeroString : parsed.Major;
                result.Minor      = string.IsNullOrWhiteSpace(parsed.Minor) ? _zeroString : parsed.Minor;
                result.Patch      = string.IsNullOrWhiteSpace(parsed.Patch) ? _zeroString : parsed.Patch;
                result.PatchMinor = string.IsNullOrWhiteSpace(parsed.PatchMinor) ? _zeroString : parsed.PatchMinor;
            }
            else
            {
                // Unknown platform
                result = Unknown;
            }
            return(result);
        }