当前位置: 首页>>代码示例>>C#>>正文


C# XmlRpc.XmlRpcResponse类代码示例

本文整理汇总了C#中Nwc.XmlRpc.XmlRpcResponse的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcResponse类的具体用法?C# XmlRpcResponse怎么用?C# XmlRpcResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlRpcResponse类属于Nwc.XmlRpc命名空间,在下文中一共展示了XmlRpcResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LinkRegionRequest

        /// <summary>
        /// Someone wants to link to us
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            //string host = (string)requestData["host"];
            //string portstr = (string)requestData["port"];
            string name = (string)requestData["region_name"];
            if (name == null)
                name = string.Empty;

            UUID regionID = UUID.Zero;
            string externalName = string.Empty;
            string imageURL = string.Empty;
            ulong regionHandle = 0;
            string reason = string.Empty;

            bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason);

            Hashtable hash = new Hashtable();
            hash["result"] = success.ToString();
            hash["uuid"] = regionID.ToString();
            hash["handle"] = regionHandle.ToString();
            hash["region_image"] = imageURL;
            hash["external_name"] = externalName;

            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = hash;
            return response;
        }
开发者ID:SignpostMarv,项目名称:opensim,代码行数:33,代码来源:HypergridHandlers.cs

示例2: Respond

    /// <summary>Handle an HTTP request containing an XML-RPC request.</summary>
    /// <remarks>This method deserializes the XML-RPC request, invokes the 
    /// described method, serializes the response (or fault) and sends the XML-RPC response
    /// back as a valid HTTP page.
    /// </remarks>
    /// <param name="httpReq"><c>SimpleHttpRequest</c> containing the request.</param>
    public void Respond(SimpleHttpRequest httpReq)
      {
	XmlRpcRequest xmlRpcReq = (XmlRpcRequest)_deserializer.Deserialize(httpReq.Input);
	XmlRpcResponse xmlRpcResp = new XmlRpcResponse();

	try
	  {
	    xmlRpcResp.Value = _server.Invoke(xmlRpcReq);
	  }
	catch (XmlRpcException e)
	  {
	    xmlRpcResp.SetFault(e.FaultCode, e.FaultString);
	  }
	catch (Exception e2)
	  {
	    xmlRpcResp.SetFault(XmlRpcErrorCodes.APPLICATION_ERROR, 
			  XmlRpcErrorCodes.APPLICATION_ERROR_MSG + ": " + e2.Message);
	  }

	if (Logger.Delegate != null)
	  Logger.WriteEntry(xmlRpcResp.ToString(), LogLevel.Information);

	XmlRpcServer.HttpHeader(httpReq.Protocol, "text/xml", 0, " 200 OK", httpReq.Output);
	httpReq.Output.Flush();
	XmlTextWriter xml = new XmlTextWriter(httpReq.Output);
	_serializer.Serialize(xml, xmlRpcResp);
	xml.Flush();
	httpReq.Output.Flush();
      }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:35,代码来源:XmlRpcResponder.cs

示例3: XmlRPCGetAvatarAppearance

        public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            XmlRpcResponse response = new XmlRpcResponse();
            Hashtable requestData = (Hashtable)request.Params[0];
            AvatarAppearance appearance;
            Hashtable responseData;
            if (requestData.Contains("owner"))
            {
                appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"]));
                if (appearance == null)
                {
                    responseData = new Hashtable();
                    responseData["error_type"] = "no appearance";
                    responseData["error_desc"] = "There was no appearance found for this avatar";
                }
                else
                {
                    responseData = appearance.ToHashTable();
                }
            }
            else
            {
                responseData = new Hashtable();
                responseData["error_type"] = "unknown_avatar";
                responseData["error_desc"] = "The avatar appearance requested is not in the database";
            }

            response.Value = responseData;
            return response;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:30,代码来源:UserServerAvatarAppearanceModule.cs

示例4: Parse

    public static XmlRpcResponse Parse(StreamReader xmlData)
      {
	XmlTextReader reader = new XmlTextReader(xmlData);
	XmlRpcResponse response = new XmlRpcResponse();
	bool done = false;

	while (!done && reader.Read())
	  {
	    Singleton.ParseNode(reader); // Parent parse...
            switch (reader.NodeType)
	      {
	      case XmlNodeType.EndElement:
		switch (reader.Name)
		  {
		  case FAULT:
		    response.Value = Singleton._value;
		    response.IsFault = true;
		    break;
		  case PARAM:
		    response.Value = Singleton._value;
		    Singleton._value = null;
		    Singleton._text = null;
		    break;
		  }
		break;
	      default:
		break;
	      }	
	  }
	return response;
      }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:31,代码来源:XmlRpcResponseDeserializer.cs

示例5: GenerateKeyMethod

        public XmlRpcResponse GenerateKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            XmlRpcResponse response = new XmlRpcResponse();

            if (request.Params.Count < 2)
            {
                response.IsFault = true;
                response.SetFault(-1, "Invalid parameters");
                return response;
            }

            // Verify the key of who's calling
            UUID userID = UUID.Zero;
            string authKey = string.Empty;
            UUID.TryParse((string)request.Params[0], out userID);
            authKey = (string)request.Params[1];

            m_log.InfoFormat("[AUTH HANDLER] GenerateKey called with authToken {0}", authKey);
            string newKey = string.Empty;

            newKey = m_LocalService.GetKey(userID, authKey.ToString());
 
            response.Value = (string)newKey;
            return response;
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:25,代码来源:HGAuthenticationHandlers.cs

示例6: Response

      public void Response()
      {
	XmlRpcResponse respIn = new XmlRpcResponse(22,"Help Me");
	String str = (new XmlRpcResponseSerializer()).Serialize(respIn);
	XmlRpcResponse respOut = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(str);

	Assertion.AssertEquals("faultcode", respIn.FaultCode, respOut.FaultCode);
	Assertion.AssertEquals("faultstring", respIn.FaultString, respOut.FaultString);
      }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:9,代码来源:SerializeDeserializeTest.cs

示例7: Login

	private static void Login(XmlRpcResponse response) {
		Hashtable values = (Hashtable)response.Value;
		if (values.Contains("agent_id") && values.Contains("session_id")) {
			// remember our agentID and sessionID
			agentID = new LLUUID((string)values["agent_id"]);
			sessionID = new LLUUID((string)values["session_id"]);

			// start a new thread that reads lines from the console
			(new Thread(new ThreadStart(ReadFromConsole))).Start();
		}
	}
开发者ID:RavenB,项目名称:gridsearch,代码行数:11,代码来源:ChatConsole.cs

示例8: CreateFailureResponse

        public XmlRpcResponse CreateFailureResponse(string reason, string message, bool loginSuccess)
        {
            Hashtable responseData = new Hashtable(3);
            responseData["reason"] = reason;
            responseData["message"] = message;
            responseData["login"] = loginSuccess.ToString().ToLower();

            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = responseData;
            return response;
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:11,代码来源:LindenLogin.cs

示例9: AgentIsComingHome

        public XmlRpcResponse AgentIsComingHome(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            //string host = (string)requestData["host"];
            //string portstr = (string)requestData["port"];
            string sessionID_str = (string)requestData["sessionID"];
            UUID sessionID = UUID.Zero;
            UUID.TryParse (sessionID_str, out sessionID);
            string gridName = (string)requestData["externalName"];

            bool success = m_HomeUsersService.AgentIsComingHome (sessionID, gridName);

            Hashtable hash = new Hashtable ();
            hash["result"] = success.ToString ();
            XmlRpcResponse response = new XmlRpcResponse {Value = hash};
            return response;
        }
开发者ID:skidzTweak,项目名称:HyperGrid,代码行数:17,代码来源:UserAgentServerConnector.cs

示例10: FriendListItemListtoXmlRPCResponse

        public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers)
        {
            XmlRpcResponse response = new XmlRpcResponse();
            Hashtable responseData = new Hashtable();
            // Query Result Information

            responseData["avcount"] = returnUsers.Count.ToString();

            for (int i = 0; i < returnUsers.Count; i++)
            {
                responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString();
                responseData["friendID" + i] = returnUsers[i].Friend.ToString();
                responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
                responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
            }
            response.Value = responseData;

            return response;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:19,代码来源:UserServerFriendsModule.cs

示例11: BuyFunc

 public XmlRpcResponse BuyFunc(XmlRpcRequest request, IPEndPoint ep)
 {
     Hashtable requestData = (Hashtable)request.Params[0];
     bool success = false;
     if (requestData.ContainsKey("agentId") && requestData.ContainsKey("currencyBuy") &&
         m_connector.GetConfig().CanBuyCurrencyInworld)
     {
         UUID agentId;
         if (UUID.TryParse((string)requestData["agentId"], out agentId))
         {
             uint amountBuying = uint.Parse(requestData["currencyBuy"].ToString());
             success = m_connector.InworldCurrencyBuyTransaction(agentId, amountBuying, ep);
         }
     }
     XmlRpcResponse returnval = new XmlRpcResponse();
     Hashtable returnresp = new Hashtable { { "success", success } };
     returnval.Value = returnresp;
     return returnval;
 }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:19,代码来源:RPCHandler.cs

示例12: XmlRPCCheckAuthSessionSwitch

 public XmlRpcResponse XmlRPCCheckAuthSessionSwitch(XmlRpcRequest request, IPEndPoint remoteClient)
 {
     Hashtable requestData = (Hashtable)request.Params[0];
     XmlRpcResponse response = new XmlRpcResponse();
     Hashtable responseData = new Hashtable();
     if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id"))
     {
         UUID avatar;
         UUID sessionID;
         if (UUID.TryParse((string)requestData["avatar_uuid"], out avatar) &&
             UUID.TryParse((string)requestData["session_id"], out sessionID)) 
         {
             if (m_LoggingInClients.ContainsKey(avatar))
             {
                 if (m_LoggingInClients[avatar] == sessionID)
                 {
                     responseData["auth_session"] = "TRUE";
                 }
                 else
                 {
                     responseData["auth_session"] = "FALSE";
                 }
                 m_LoggingInClients.Remove(avatar);
                 response.Value = responseData;
                 return response;
             }
             else 
             {
                 // try normal OpenSim authentication 
                 return m_UserLoginService.XmlRPCCheckAuthSession(request, remoteClient);
             }
         }
     }
     responseData["auth_session"] = "FALSE";
     response.Value = responseData;
     return response;
 }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:37,代码来源:LoginSwitch.cs

示例13: Deserialize

    /// <summary>Static method that parses XML data into a response using the Singleton.</summary>
    /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC response.</param>
    /// <returns><c>XmlRpcResponse</c> object resulting from the parse.</returns>
    override public Object Deserialize(TextReader xmlData)
      {
	XmlTextReader reader = new XmlTextReader(xmlData);
	XmlRpcResponse response = new XmlRpcResponse();
	bool done = false;
	
	lock(this)
	  {
	    Reset();
	    
	    while (!done && reader.Read())
	      {
		DeserializeNode(reader); // Parent parse...
		switch (reader.NodeType)
		  {
		  case XmlNodeType.EndElement:
		    switch (reader.Name)
		      {
		      case FAULT:
			response.Value = _value;
			response.IsFault = true;
			break;
		      case PARAM:
			response.Value = _value;
			_value = null;
			_text = null;
			break;
		      }
		    break;
		  default:
		    break;
		  }	
	      }
	  }
	return response;
      }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:39,代码来源:XmlRpcResponseDeserializer.cs

示例14: ClearXmlRpcHandler

 public XmlRpcResponse ClearXmlRpcHandler(XmlRpcRequest request, IPEndPoint client)
 {
     // AuthClient.VerifySession(GetUserServerURL(userID), userID, sessionID);
     XmlRpcResponse response = new XmlRpcResponse();
     Hashtable requestData = (Hashtable)request.Params[0];
     Hashtable resp = new Hashtable();
     if (requestData.ContainsKey("RegionID"))
     {
     UUID regionID = UUID.Parse((string)requestData["RegionID"]);
     m_scene = SelectRegion(regionID);
     m_scene.DeleteAllSceneObjects();
     }
     else
     {
     resp["success"] = false;
     resp["error"] = "no RegionID provided";
     response.Value = resp;
             return response;
     }
     // return ok;
     resp["success"] = true;
     response.Value = resp;
     return response;
 }
开发者ID:b2rex,项目名称:b2rex,代码行数:24,代码来源:SceneUploadReceiver.cs

示例15: Serialize

    static public void Serialize(XmlTextWriter output, XmlRpcResponse response)
      {
	output.WriteStartDocument();
	output.WriteStartElement(METHOD_RESPONSE);

	if (response.IsFault)
	  output.WriteStartElement(FAULT);
	else
	  {
	    output.WriteStartElement(PARAMS);
	    output.WriteStartElement(PARAM);
	  }

	output.WriteStartElement(VALUE);

	SerializeObject(output,response.Value);

	output.WriteEndElement();

	output.WriteEndElement();
	if (!response.IsFault)
	  output.WriteEndElement();
	output.WriteEndElement();
      }
开发者ID:heran,项目名称:DekiWiki,代码行数:24,代码来源:XmlRpcResponseSerializer.cs


注:本文中的Nwc.XmlRpc.XmlRpcResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。