本文整理汇总了C#中OpenSim.Services.Interfaces.UserAccount.FromKVP方法的典型用法代码示例。如果您正苦于以下问题:C# UserAccount.FromKVP方法的具体用法?C# UserAccount.FromKVP怎么用?C# UserAccount.FromKVP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Services.Interfaces.UserAccount
的用法示例。
在下文中一共展示了UserAccount.FromKVP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendAndGetReply
private UserAccount SendAndGetReply(UUID avatarID, Dictionary<string, object> sendData)
{
string reply = string.Empty;
string reqString = WebUtils.BuildQueryString(sendData);
// MainConsole.Instance.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
UserAccount account = null;
List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(avatarID.ToString(), "UserAccountServerURI", true);
foreach (string m_ServerURI in m_ServerURIs)
{
try
{
reply = SynchronousRestFormsRequester.MakeRequest ("POST",
m_ServerURI,
reqString);
if (reply == string.Empty)
continue;
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse (reply);
if ((replyData != null) && replyData.ContainsKey ("result") && (replyData["result"] != null))
{
if (replyData["result"] is Dictionary<string, object>)
{
account = new UserAccount ();
account.FromKVP((Dictionary<string, object>)replyData["result"]);
account.GenericData["GridURL"] = m_ServerURI.Remove (m_ServerURI.LastIndexOf ('/'));
return account;
}
}
}
catch (Exception e)
{
MainConsole.Instance.InfoFormat ("[ACCOUNT CONNECTOR]: Exception when contacting user account server: {0}", e.Message);
}
}
return account;
}
示例2: GetUserAccounts
public List<UserAccount> GetUserAccounts(List<UUID> scopeIDs, string query)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = 0.ToString();
sendData["VERSIONMAX"] = 0.ToString();
sendData["METHOD"] = "getaccounts";
sendData["ScopeID"] = GetScopeID(scopeIDs);
sendData["query"] = query;
string reply = string.Empty;
string reqString = WebUtils.BuildQueryString(sendData);
// MainConsole.Instance.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
List<UserAccount> accounts = new List<UserAccount>();
try
{
List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("UserAccountServerURI");
foreach (string m_ServerURI in m_ServerURIs)
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI,
reqString);
if (reply == null || (reply != null && reply == string.Empty))
continue;
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
if (replyData != null)
{
if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null")
continue;
Dictionary<string, object>.ValueCollection accountList = replyData.Values;
//MainConsole.Instance.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
foreach (object acc in accountList)
{
if (acc is Dictionary<string, object>)
{
UserAccount pinfo = new UserAccount();
pinfo.FromKVP((Dictionary<string, object>)acc);
pinfo.GenericData["GridURL"] = m_ServerURI.Remove(m_ServerURI.LastIndexOf('/'));
accounts.Add(pinfo);
}
else
MainConsole.Instance.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received invalid response type {0}",
acc.GetType());
}
}
else
MainConsole.Instance.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccounts received null response");
}
}
catch (Exception e)
{
MainConsole.Instance.InfoFormat("[ACCOUNT CONNECTOR]: Exception when contacting accounts server: {0}", e.Message);
}
return accounts;
}