Beispiel #1
0
        // Introspection support


        // Specify whether introspection is enabled or not. Default is enabled.
        public void enableIntrospection(bool enabled)
        {
            if (_introspectionEnabled == enabled)
            {
                return;
            }

            _introspectionEnabled = enabled;

            if (enabled)
            {
                if (_listMethods == null)
                {
                    _listMethods = new ListMethods(this);
                    _methodHelp  = new MethodHelp(this);
                }
                else
                {
                    AddMethod(_listMethods);
                    AddMethod(_methodHelp);
                }
            }
            else
            {
                RemoveMethod(LIST_METHODS);
                RemoveMethod(METHOD_HELP);
            }
        }
Beispiel #2
0
 public void RemoveMethod(XmlRpcServerMethod method)
 {
     foreach (var rec in _methods)
     {
         if (method == rec.Value)
         {
             _methods.Remove(rec.Key);
             break;
         }
     }
 }
Beispiel #3
0
 public void RemoveMethod(XmlRpcServerMethod method)
 {
     foreach (var rec in _methods)
     {
         if (method == rec.Value)
         {
             _methods.Remove(rec.Key);
             break;
         }
     }
 }
Beispiel #4
0
            private void execute(XmlRpcValue parms, XmlRpcValue result)
            {
                if (parms[0].Type != XmlRpcValue.ValueType.TypeString)
                {
                    throw new XmlRpcException(METHOD_HELP + ": Invalid argument type");
                }

                XmlRpcServerMethod m = server.FindMethod(parms[0].GetString());

                if (m == null)
                {
                    throw new XmlRpcException(METHOD_HELP + ": Unknown method name");
                }

                result.Set(m.Help());
            }
Beispiel #5
0
        // Execute a named method with the specified params.
        public bool executeMethod(string methodName, XmlRpcValue parms, XmlRpcValue result)
        {
            XmlRpcServerMethod method = FindMethod(methodName);

            if (method == null)
            {
                return(false);
            }

            method.Execute(parms, result);

            // Ensure a valid result value
            if (!result.Valid)
            {
                result.Set("");
            }

            return(true);
        }
Beispiel #6
0
 public void AddMethod(XmlRpcServerMethod method)
 {
     _methods.Add(method.name, method);
 }
Beispiel #7
0
 public void AddMethod(XmlRpcServerMethod method)
 {
     _methods.Add(method.name, method);
 }
Beispiel #8
0
        // Introspection support


        // Specify whether introspection is enabled or not. Default is enabled.
        public void enableIntrospection(bool enabled)
        {
            if (_introspectionEnabled == enabled)
                return;

            _introspectionEnabled = enabled;

            if (enabled)
            {
                if (_listMethods == null)
                {
                    _listMethods = new ListMethods(this);
                    _methodHelp = new MethodHelp(this);
                }
                else
                {
                    AddMethod(_listMethods);
                    AddMethod(_methodHelp);
                }
            }
            else
            {
                RemoveMethod(LIST_METHODS);
                RemoveMethod(METHOD_HELP);
            }
        }