/// <summary> /// Define name and version using match /// </summary> /// <param name="match">Match</param> /// <param name="obj">Target object</param> private static void NameVersionAction(Match match, object obj) { //Define client browser ClientBrowser current = obj as ClientBrowser; //Set name current.Name = new Regex(@"^[a-zA-Z]+", RegexOptions.IgnoreCase).Match(match.Value).Value; //With name, set version if (match.Value.Length > current.Name.Length) { current.Version = match.Value.Substring(current.Name.Length + 1); } }
/// <summary> /// Constructor /// </summary> /// <param name="userAgent">User agent string</param> public ClientCapabilities(string userAgent) { //Arguments validation if (string.IsNullOrEmpty(userAgent)) { throw new ArgumentNullException(nameof(userAgent)); } //Set values UserAgent = userAgent; //Build client browser and os ClientBrowser = new ClientBrowser(userAgent); ClientOs = new ClientOs(userAgent); }