Пример #1
0
        /// <summary>
        /// 得到Url,如果没有找到,则返回null
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="urlName"></param>
        /// <returns></returns>
        public Uri GetUrl(string groupName, string urlName)
        {
            Uri result = null;

            UriGroupConfigurationElement group = this.Groups[groupName];

            if (group != null)
            {
                UriConfigurationElement uriElement = group.Urls[urlName];

                if (uriElement != null)
                {
                    result = uriElement.Uri;
                }
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 得到某个group下的UriConfigurationElement
        /// </summary>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public Dictionary <string, UriConfigurationElement> GetUrlsInGroup(string groupName)
        {
            groupName.CheckStringIsNullOrEmpty("groupName");

            Dictionary <string, UriConfigurationElement> result = new Dictionary <string, UriConfigurationElement>();

            UriGroupConfigurationElement groupElement = this.Groups[groupName];

            if (groupElement != null)
            {
                for (int i = 0; i < groupElement.Urls.Count; i++)
                {
                    UriConfigurationElement uriElem = groupElement.Urls[i];

                    result[uriElem.Name] = uriElem;
                }
            }

            return(result);
        }