Ejemplo n.º 1
0
        private static DomainNameCombiner CreateDomainNameCombiner(string host)
        {
            if (DomainNameCombiner.TryParseCombiner(host, out var result))
            {
                return(result);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static (string Child, string Parent) GetOnlyTwoLevels(this DomainNameCombiner combiner)
        {
            combiner.NotNull(nameof(combiner));

            if (combiner.TopLevelSegment.IsEmpty())
            {
                return(null, combiner.Root);
            }

            if (combiner.SecondLevelSegment.IsEmpty())
            {
                return(null, combiner.TopLevel);
            }

            var child = combiner.Source.TrimEnd($".{combiner.TopLevel}");

            return(child, combiner.TopLevel);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 是指定域名(忽略大小写)。
 /// </summary>
 /// <param name="domainName">给定的 <see cref="DomainNameCombiner"/>。</param>
 /// <returns>返回布尔值。</returns>
 public bool IsDomainName(DomainNameCombiner domainName)
 => DomainName == domainName;