Inheritance: System.Attribute
Ejemplo n.º 1
0
        void SetUrl(object clientObj)
        {
            Type type = clientObj.GetType();
            // client can either have define URI in attribute or have set it
            // via proxy's ServiceURI property - but must exist by now
            string useUrl = "";

            if (Url == "")
            {
                Attribute urlAttr = Attribute.GetCustomAttribute(type,
                                                                 typeof(XmlRpcUrlAttribute));
                if (urlAttr != null)
                {
                    XmlRpcUrlAttribute xrsAttr = urlAttr as XmlRpcUrlAttribute;
                    useUrl = xrsAttr.Uri;
                }
            }
            else
            {
                useUrl = Url;
            }
            if (useUrl == "")
            {
                throw new Exception("Url not specified.");
            }
            Url = useUrl;
        }
Ejemplo n.º 2
0
        string GetEffectiveUrl(object clientObj)
        {
            Type type = clientObj.GetType();
            // client can either have define URI in attribute or have set it
            // via proxy's ServiceURI property - but must exist by now
            string useUrl = "";

            if (Url == "" || Url == null)
            {
                Attribute urlAttr = Attribute.GetCustomAttribute(type,
                                                                 typeof(XmlRpcUrlAttribute));
                if (urlAttr != null)
                {
                    XmlRpcUrlAttribute xrsAttr = urlAttr as XmlRpcUrlAttribute;
                    useUrl = xrsAttr.Uri;
                }
            }
            else
            {
                useUrl = Url;
            }
            if (useUrl == "")
            {
                throw new XmlRpcMissingUrl("Proxy XmlRpcUrl attribute or Url "
                                           + "property not set.");
            }
            return(useUrl);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetUrlFromAttribute(Type type)
        {
            XmlRpcUrlAttribute urlAttr = Attribute.GetCustomAttribute(type, typeof(XmlRpcUrlAttribute))
                                         as XmlRpcUrlAttribute;

            return(urlAttr != null ? urlAttr.Uri : null);
        }
Ejemplo n.º 4
0
        private static string GetXmlRpcUrl(Type itf)
        {
            Attribute attr = Attribute.GetCustomAttribute(itf,
                                                          typeof(XmlRpcUrlAttribute));

            if (attr == null)
            {
                return(null);
            }
            XmlRpcUrlAttribute xruAttr = attr as XmlRpcUrlAttribute;
            string             url     = xruAttr.Uri;

            return(url);
        }