private AvatarAppearance ConvertXMLToAvatarAppearance(OSDMap map, out string FolderNameToPlaceAppearanceIn) { AvatarAppearance appearance = new AvatarAppearance(); appearance.Unpack(map); FolderNameToPlaceAppearanceIn = map["FolderName"].AsString(); return appearance; }
/// <summary> /// Unpack agent circuit data map into an AgentCiruitData object /// </summary> /// <param name = "args"></param> public virtual void UnpackAgentCircuitData(OSDMap args) { if (args["agent_id"] != null) AgentID = args["agent_id"].AsUUID(); if (args["caps_path"] != null) CapsPath = args["caps_path"].AsString(); if (args["reallyischild"] != null) reallyischild = args["reallyischild"].AsBoolean(); if (args["child"] != null) child = args["child"].AsBoolean(); if (args["circuit_code"] != null) UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode); if (args["secure_session_id"] != null) SecureSessionID = args["secure_session_id"].AsUUID(); if (args["session_id"] != null) SessionID = args["session_id"].AsUUID(); if (args["service_session_id"] != null) ServiceSessionID = args["service_session_id"].AsString(); if (args["client_ip"] != null) IPAddress = args["client_ip"].AsString(); if (args["first_name"] != null) firstname = args["first_name"].AsString(); if (args["last_name"] != null) lastname = args["last_name"].AsString(); if (args["start_pos"] != null) Vector3.TryParse(args["start_pos"].AsString(), out startpos); if (args["teleport_flags"] != null) teleportFlags = args["teleport_flags"].AsUInteger(); if (args["draw_distance"] != null) DrawDistance = args["draw_distance"]; // DEBUG ON //MainConsole.Instance.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}", AgentID, child, startpos.ToString()); // DEBUG OFF try { // Unpack various appearance elements Appearance = new AvatarAppearance(AgentID); // Eventually this code should be deprecated, use full appearance // packing in packed_appearance if (args["appearance_serial"] != null) Appearance.Serial = args["appearance_serial"].AsInteger(); if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) { Appearance.Unpack((OSDMap)args["packed_appearance"]); // DEBUG ON //MainConsole.Instance.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); // DEBUG OFF } // DEBUG ON else MainConsole.Instance.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance, dne ? " + !args.ContainsKey("packed_appearance")); // DEBUG OFF } catch (Exception e) { MainConsole.Instance.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}", e); } if (args.ContainsKey("otherInfo")) OtherInformation = (OSDMap)OSDParser.DeserializeLLSDXml(args["otherInfo"].AsString()); ServiceURLs = new Dictionary<string, object>(); // Try parse the new way, OSDMap if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) { OSDMap urls = (OSDMap)(args["serviceurls"]); foreach (KeyValuePair<String, OSD> kvp in urls) { ServiceURLs[kvp.Key] = kvp.Value.AsString(); //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); } } }