本文整理汇总了C#中OpenSim.Services.Interfaces.GridRegion.ToKeyValuePairs方法的典型用法代码示例。如果您正苦于以下问题:C# GridRegion.ToKeyValuePairs方法的具体用法?C# GridRegion.ToKeyValuePairs怎么用?C# GridRegion.ToKeyValuePairs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Services.Interfaces.GridRegion
的用法示例。
在下文中一共展示了GridRegion.ToKeyValuePairs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRegion
public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo, UUID SecureSessionID, out UUID SessionID)
{
SessionID = UUID.Zero;
Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
Dictionary<string, object> sendData = new Dictionary<string,object>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
sendData["SCOPEID"] = scopeID.ToString();
sendData["SESSIONID"] = SecureSessionID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "register";
string reqString = WebUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
{
if (replyData.ContainsKey("Message"))
{
SessionID = UUID.Parse(replyData["Message"].ToString());
}
m_log.Info("[GridService]: Successfully registered region " + regionInfo.RegionName + " at " + regionInfo.RegionLocX + "," + regionInfo.RegionLocY + " to the grid server @ " + m_ServerURI);
return String.Empty;
}
else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
{
//m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
return replyData["Message"].ToString();
}
else if (!replyData.ContainsKey("Result"))
{
m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
}
else
{
m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
return "Unexpected result "+replyData["Result"].ToString();
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply from " + m_ServerURI);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server " + m_ServerURI + " : {0}", e.Message);
}
return "Error communicating with grid service";
}
示例2: RegionInfo2RegionData
public RegionData RegionInfo2RegionData(GridRegion rinfo)
{
RegionData rdata = new RegionData();
rdata.posX = (int)rinfo.RegionLocX;
rdata.posY = (int)rinfo.RegionLocY;
rdata.RegionID = rinfo.RegionID;
rdata.RegionName = rinfo.RegionName;
rdata.Data = rinfo.ToKeyValuePairs();
rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY);
rdata.Data["owner_uuid"] = rinfo.EstateOwner.ToString();
return rdata;
}
示例3: RegisterRegion
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
Dictionary<string, object> sendData = new Dictionary<string,object>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "register";
string reqString = ServerUtils.BuildQueryString(sendData);
string uri = m_ServerURI + "/grid";
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
{
return String.Empty;
}
else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri);
return replyData["Message"].ToString();
}
else if (!replyData.ContainsKey("Result"))
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri);
}
else
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri);
return "Unexpected result " + replyData["Result"].ToString();
}
}
else
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri);
}
}
catch (Exception e)
{
m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
}
return string.Format("Error communicating with the grid service at {0}", uri);
}
示例4: OldRegisterRegion
public string OldRegisterRegion(GridRegion region)
{
Dictionary<string, object> rinfo = region.ToKeyValuePairs();
Dictionary<string, object> sendData = new Dictionary<string, object>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
sendData["SCOPEID"] = region.ScopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "register";
string reqString = WebUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("GridServerURI");
foreach (string m_ServerURI in serverURIs)
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI,
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
{
return String.Empty;
}
else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
{
m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
return replyData["Message"].ToString();
}
else if (!replyData.ContainsKey("Result"))
{
m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
}
else
{
m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
return "Unexpected result " + replyData["Result"].ToString();
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
}
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
}
return "Error communicating with grid service";
}
示例5: UpdateMap
public virtual string UpdateMap(UUID scopeID, GridRegion region, UUID sessionID)
{
Dictionary<string, object> sendData = region.ToKeyValuePairs();
sendData["SCOPEID"] = scopeID.ToString();
sendData["SESSIONID"] = sessionID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "update_map";
string reqString = WebUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
return String.Empty;
else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
{
if (replyData["Message"].ToString() == "")
{
if (RegisterRegion(scopeID, region, sessionID, out sessionID) != "")
{
m_log.DebugFormat("[GRID CONNECTOR]: update_map failed, non Aurora grid-server?");
}
return "";
}
else
{
m_log.DebugFormat("[GRID CONNECTOR]: update_map failed: {0}", replyData["Message"].ToString());
return replyData["Message"].ToString();
}
}
else if (!replyData.ContainsKey("Result"))
{
m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
}
else
{
m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
return "Unexpected result " + replyData["Result"].ToString();
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
}
return "Error communicating with grid service";
}
示例6: RegisterRegion
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
Dictionary<string, object> sendData = new Dictionary<string,object>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
try
{
if (File.Exists("RegisterKey.txt"))
{
StreamReader reader = new StreamReader("RegisterKey.txt");
sendData["REGISTERKEY"] = reader.ReadLine();
}
}catch(Exception registerKeyE)
{
m_log.Error("Error while reading the register key." + registerKeyE.Message);
}
DirectoryInfo d = new DirectoryInfo(@".");
FileInfo[] Files = d.GetFiles("*.dll");
string md5String = "";
foreach (FileInfo file in Files)
{
md5String = md5String + MD5.Create().ComputeHash(File.ReadAllBytes(file.FullName));
}
sendData["DATAMD5"] = GetMD5Hash(md5String);
sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["GRIDAUTHCODE"] = GetMD5Hash(OpenSim.VersionInfo.Version);
sendData["METHOD"] = "register";
string reqString = ServerUtils.BuildQueryString(sendData);
string uri = m_ServerURI + "/grid";
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
{
return String.Empty;
}
else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri);
return replyData["Message"].ToString();
}
else if (!replyData.ContainsKey("Result"))
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri);
}
else
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri);
return "Unexpected result " + replyData["Result"].ToString();
}
}
else
{
m_log.ErrorFormat(
"[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri);
}
}
catch (Exception e)
{
m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message);
}
return string.Format("Error communicating with the grid service at {0}", uri);
}
示例7: RegisterRegion
public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
Dictionary<string, string> sendData = new Dictionary<string,string>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "register";
string reqString = ServerUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
reqString);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
return true;
else if (!replyData.ContainsKey("Result"))
m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
else
m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
}
else
m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply");
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
}
return false;
}