示例#1
0
        public static bool TryGetCanonical(string inputAddress, bool stripDdas, out string canonicalAddress, out bool endingWithSemicolon)
        {
            canonicalAddress = null;
            IList <string> components = null;

            return(X400AddressParser.TryParse(inputAddress, 21, false, false, out components, out endingWithSemicolon) && X400AddressParser.TryGetCanonical(components, stripDdas, out canonicalAddress));
        }
示例#2
0
        public static bool TryParse(string s, out X400Domain result)
        {
            IList <string> list;

            if (X400AddressParser.TryParse(s, out list))
            {
                int i = list.Count - 1;
                while (i >= 0 && string.IsNullOrEmpty(list[i]))
                {
                    list.RemoveAt(i--);
                }
                for (i = 0; i < list.Count; i++)
                {
                    if (list[i] == string.Empty)
                    {
                        list[i] = null;
                    }
                    else if (!X400Domain.IsValidComponent(i, list[i]))
                    {
                        result = null;
                        return(false);
                    }
                }
                if (list.Count > 0 && list.Count < 8)
                {
                    result = new X400Domain(list);
                    return(true);
                }
            }
            result = null;
            return(false);
        }
        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);
        }
示例#4
0
        public static bool TryParse(string s, out IList <string> components)
        {
            bool flag;

            return(X400AddressParser.TryParse(s, 21, false, false, out components, out flag));
        }
示例#5
0
        public static bool TryParse(string s, int maxComponentsCount, bool addressSpace, bool locallyScoped, out IList <string> components)
        {
            bool flag;

            return(X400AddressParser.TryParse(s, maxComponentsCount, addressSpace, locallyScoped, out components, out flag));
        }