本文整理汇总了C#中OSD.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OSD.ToString方法的具体用法?C# OSD.ToString怎么用?C# OSD.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSD
的用法示例。
在下文中一共展示了OSD.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DerezAvatarMethod
public OSD DerezAvatarMethod(string path, OSD request)
{
m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString());
//LLSD llsdResponse = null;
OSDMap responseMap = new OSDMap();
string[] PathArray = path.Split('/');
m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]);
string uuidString = PathArray[2];
m_log.InfoFormat("[OGP]: Request to Derez avatar with UUID {0}", uuidString);
UUID userUUID = UUID.Zero;
if (UUID.TryParse(uuidString, out userUUID))
{
UUID RemoteID = (UUID)uuidString;
UUID LocalID = RemoteID;
// FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds
// would be done already.. but the client connects with the Aditi UUID
// regardless over the UDP stack
OGPState userState = GetOGPState(LocalID);
if (userState.agent_id != UUID.Zero)
{
//OSDMap outboundRequestMap = new OSDMap();
OSDMap inboundRequestMap = (OSDMap)request;
string rezAvatarString = inboundRequestMap["rez_avatar"].AsString();
if (rezAvatarString.Length == 0)
{
rezAvatarString = inboundRequestMap["rez_avatar/rez"].AsString();
}
OSDArray LookAtArray = new OSDArray();
LookAtArray.Add(OSD.FromInteger(1));
LookAtArray.Add(OSD.FromInteger(1));
LookAtArray.Add(OSD.FromInteger(1));
OSDArray PositionArray = new OSDArray();
PositionArray.Add(OSD.FromInteger(128));
PositionArray.Add(OSD.FromInteger(128));
PositionArray.Add(OSD.FromInteger(40));
OSDArray lookArray = new OSDArray();
lookArray.Add(OSD.FromInteger(128));
lookArray.Add(OSD.FromInteger(128));
lookArray.Add(OSD.FromInteger(40));
responseMap["connect"] = OSD.FromBoolean(true);// it's okay to give this user up
responseMap["look_at"] = LookAtArray;
m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name);
OSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState);
// If invoking it returned an error, parse and end
if (rezResponseMap.ContainsKey("connect"))
{
if (rezResponseMap["connect"].AsBoolean() == false)
{
return responseMap;
}
}
string rezRespSeedCap = "";
// DEPRECATED
if (rezResponseMap.ContainsKey("seed_capability"))
rezRespSeedCap = rezResponseMap["seed_capability"].AsString();
// REPLACEMENT
if (rezResponseMap.ContainsKey("region_seed_capability"))
rezRespSeedCap = rezResponseMap["region_seed_capability"].AsString();
// REPLACEMENT
if (rezResponseMap.ContainsKey("rez_avatar/rez"))
rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString();
// DEPRECATED
string rezRespSim_ip = rezResponseMap["sim_ip"].AsString();
string rezRespSim_host = rezResponseMap["sim_host"].AsString();
int rrPort = rezResponseMap["sim_port"].AsInteger();
int rrX = rezResponseMap["region_x"].AsInteger();
int rrY = rezResponseMap["region_y"].AsInteger();
m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY);
UUID rrRID = rezResponseMap["region_id"].AsUUID();
OSDArray RezResponsePositionArray = null;
string rrAccess = rezResponseMap["sim_access"].AsString();
if (rezResponseMap.ContainsKey("position"))
{
RezResponsePositionArray = (OSDArray)rezResponseMap["position"];
}
// DEPRECATED
responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap);
// REPLACEMENT r3
responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap);
// DEPRECATED
responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString());
//.........这里部分代码省略.........
示例2: RezAvatarMethod
public OSD RezAvatarMethod(string path, OSD request)
{
m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString());
OSDMap responseMap = new OSDMap();
AgentCircuitData userData = null;
// Only people we've issued a cap can go further
if (TryGetAgentCircuitData(path,out userData))
{
OSDMap requestMap = (OSDMap)request;
// take these values to start. There's a few more
UUID SecureSessionID=requestMap["secure_session_id"].AsUUID();
UUID SessionID = requestMap["session_id"].AsUUID();
int circuitcode = requestMap["circuit_code"].AsInteger();
OSDArray Parameter = new OSDArray();
if (requestMap.ContainsKey("parameter"))
{
Parameter = (OSDArray)requestMap["parameter"];
}
//int version = 1;
int estateID = 1;
int parentEstateID = 1;
UUID regionID = UUID.Zero;
bool visibleToParent = true;
for (int i = 0; i < Parameter.Count; i++)
{
OSDMap item = (OSDMap)Parameter[i];
// if (item.ContainsKey("version"))
// {
// version = item["version"].AsInteger();
// }
if (item.ContainsKey("estate_id"))
{
estateID = item["estate_id"].AsInteger();
}
if (item.ContainsKey("parent_estate_id"))
{
parentEstateID = item["parent_estate_id"].AsInteger();
}
if (item.ContainsKey("region_id"))
{
regionID = item["region_id"].AsUUID();
}
if (item.ContainsKey("visible_to_parent"))
{
visibleToParent = item["visible_to_parent"].AsBoolean();
}
}
//Update our Circuit data with the real values
userData.SecureSessionID = SecureSessionID;
userData.SessionID = SessionID;
OGPState userState = GetOGPState(userData.AgentID);
// Locate a home scene suitable for the user.
Scene homeScene = null;
homeScene = GetScene(userState.teleported_into_region);
if (homeScene == null)
homeScene = GetRootScene();
if (homeScene != null)
{
// Get a referenceokay - to their Cap object so we can pull out the capobjectroot
Caps userCap
= homeScene.CapsModule.GetCapsHandlerForUser(userData.AgentID);
//Update the circuit data in the region so this user is authorized
homeScene.UpdateCircuitData(userData);
homeScene.ChangeCircuitCode(userData.circuitcode,(uint)circuitcode);
// Load state
// Keep state changes
userState.first_name = requestMap["first_name"].AsString();
userState.secure_session_id = requestMap["secure_session_id"].AsUUID();
userState.age_verified = requestMap["age_verified"].AsBoolean();
userState.region_id = homeScene.RegionInfo.originRegionID; // replace 0000000 with our regionid
userState.transacted = requestMap["transacted"].AsBoolean();
userState.agent_access = requestMap["agent_access"].AsBoolean();
userState.inventory_host = requestMap["inventory_host"].AsString();
userState.identified = requestMap["identified"].AsBoolean();
userState.session_id = requestMap["session_id"].AsUUID();
userState.god_level = (uint)requestMap["god_level"].AsInteger();
userState.last_name = requestMap["last_name"].AsString();
userState.god_overide = requestMap["god_override"].AsBoolean();
userState.circuit_code = (uint)requestMap["circuit_code"].AsInteger();
userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger();
userState.src_estate_id = estateID;
userState.region_id = regionID;
userState.src_parent_estate_id = parentEstateID;
//.........这里部分代码省略.........