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; }
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); }
/// <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); }
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); }