public void Parse(OSDMap reply)
{
try
{
AgentID = ParseUUID("agent_id", reply);
SessionID = ParseUUID("session_id", reply);
SecureSessionID = ParseUUID("secure_session_id", reply);
FirstName = ParseString("first_name", reply).Trim('"');
LastName = ParseString("last_name", reply).Trim('"');
StartLocation = ParseString("start_location", reply);
AgentAccess = ParseString("agent_access", reply);
LookAt = ParseVector3("look_at", reply);
AssetServerUri = ParseString("asset_server_address", reply);
}
catch (OSDException e)
{
Logger.DebugLog("Login server returned (some) invalid data: " + e.Message);
}
// Home
OSDMap home = null;
OSD osdHome = OSDParser.DeserializeLLSDNotation(reply["home"].AsString());
if (osdHome.Type == OSDType.Map)
{
home = (OSDMap)osdHome;
OSD homeRegion;
if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == OSDType.Array)
{
OSDArray homeArray = (OSDArray)homeRegion;
if (homeArray.Count == 2)
HomeRegion = Utils.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
else
HomeRegion = 0;
}
HomePosition = ParseVector3("position", home);
HomeLookAt = ParseVector3("look_at", home);
}
else
{
HomeRegion = 0;
HomePosition = Vector3.Zero;
HomeLookAt = Vector3.Zero;
}
CircuitCode = ParseUInt("circuit_code", reply);
RegionX = ParseUInt("region_x", reply);
RegionY = ParseUInt("region_y", reply);
SimPort = (ushort)ParseUInt("sim_port", reply);
string simIP = ParseString("sim_ip", reply);
IPAddress.TryParse(simIP, out SimIP);
SeedCapability = ParseString("seed_capability", reply);
// Buddy list
OSD buddyLLSD;
if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == OSDType.Array)
{
OSDArray buddyArray = (OSDArray)buddyLLSD;
BuddyList = new FriendInfo[buddyArray.Count];
for (int i = 0; i < buddyArray.Count; i++)
{
if (buddyArray[i].Type == OSDType.Map)
{
OSDMap buddy = (OSDMap)buddyArray[i];
BuddyList[i] = new FriendInfo(
ParseUUID("buddy_id", buddy),
(FriendRights)ParseUInt("buddy_rights_given", buddy),
(FriendRights)ParseUInt("buddy_rights_has", buddy));
}
}
}
SecondsSinceEpoch = Utils.UnixTimeToDateTime(ParseUInt("seconds_since_epoch", reply));
InventoryRoot = ParseMappedUUID("inventory-root", "folder_id", reply);
InventorySkeleton = ParseInventoryFolders("inventory-skeleton", AgentID, reply);
LibraryRoot = ParseMappedUUID("inventory-lib-root", "folder_id", reply);
LibraryOwner = ParseMappedUUID("inventory-lib-owner", "agent_id", reply);
LibrarySkeleton = ParseInventoryFolders("inventory-skel-lib", LibraryOwner, reply);
}