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


C# GridInstantMessage.FromOSD方法代码示例

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


在下文中一共展示了GridInstantMessage.FromOSD方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:savino1976,项目名称:Aurora-Sim,代码行数:32,代码来源:RemoteOfflineMessagesConnector.cs

示例2: syncRecievedService_OnMessageReceived

 private OSDMap syncRecievedService_OnMessageReceived(OSDMap message)
 {
     string method = message["Method"];
     if (method == "SendInstantMessages")
     {
         List<GridInstantMessage> messages =
             ((OSDArray) message["Messages"]).ConvertAll<GridInstantMessage>((o) =>
                                                                                 {
                                                                                     GridInstantMessage im =
                                                                                         new GridInstantMessage();
                                                                                     im.FromOSD((OSDMap) o);
                                                                                     return im;
                                                                                 });
         ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
         if (manager != null)
         {
             IMessageTransferModule messageTransfer =
                 manager.Scene.RequestModuleInterface<IMessageTransferModule>();
             if (messageTransfer != null)
             {
                 foreach (GridInstantMessage im in messages)
                     messageTransfer.SendInstantMessage(im);
             }
         }
     }
     return null;
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:27,代码来源:InstantMessagingService.cs

示例3: GetOfflineMessages

 public GridInstantMessage[] GetOfflineMessages(UUID PrincipalID)
 {
     List<GridInstantMessage> Messages = new List<GridInstantMessage>();
     Dictionary<string, OSDMap> Maps = new Dictionary<string,OSDMap>();
     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:shangcheng,项目名称:Aurora,代码行数:15,代码来源:SimianOfflineMessagesConnector.cs

示例4: 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 ExFriend = message["ExFriend"].AsUUID();
         GridInstantMessage im = new GridInstantMessage();
         im.FromOSD((OSDMap)message["Message"]);
         LocalFriendshipOffered(ExFriend, 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:kchi059,项目名称:Aurora-Sim,代码行数:42,代码来源:FriendsModule.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:savino1976,项目名称:Aurora-Sim,代码行数:11,代码来源:AuroraDataServerPostOSDHandler.cs

示例6: SendChatToSession

        public void SendChatToSession(UUID agentID, GridInstantMessage im)
        {
            if (m_doRemoteOnly)
            {
                DoRemoteCallPost(true, "InstantMessageServerURI", agentID, im);
                return;
            }

            Util.FireAndForget((o) =>
                                   {
                                       ChatSession session;
                                       ChatSessions.TryGetValue(im.SessionID, out session);
                                       if (session == null)
                                           return;

                                       if (agentID != UUID.Zero) //Not system
                                       {
                                           ChatSessionMember sender = FindMember(im.SessionID, agentID);
                                           if (sender.MuteText)
                                               return; //They have been admin muted, don't allow them to send anything
                                       }

                                       Dictionary<string, List<GridInstantMessage>> messagesToSend =
                                           new Dictionary<string, List<GridInstantMessage>>();
                                       foreach (ChatSessionMember member in session.Members)
                                       {
                                           if (member.HasBeenAdded)
                                           {
                                               im.ToAgentID = member.AvatarKey;
                                               im.BinaryBucket = Utils.StringToBytes(session.Name);
                                               im.RegionID = UUID.Zero;
                                               im.ParentEstateID = 0;
                                               im.Offline = 0;
                                               GridInstantMessage message = new GridInstantMessage();
                                               message.FromOSD(im.ToOSD());
                                               //im.timestamp = 0;
                                               string uri = FindRegionURI(member.AvatarKey);
                                               if (uri != "") //Check if they are online
                                               {
                                                   //Bulk send all of the instant messages to the same region, so that we don't send them one-by-one over and over
                                                   if (messagesToSend.ContainsKey(uri))
                                                       messagesToSend[uri].Add(message);
                                                   else
                                                       messagesToSend.Add(uri, new List<GridInstantMessage>() {message});
                                               }
                                           }
                                           else if (!member.RequestedRemoval)
                                               //If they're requested to leave, don't recontact them
                                           {
                                               UUID regionID = FindRegionID(member.AvatarKey);
                                               if (regionID != UUID.Zero)
                                               {
                                                   im.ToAgentID = member.AvatarKey;
                                                   m_eventQueueService.ChatterboxInvitation(
                                                       session.SessionID
                                                       , session.Name
                                                       , im.FromAgentID
                                                       , im.Message
                                                       , im.ToAgentID
                                                       , im.FromAgentName
                                                       , im.Dialog
                                                       , im.Timestamp
                                                       , im.Offline == 1
                                                       , (int) im.ParentEstateID
                                                       , im.Position
                                                       , 1
                                                       , im.SessionID
                                                       , false
                                                       , Utils.StringToBytes(session.Name)
                                                       , regionID
                                                       );
                                               }
                                           }
                                       }
                                       foreach (KeyValuePair<string, List<GridInstantMessage>> kvp in messagesToSend)
                                       {
                                           SendInstantMessages(kvp.Key, kvp.Value);
                                       }
                                   });
        }
开发者ID:samiam123,项目名称:sam2Aurora,代码行数:80,代码来源:InstantMessagingService.cs

示例7: Duplicate

 public override IDataTransferable Duplicate()
 {
     GridInstantMessage m = new GridInstantMessage();
     m.FromOSD(ToOSD());
     return m;
 }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:6,代码来源:GridInstantMessage.cs

示例8: 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;
                    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;

                        try
                        {
                            ParentEstateID = (uint) Convert.ToInt32((string) requestData["parent_estate_id"]);
                        }
                        catch (ArgumentException)
                        {
                        }
                        catch (FormatException)
                        {
                        }
                        catch (OverflowException)
//.........这里部分代码省略.........
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:101,代码来源:MessageTransferModule.cs

示例9: syncRecievedService_OnMessageReceived

        private OSDMap syncRecievedService_OnMessageReceived(OSDMap message)
        {
            string method = message["Method"];
            if (method == "SendInstantMessages")
            {
                List<GridInstantMessage> messages =
                    ((OSDArray) message["Messages"]).ConvertAll<GridInstantMessage>((o) =>
                                                                                        {
                                                                                            GridInstantMessage im =
                                                                                                new GridInstantMessage();
                                                                                            im.FromOSD((OSDMap) o);
                                                                                            return im;
                                                                                        });
                ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
                if (manager != null)
                {
                    foreach (GridInstantMessage im in messages)
                    {
                        Framework.PresenceInfo.IScenePresence UserPresence;

                        foreach (IScene scene in manager.Scenes)
                        {
                            UserPresence = scene.GetScenePresence(im.ToAgentID);

                            //AR: Do not fire for child agents or group messages are sent for every region
                            if (UserPresence != null && UserPresence.IsChildAgent == false)
                            {
                                IMessageTransferModule messageTransfer = scene.RequestModuleInterface<IMessageTransferModule>();
                                if (messageTransfer != null)
                                {
                                    messageTransfer.SendInstantMessage(im);
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:39,代码来源:InstantMessagingService.cs


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