/// <summary> /// Parses the string to a valid Node. /// </summary> /// <param name="s">The s.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">s</exception> /// <exception cref="System.FormatException">Invalid Peer format</exception> public new static Node Parse(string s) { if (string.IsNullOrWhiteSpace(s)) { throw new ArgumentNullException(nameof(s)); } var identity = Identity.Parse(s); var identityString = identity.ToString(); return(new Node { Name = identity.Name, Domain = identity.Domain, Instance = s.Length > identityString.Length ? s.Remove(0, identityString.Length + 1) : null }); }
/// <summary> /// Parses the string to a valid Node. /// </summary> /// <param name="s">The s.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">s</exception> /// <exception cref="System.FormatException">Invalid Peer format</exception> public static new Node Parse(string s) { if (string.IsNullOrWhiteSpace(s)) { throw new ArgumentNullException("s"); } var identity = Identity.Parse(s); var splittedDomain = identity.Domain != null?identity.Domain.Split('/') : null; return(new Node() { Name = identity.Name, Domain = splittedDomain != null ? splittedDomain[0] : null, Instance = splittedDomain != null && splittedDomain.Length > 1 ? splittedDomain[1] : null }); }