當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。