Ejemplo n.º 1
0
        public Array System__Method__Signature___(string MethodName)
        {
            XmlRpcServiceInfo svcInfo  = XmlRpcServiceInfo.CreateServiceInfo(GetType());
            XmlRpcMethodInfo  mthdInfo = svcInfo.GetMethod(MethodName);

            if (mthdInfo == null)
            {
                throw new XmlRpcFaultException(880, "Request for information on unsupported method");
            }
            if (mthdInfo.IsHidden)
            {
                throw new XmlRpcFaultException(881, "Information not available on this method");
            }
            var alist = new ArrayList {
                XmlRpcServiceInfo.GetXmlRpcTypeString(mthdInfo.ReturnType)
            };

            foreach (XmlRpcParameterInfo paramInfo in mthdInfo.Parameters)
            {
                alist.Add(XmlRpcServiceInfo.GetXmlRpcTypeString(paramInfo.Type));
            }
            var types    = (string[])alist.ToArray(typeof(string));
            var retalist = new ArrayList {
                types
            };
            Array retarray = retalist.ToArray(typeof(string[]));

            return(retarray);
        }
Ejemplo n.º 2
0
        public string System__Method__Help___(string MethodName)
        {
            XmlRpcServiceInfo svcInfo  = XmlRpcServiceInfo.CreateServiceInfo(GetType());
            XmlRpcMethodInfo  mthdInfo = svcInfo.GetMethod(MethodName);

            if (mthdInfo == null)
            {
                throw new XmlRpcFaultException(880, "Request for information on unsupported method");
            }
            if (mthdInfo.IsHidden)
            {
                throw new XmlRpcFaultException(881, "Information not available for this method");
            }
            return(mthdInfo.Doc);
        }
Ejemplo n.º 3
0
        public int CompareTo(object obj)
        {
            XmlRpcMethodInfo xmi = (XmlRpcMethodInfo)obj;

            return(this.xmlRpcName.CompareTo(xmi.xmlRpcName));
        }
Ejemplo n.º 4
0
        static void ExtractMethodInfo(Hashtable methods, MethodInfo mi, Type type)
        {
            XmlRpcMethodAttribute attr = (XmlRpcMethodAttribute)
                                         Attribute.GetCustomAttribute(mi,
                                                                      typeof(XmlRpcMethodAttribute));

            if (attr == null)
            {
                return;
            }
            XmlRpcMethodInfo mthdInfo = new XmlRpcMethodInfo();

            mthdInfo.MethodInfo = mi;
            mthdInfo.XmlRpcName = GetXmlRpcMethodName(mi);
            mthdInfo.MiName     = mi.Name;
            mthdInfo.Doc        = attr.Description;
            mthdInfo.IsHidden   = attr.IntrospectionMethod | attr.Hidden;
            // extract parameters information
            ArrayList parmList = new ArrayList();

            ParameterInfo[] parms = mi.GetParameters();
            foreach (ParameterInfo parm in parms)
            {
                XmlRpcParameterInfo parmInfo = new XmlRpcParameterInfo();
                parmInfo.Name       = parm.Name;
                parmInfo.Type       = parm.ParameterType;
                parmInfo.XmlRpcType = GetXmlRpcTypeString(parm.ParameterType);
                // retrieve optional attributed info
                parmInfo.Doc = "";
                XmlRpcParameterAttribute pattr = (XmlRpcParameterAttribute)
                                                 Attribute.GetCustomAttribute(parm,
                                                                              typeof(XmlRpcParameterAttribute));
                if (pattr != null)
                {
                    parmInfo.Doc        = pattr.Description;
                    parmInfo.XmlRpcName = pattr.Name;
                }
                parmInfo.IsParams = Attribute.IsDefined(parm,
                                                        typeof(ParamArrayAttribute));
                parmList.Add(parmInfo);
            }
            mthdInfo.Parameters = (XmlRpcParameterInfo[])
                                  parmList.ToArray(typeof(XmlRpcParameterInfo));
            // extract return type information
            mthdInfo.ReturnType       = mi.ReturnType;
            mthdInfo.ReturnXmlRpcType = GetXmlRpcTypeString(mi.ReturnType);
            object[] orattrs = mi.ReturnTypeCustomAttributes.GetCustomAttributes(
                typeof(XmlRpcReturnValueAttribute), false);
            if (orattrs.Length > 0)
            {
                mthdInfo.ReturnDoc = ((XmlRpcReturnValueAttribute)orattrs[0]).Description;
            }

            if (methods[mthdInfo.XmlRpcName] != null)
            {
                throw new XmlRpcDupXmlRpcMethodNames(String.Format("Method "
                                                                   + "{0} in type {1} has duplicate XmlRpc method name {2}",
                                                                   mi.Name, type.Name, mthdInfo.XmlRpcName));
            }
            else
            {
                methods.Add(mthdInfo.XmlRpcName, mthdInfo);
            }
        }