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


C# GridInstantMessage.FromOSD方法代码示例

本文整理汇总了C#中Aurora.Framework.GridInstantMessage.FromOSD方法的典型用法代码示例。如果您正苦于以下问题:C# GridInstantMessage.FromOSD方法的具体用法?C# GridInstantMessage.FromOSD怎么用?C# GridInstantMessage.FromOSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aurora.Framework.GridInstantMessage的用法示例。


在下文中一共展示了GridInstantMessage.FromOSD方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetOfflineMessages

        public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
        {
            OSDMap map = new OSDMap();

            map["PrincipalID"] = PrincipalID;
            map["Method"] = "getofflinemessages";

            List<GridInstantMessage> Messages = new List<GridInstantMessage>();
            try
            {
                List<string> urls =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(),
                                                                                           "RemoteServerURI");
                foreach (string url in urls)
                {
                    OSDMap result = WebUtils.PostToService(url + "osd", map, true, false);
                    OSDArray array = (OSDArray) OSDParser.DeserializeJson(result["_RawResult"]);
                    foreach (OSD o in array)
                    {
                        GridInstantMessage message = new GridInstantMessage();
                        message.FromOSD((OSDMap) o);
                        Messages.Add(message);
                    }
                }
                return Messages.ToArray();
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteOfflineMessagesConnector]: Exception when contacting server: {0}", e);
            }
            return Messages.ToArray();
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:32,代码来源:RemoteOfflineMessagesConnector.cs

示例2: GetOfflineMessages

 public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
 {
     List<GridInstantMessage> Messages = new List<GridInstantMessage>();
     Dictionary<string, OSDMap> Maps = new Dictionary<string, OSDMap>();
     foreach (string m_ServerURI in m_ServerURIs)
     {
         if (SimianUtils.GetGenericEntries(PrincipalID, "OfflineMessages", m_ServerURI, out Maps))
         {
             GridInstantMessage baseMessage = new GridInstantMessage();
             foreach (OSDMap map in Maps.Values)
             {
                 baseMessage.FromOSD(map);
                 Messages.Add(baseMessage);
             }
         }
     }
     return Messages.ToArray();
 }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:18,代码来源:SimianOfflineMessagesConnector.cs

示例3: OnMessageReceived

 protected OSDMap OnMessageReceived(OSDMap message)
 {
     if (!message.ContainsKey("Method"))
         return null;
     if (message["Method"] == "FriendGrantRights")
     {
         UUID Requester = message["Requester"].AsUUID();
         UUID Target = message["Target"].AsUUID();
         int MyFlags = message["MyFlags"].AsInteger();
         int Rights = message["Rights"].AsInteger();
         LocalGrantRights(Requester, Target, MyFlags, Rights);
     }
     else if (message["Method"] == "FriendTerminated")
     {
         UUID Requester = message["Requester"].AsUUID();
         UUID ExFriend = message["ExFriend"].AsUUID();
         LocalFriendshipTerminated(ExFriend, Requester);
     }
     else if (message["Method"] == "FriendshipOffered")
     {
         //UUID Requester = message["Requester"].AsUUID();
         UUID Friend = message["Friend"].AsUUID();
         GridInstantMessage im = new GridInstantMessage();
         im.FromOSD((OSDMap) message["Message"]);
         LocalFriendshipOffered(Friend, im);
     }
     else if (message["Method"] == "FriendshipDenied")
     {
         UUID Requester = message["Requester"].AsUUID();
         string ClientName = message["ClientName"].AsString();
         UUID FriendID = message["FriendID"].AsUUID();
         LocalFriendshipDenied(Requester, ClientName, FriendID);
     }
     else if (message["Method"] == "FriendshipApproved")
     {
         UUID Requester = message["Requester"].AsUUID();
         string ClientName = message["ClientName"].AsString();
         UUID FriendID = message["FriendID"].AsUUID();
         LocalFriendshipApproved(Requester, ClientName, null, FriendID);
     }
     return null;
 }
开发者ID:TechplexEngineer,项目名称:Aurora-Sim,代码行数:42,代码来源:FriendsModule.cs

示例4: processXMLRPCGridInstantMessage

        /// <summary>
        ///   Process a XMLRPC Grid Instant Message
        /// </summary>
        /// <param name = "request">XMLRPC parameters
        /// </param>
        /// <param name="remoteClient"> </param>
        /// <returns>Nothing much</returns>
        protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            bool successful = false;
            GridInstantMessage gim = new GridInstantMessage();
            Hashtable requestData = (Hashtable) request.Params[0];

            if (requestData.ContainsKey("message"))
            {
                try
                {
                    //Deserialize it
                    gim.FromOSD((OSDMap) OSDParser.DeserializeJson(requestData["message"].ToString()));
                }
                catch
                {
                    UUID fromAgentID = UUID.Zero;
                    UUID toAgentID = UUID.Zero;
                    UUID imSessionID = UUID.Zero;
                    uint timestamp = 0;
                    string fromAgentName = "";
                    string message = "";
                    byte dialog = (byte) 0;
                    bool fromGroup = false;
                    byte offline = 0;
                    uint ParentEstateID = 0;
                    Vector3 Position = Vector3.Zero;
                    UUID RegionID = UUID.Zero;
                    byte[] binaryBucket = new byte[0];

                    float pos_x = 0;
                    float pos_y = 0;
                    float pos_z = 0;
                    if (requestData.ContainsKey("from_agent_id")
                        && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
                        && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
                        && requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
                        && requestData.ContainsKey("from_group")
                        && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id")
                        && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y")
                        && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
                        && requestData.ContainsKey("binary_bucket"))
                    {
                        // Do the easy way of validating the UUIDs
                        UUID.TryParse((string) requestData["from_agent_id"], out fromAgentID);
                        UUID.TryParse((string) requestData["to_agent_id"], out toAgentID);
                        UUID.TryParse((string) requestData["im_session_id"], out imSessionID);
                        UUID.TryParse((string) requestData["region_id"], out RegionID);

                        try
                        {
                            timestamp = (uint) Convert.ToInt32((string) requestData["timestamp"]);
                        }
                        catch (ArgumentException)
                        {
                        }
                        catch (FormatException)
                        {
                        }
                        catch (OverflowException)
                        {
                        }

                        fromAgentName = (string) requestData["from_agent_name"];
                        message = (string) requestData["message"];
                        if (message == null)
                            message = string.Empty;

                        // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
                        string requestData1 = (string) requestData["dialog"];
                        if (string.IsNullOrEmpty(requestData1))
                        {
                            dialog = 0;
                        }
                        else
                        {
                            byte[] dialogdata = Convert.FromBase64String(requestData1);
                            dialog = dialogdata[0];
                        }

                        if ((string) requestData["from_group"] == "TRUE")
                            fromGroup = true;

                        string requestData2 = (string) requestData["offline"];
                        if (String.IsNullOrEmpty(requestData2))
                        {
                            offline = 0;
                        }
                        else
                        {
                            byte[] offlinedata = Convert.FromBase64String(requestData2);
                            offline = offlinedata[0];
                        }

//.........这里部分代码省略.........
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:101,代码来源:MessageTransferModule.cs

示例5: AddOfflineMessage

        public byte[] AddOfflineMessage(OSDMap request)
        {
            GridInstantMessage message = new GridInstantMessage();
            message.FromOSD(request);
            OSDMap map = new OSDMap();
            map["Result"] = OfflineMessagesConnector.AddOfflineMessage(message);

            string xmlString = OSDParser.SerializeJsonString(map);
            UTF8Encoding encoding = new UTF8Encoding();
            return encoding.GetBytes(xmlString);
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:11,代码来源:AuroraDataServerPostOSDHandler.cs


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