// 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); } }
public void RemoveMethod(XmlRpcServerMethod method) { foreach (var rec in _methods) { if (method == rec.Value) { _methods.Remove(rec.Key); break; } } }
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()); }
// 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); }
public void AddMethod(XmlRpcServerMethod method) { _methods.Add(method.name, method); }
// 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); } }