public bool Match(RoutingX400Address address) { if (address == null || address.ComponentsCount < this.components.Count) { return(false); } for (int i = 0; i < this.components.Count; i++) { if (!X400Domain.MatchOneComponent(this.components[i], address[i])) { return(false); } } return(true); }
private static bool TryParse(string s, bool addressSpace, bool locallyScoped, out RoutingX400Address address) { address = null; IList <string> list = null; if (!X400AddressParser.TryParse(s, 8, addressSpace, locallyScoped, out list)) { return(false); } int i = 8; if (addressSpace) { while (i > 0) { if (list[i - 1] != null) { break; } list.RemoveAt(--i); } while (i > 0) { string text = list[i - 1]; if (text == null || !text.Equals("*", StringComparison.OrdinalIgnoreCase)) { break; } list.RemoveAt(--i); } } while (i > 0) { if (list[i - 1] == null) { list[i - 1] = string.Empty; } i--; } address = new RoutingX400Address(list); return(true); }
private void Initialize(string addressType, string addressSpace, int cost, bool includeSubDomain, bool performFullAddressTypeValidation) { if (string.IsNullOrEmpty(addressType)) { throw new StrongTypeFormatException(DataStrings.InvalidAddressSpaceTypeNullOrEmpty, "Type"); } this.type = addressType; this.Cost = cost; if (this.IsSmtpType) { this.smtpDomainWithSubdomains = new SmtpDomainWithSubdomains(addressSpace, includeSubDomain); return; } if (addressSpace != null) { addressSpace = addressSpace.ToLower(); } if (this.IsX400Type) { if (!RoutingX400Address.TryParseAddressSpace(addressSpace, this.isLocal, out this.x400Address)) { throw new StrongTypeFormatException(DataStrings.InvalidX400AddressSpace(addressSpace), "Domain"); } this.addressSpace = addressSpace; return; } else { if (string.IsNullOrEmpty(addressSpace)) { throw new StrongTypeFormatException(DataStrings.InvalidAddressSpaceAddress, "Domain"); } if (performFullAddressTypeValidation && !ProxyAddressPrefix.IsPrefixStringValid(addressType)) { throw new StrongTypeFormatException(DataStrings.InvalidAddressSpaceType(addressType), "Type"); } this.addressSpace = addressSpace.Replace("(a)", "@"); return; } }
public static bool TryParseAddressSpace(string s, bool locallyScoped, out RoutingX400Address address) { return(RoutingX400Address.TryParse(s, true, locallyScoped, out address)); }
public static bool TryParse(string s, out RoutingX400Address address) { return(RoutingX400Address.TryParse(s, false, false, out address)); }