Exemple #1
0
        static bool IsVisibleXmlRpcMethod(MethodInfo mi)
        {
            bool ret  = false;
            var  attr = mi.GetCustomAttribute <XmlRpcMethodAttribute>();

            if (attr != null)
            {
                XmlRpcMethodAttribute mattr = (XmlRpcMethodAttribute)attr;
                ret = !(mattr.Hidden || mattr.IntrospectionMethod == true);
            }
            return(ret);
        }
        bool IsStructParamsMethod(MethodInfo mi)
        {
            if (mi == null)
            {
                return(false);
            }
            bool      ret  = false;
            Attribute attr = mi.GetCustomAttribute <XmlRpcMethodAttribute>();

            if (attr != null)
            {
                XmlRpcMethodAttribute mattr = (XmlRpcMethodAttribute)attr;
                ret = mattr.StructParams;
            }
            return(ret);
        }
Exemple #3
0
        public static string GetRpcMethodName(MethodInfo mi)
        {
            string    rpcMethod;
            string    MethodName = mi.Name;
            Attribute attr       = mi.GetCustomAttribute <XmlRpcBeginAttribute>();

            if (attr != null)
            {
                rpcMethod = ((XmlRpcBeginAttribute)attr).Method;
                if (rpcMethod == "")
                {
                    if (!MethodName.StartsWith("Begin") || MethodName.Length <= 5)
                    {
                        throw new Exception(String.Format(
                                                "method {0} has invalid signature for begin method",
                                                MethodName));
                    }
                    rpcMethod = MethodName.Substring(5);
                }
                return(rpcMethod);
            }
            // if no XmlRpcBegin attribute, must have XmlRpcMethod attribute
            attr = mi.GetCustomAttribute <XmlRpcMethodAttribute>();
            if (attr == null)
            {
                throw new Exception("missing method attribute");
            }
            XmlRpcMethodAttribute xrmAttr = attr as XmlRpcMethodAttribute;

            rpcMethod = xrmAttr.Method;
            if (rpcMethod == "")
            {
                rpcMethod = mi.Name;
            }
            return(rpcMethod);
        }