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


C# OSChatMessage.FromKVP方法代碼示例

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


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

示例1: InformNeighborsOfChatMessage

        private byte[] InformNeighborsOfChatMessage(Dictionary<string, object> request)
        {
            byte[] result = new byte[0];

            if (!CheckThreatLevel(NeighborThreatLevel.Low))
            {
                return result;
            }

            // retrieve the region
            RegionInfo aRegion = new RegionInfo();
            try
            {
                aRegion.UnpackRegionInfoData(Util.DictionaryToOSD(request));
            }
            catch (Exception)
            {
                return result;
            }

            OSChatMessage message = new OSChatMessage();
            message.FromKVP(WebUtils.ParseQueryString(request["MESSAGE"].ToString()));
            ChatSourceType type = (ChatSourceType)int.Parse(request["TYPE"].ToString());
            if (m_AuthenticationService != null)
            {
                //Set password on the incoming region
                if (m_AuthenticationService.CheckExists(aRegion.RegionID))
                {
                    if (m_AuthenticationService.Authenticate(aRegion.RegionID, aRegion.Password.ToString(), 100) == "")
                    {
                        m_log.Warn("[RegionPostHandler]: Authentication failed for region " + aRegion.RegionName);
                        return result;
                    }
                    else
                        m_log.InfoFormat("[RegionPostHandler]: Authentication succeeded for {0}", aRegion.RegionName);
                }
                else //Set the password then
                    m_AuthenticationService.SetPasswordHashed(aRegion.RegionID, aRegion.Password.ToString());
            }

            // Finally!
            m_NeighborService.SendChatMessageToNeighbors(message, type, aRegion);

            Dictionary<string, object> resp = new Dictionary<string, object>();
            resp["success"] = "true";

            string xmlString = WebUtils.BuildXmlResponse(resp);
            UTF8Encoding encoding = new UTF8Encoding();
            return encoding.GetBytes(xmlString);
        }
開發者ID:kow,項目名稱:Aurora-Sim,代碼行數:50,代碼來源:NeighbourHandlers.cs


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