本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}