Beispiel #1
0
        public T GetBestMatch(SmtpDomain domain)
        {
            if (domain == null)
            {
                return(default(T));
            }
            DomainMatchMap <T> .SubString subString = new DomainMatchMap <T> .SubString(domain.Domain, 0);

            T result;

            if (this.exact.TryGetValue(subString, out result))
            {
                return(result);
            }
            int[] array = DomainMatchMap <T> .FindAllDots(domain.Domain);

            for (int i = (array.Length > this.maxDots) ? (array.Length - this.maxDots) : 0; i < array.Length; i++)
            {
                subString.SetIndex(array[i] + 1);
                if (this.wildcard.TryGetValue(subString, out result))
                {
                    return(result);
                }
            }
            return(this.star);
        }
Beispiel #2
0
        public T GetBestMatch(string domainName)
        {
            SmtpDomain domain;

            SmtpDomain.TryParse(domainName, out domain);
            return(this.GetBestMatch(domain));
        }
 public SmtpDomainWithSubdomains(SmtpDomain domain, bool includeSubdomains)
 {
     if (domain == null && !includeSubdomains)
     {
         throw new StrongTypeFormatException(DataStrings.InvalidSmtpDomain, "Domain");
     }
     this.domain            = domain;
     this.includeSubdomains = includeSubdomains;
 }
Beispiel #4
0
 public static bool TryParse(string domain, out SmtpDomain obj)
 {
     obj = null;
     if (!string.IsNullOrEmpty(domain) && SmtpAddress.IsValidDomain(domain))
     {
         obj = new SmtpDomain(domain, false);
         return(true);
     }
     return(false);
 }
 internal static MbxPropertyDefinition SmtpDomainFromStringPropertyDefinition(string name, MbxPropertyDefinition rawPropertyDefinition, bool multivalued = false)
 {
     return(new MbxPropertyDefinition(name, PropTag.Null, ExchangeObjectVersion.Exchange2003, typeof(SmtpDomain), (multivalued ? PropertyDefinitionFlags.MultiValued : PropertyDefinitionFlags.None) | PropertyDefinitionFlags.Calculated, null, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, new MbxPropertyDefinition[]
     {
         rawPropertyDefinition
     }, delegate(IPropertyBag propertyBag)
     {
         if (propertyBag[rawPropertyDefinition] != null)
         {
             return SmtpDomain.Parse((string)propertyBag[rawPropertyDefinition]);
         }
         return null;
     }, delegate(object value, IPropertyBag propertyBag)
     {
         propertyBag[rawPropertyDefinition] = ((SmtpDomain)value).ToString();
     }));
 }
 private static bool InternalTryParse(string s, out SmtpDomain domain, out bool includeSubdomains)
 {
     domain            = null;
     includeSubdomains = false;
     if (string.IsNullOrEmpty(s) || s.Trim().Length == 0)
     {
         return(false);
     }
     if (s.Length == 1 && string.Equals(s, "*", StringComparison.OrdinalIgnoreCase))
     {
         domain            = null;
         includeSubdomains = true;
         return(true);
     }
     includeSubdomains = s.StartsWith("*.", StringComparison.OrdinalIgnoreCase);
     if (includeSubdomains)
     {
         s = s.Substring(2);
     }
     return(SmtpDomain.TryParse(s, out domain));
 }
 // Token: 0x06000AF7 RID: 2807 RVA: 0x0003208B File Offset: 0x0003028B
 public static bool IsConsumerDomain(SmtpDomain domainName)
 {
     return(domainName != null && Globals.IsDatacenter && ConsumerIdentityHelper.IsConsumerMailbox("@" + domainName.Domain));
 }
Beispiel #8
0
        public override bool Equals(object comparand)
        {
            SmtpDomain smtpDomain = comparand as SmtpDomain;

            return(smtpDomain != null && this.Equals(smtpDomain));
        }
Beispiel #9
0
 public bool Equals(SmtpDomain rhs)
 {
     return(rhs != null && this.domain.Equals(rhs.domain, StringComparison.OrdinalIgnoreCase));
 }