當前位置: 首頁>>代碼示例>>C#>>正文


C# AvatarData.ToKeyValuePairs方法代碼示例

本文整理匯總了C#中OpenSim.Services.Interfaces.AvatarData.ToKeyValuePairs方法的典型用法代碼示例。如果您正苦於以下問題:C# AvatarData.ToKeyValuePairs方法的具體用法?C# AvatarData.ToKeyValuePairs怎麽用?C# AvatarData.ToKeyValuePairs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Services.Interfaces.AvatarData的用法示例。


在下文中一共展示了AvatarData.ToKeyValuePairs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetAvatar

        public override bool SetAvatar(UUID userID, AvatarData avatar)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();
            //sendData["SCOPEID"] = scopeID.ToString();
            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "setavatar";

            sendData["UserID"] = userID.ToString();

            Dictionary<string, object> structData = avatar.ToKeyValuePairs();

#if (!ISWIN)
            foreach (KeyValuePair<string, object> kvp in structData)
            {
                if (kvp.Key != "Textures") sendData[kvp.Key] = kvp.Value.ToString();
            }
#else
            foreach (KeyValuePair<string, object> kvp in structData.Where(kvp => kvp.Key != "Textures"))
                sendData[kvp.Key] = kvp.Value.ToString();
#endif

            ResetAvatar(userID);
            string reqString = WebUtils.BuildQueryString(sendData);
            //MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
            try
            {
                List<string> serverURIs =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AvatarServerURI");
                foreach (string mServerUri in serverURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST", mServerUri, reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData.ContainsKey("result"))
                        {
                            if (replyData["result"].ToString().ToLower() == "success")
                                return true;
                        }
                        else
                            MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetAvatar reply data does not contain result field");
                    }
                    else
                        MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: SetAvatar received empty reply");
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message);
            }

            return false;
        }
開發者ID:savino1976,項目名稱:Aurora-Sim,代碼行數:55,代碼來源:RobustAvatarConnector.cs

示例2: SetAvatar

        public bool SetAvatar(UUID userID, AvatarData avatar)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();
            //sendData["SCOPEID"] = scopeID.ToString();
            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "setavatar";

            sendData["UserID"] = userID.ToString();

            Dictionary<string, object> structData = avatar.ToKeyValuePairs();

            foreach (KeyValuePair<string, object> kvp in structData)
                sendData[kvp.Key] = kvp.Value.ToString();


            string reqString = ServerUtils.BuildQueryString(sendData);
            //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/avatar",
                        reqString);
                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                    if (replyData.ContainsKey("result"))
                    {
                        if (replyData["result"].ToString().ToLower() == "success")
                            return true;
                        else
                            return false;
                    }
                    else
                        m_log.DebugFormat("[AVATAR CONNECTOR]: SetAvatar reply data does not contain result field");

                }
                else
                    m_log.DebugFormat("[AVATAR CONNECTOR]: SetAvatar received empty reply");
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AVATAR CONNECTOR]: Exception when contacting avatar server: {0}", e.Message);
            }

            return false;
        }
開發者ID:N3X15,項目名稱:VoxelSim,代碼行數:48,代碼來源:AvatarServiceConnector.cs


注:本文中的OpenSim.Services.Interfaces.AvatarData.ToKeyValuePairs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。