Пример #1
0
        private IXmlRpcHandler NewXmlRpcHandler(Type type, MethodInfo[] mis)
        {
            String[][]            sig      = Util.GetSignature(mis);
            String                help     = Util.GetMethodHelp(type, mis);
            IXmlRpcTargetProvider provider = TargetProviderFactory == null ? null : TargetProviderFactory.GetTargetProvider(type);

            if (sig == null || help == null)
            {
                return(new ReflectiveXmlRpcHandler(this, TypeConverterFactory, type, provider, mis));
            }
            else
            {
                return(new ReflectiveXmlRpcMetaDataHandler(this, TypeConverterFactory, type, provider, mis, sig, help));
            }
        }
Пример #2
0
        protected void RegisterPublicMethods(String key, Type type)
        {
            XmlRpcServiceAttribute serviceAttr = (XmlRpcServiceAttribute)Attribute.GetCustomAttribute(type, typeof(XmlRpcServiceAttribute), true);

            if (key == null)
            {
                key = (serviceAttr == null) ? type.Name : serviceAttr.Name;
            }

            Dictionary <String, MethodInfo[]> map = new Dictionary <String, MethodInfo[]>();

            foreach (Type itf in type.GetInterfaces())
            {
                if (itf == typeof(IXmlRpcHandler))
                {
                    _handlers[key] = new DefaultXmlRpcHandler(this, TargetProviderFactory == null ? null : TargetProviderFactory.GetTargetProvider(type));
                    continue;
                }

                foreach (MethodInfo mi in itf.GetMethods())
                {
                    RegisterMethod(map, mi, key, type);
                }
            }

            foreach (MethodInfo mi in type.GetMethods())
            {
                RegisterMethod(map, mi, key, type);
            }

            foreach (var pair in map)
            {
                _handlers[pair.Key] = NewXmlRpcHandler(type, pair.Value);
            }
        }