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


C# FriendInfo.ToKeyValuePairs方法代碼示例

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


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

示例1: ValidateFriendshipOffered

        public bool ValidateFriendshipOffered(UUID fromID, UUID toID)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = fromID;
            finfo.Friend = toID.ToString();

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "validate_friendship_offered";

            string reply = string.Empty;
            string uri = m_ServerURI + "/hgfriends";
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        uri,
                        ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

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

            }
            else
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply");

            return false;

        }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:45,代碼來源:HGFriendsServicesConnector.cs

示例2: NewFriendship

        public bool NewFriendship(UUID PrincipalID, string Friend)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = PrincipalID;
            finfo.Friend = Friend;

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "newfriendship";
            sendData["KEY"] = m_ServiceKey;
            sendData["SESSIONID"] = m_SessionID.ToString();

            string reply = string.Empty;
            string uri = m_ServerURI + "/hgfriends";
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        uri,
                        ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null))
                {
                    bool success = false;
                    Boolean.TryParse(replyData["Result"].ToString(), out success);
                    return success;
                }
                else
                    m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend {0} {1} received null response",
                        PrincipalID, Friend);
            }
            else
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend received null reply");

            return false;

        }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:46,代碼來源:HGFriendsServicesConnector.cs

示例3: StoreFriend

        public bool StoreFriend(UUID PrincipalID, string Friend, int flags)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = PrincipalID;
            finfo.Friend = Friend;
            finfo.MyFlags = flags;

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "storefriend";

            string reply = string.Empty;
            try
            {
                List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(), "FriendsServerURI");
                foreach (string m_ServerURI in serverURIs)
                {
                    reply = SynchronousRestFormsRequester.MakeRequest("POST",
                            m_ServerURI,
                            WebUtils.BuildQueryString(sendData));
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse (reply);

                        if ((replyData != null) && replyData.ContainsKey ("Result") && (replyData["Result"] != null))
                        {
                            bool success = false;
                            Boolean.TryParse (replyData["Result"].ToString (), out success);
                            if (replyData["Result"].ToString () == "Success")
                                return true;
                            if(success)
                                return success;
                        }
                        else
                            m_log.DebugFormat ("[FRIENDS CONNECTOR]: StoreFriend {0} {1} received null response",
                                PrincipalID, Friend);
                    }
                    else
                        m_log.DebugFormat ("[FRIENDS CONNECTOR]: StoreFriend received null reply");
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
                return false;
            }

            return false;

        }
開發者ID:RevolutionSmythe,項目名稱:Aurora-Sim,代碼行數:50,代碼來源:FriendsServiceConnector.cs

示例4: StoreFriend

        public bool StoreFriend(UUID PrincipalID, string Friend, int flags)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = PrincipalID;
            finfo.Friend = Friend;
            finfo.MyFlags = flags;

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "storefriend";

            string reqString = ServerUtils.BuildQueryString(sendData);

            string reply = string.Empty;
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/friends",
                        ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null))
                {
                    bool success = false;
                    Boolean.TryParse(replyData["Result"].ToString(), out success);
                    return success;
                }
                else
                    m_log.DebugFormat("[FRIENDS CONNECTOR]: StoreFriend {0} {1} received null response",
                        PrincipalID, Friend);
            }
            else
                m_log.DebugFormat("[FRIENDS CONNECTOR]: StoreFriend received null reply");

            return false;

        }
開發者ID:AlexRa,項目名稱:opensim-mods-Alex,代碼行數:46,代碼來源:FriendsServiceConnector.cs

示例5: DeleteFriendship

        public bool DeleteFriendship(UUID PrincipalID, UUID Friend, string secret)
        {
            FriendInfo finfo = new FriendInfo ();
            finfo.PrincipalID = PrincipalID;
            finfo.Friend = Friend.ToString ();

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs ();

            sendData["METHOD"] = "deletefriendship";
            sendData["SECRET"] = secret;

            string reply = string.Empty;
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest ("POST",
                        m_ServerURI + "/hgfriends",
                        WebUtils.BuildQueryString (sendData));
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat ("[HGFRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = WebUtils.ParseXmlResponse (reply);

                if ((replyData != null) && replyData.ContainsKey ("Result") && (replyData["Result"] != null))
                {
                    bool success = false;
                    Boolean.TryParse (replyData["Result"].ToString (), out success);
                    return success;
                }
                else
                    MainConsole.Instance.DebugFormat ("[HGFRIENDS CONNECTOR]: Delete {0} {1} received null response",
                        PrincipalID, Friend);
            }
            else
                MainConsole.Instance.DebugFormat ("[HGFRIENDS CONNECTOR]: DeleteFriend received null reply");

            return false;
        }
開發者ID:djphil,項目名稱:Aurora-HG-Plugin,代碼行數:43,代碼來源:HGFriendsServiceConnector.cs


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