/// Serialize the object
/// </summary>
/// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
public OSDMap Serialize()
{
OSDMap map = new OSDMap(5);
map.put("session_id", OSD.FromUUID(SessionID));
OSDMap agentMap = new OSDMap(11);
agentMap.put("agents_in_view", OSD.FromInteger(AgentsInView));
agentMap.put("fps", OSD.FromReal(AgentFPS));
agentMap.put("language", OSD.FromString(AgentLanguage));
agentMap.put("mem_use", OSD.FromReal(AgentMemoryUsed));
agentMap.put("meters_traveled", OSD.FromReal(MetersTraveled));
agentMap.put("ping", OSD.FromReal(AgentPing));
agentMap.put("regions_visited", OSD.FromInteger(RegionsVisited));
agentMap.put("run_time", OSD.FromReal(AgentRuntime));
agentMap.put("sim_fps", OSD.FromReal(SimulatorFPS));
agentMap.put("start_time", OSD.FromUInteger(Utils.dateToUnixTime(AgentStartTime)));
agentMap.put("version", OSD.FromString(AgentVersion));
map.put("agent", agentMap);
OSDMap downloadsMap = new OSDMap(3); // downloads
downloadsMap.put("object_kbytes", OSD.FromReal(object_kbytes));
downloadsMap.put("texture_kbytes", OSD.FromReal(texture_kbytes));
downloadsMap.put("world_kbytes", OSD.FromReal(world_kbytes));
map.put("downloads", downloadsMap);
OSDMap miscMap = new OSDMap(2);
miscMap.put("Version", OSD.FromReal(MiscVersion));
miscMap.put("Vertex Buffers Enabled", OSD.FromBoolean(VertexBuffersEnabled));
map.put("misc", miscMap);
OSDMap statsMap = new OSDMap(2);
OSDMap failuresMap = new OSDMap(6);
failuresMap.put("dropped", OSD.FromInteger(StatsDropped));
failuresMap.put("failed_resends", OSD.FromInteger(StatsFailedResends));
failuresMap.put("invalid", OSD.FromInteger(FailuresInvalid));
failuresMap.put("off_circuit", OSD.FromInteger(FailuresOffCircuit));
failuresMap.put("resent", OSD.FromInteger(FailuresResent));
failuresMap.put("send_packet", OSD.FromInteger(FailuresSendPacket));
statsMap.put("failures", failuresMap);
OSDMap statsMiscMap = new OSDMap(3);
statsMiscMap.put("int_1", OSD.FromInteger(MiscInt1));
statsMiscMap.put("int_2", OSD.FromInteger(MiscInt2));
statsMiscMap.put("string_1", OSD.FromString(MiscString1));
statsMap.put("misc", statsMiscMap);
OSDMap netMap = new OSDMap(3);
// in
OSDMap netInMap = new OSDMap(4);
netInMap.put("compressed_packets", OSD.FromInteger(InCompressedPackets));
netInMap.put("kbytes", OSD.FromReal(InKbytes));
netInMap.put("packets", OSD.FromReal(InPackets));
netInMap.put("savings", OSD.FromReal(InSavings));
netMap.put("in", netInMap);
// out
OSDMap netOutMap = new OSDMap(4);
netOutMap.put("compressed_packets", OSD.FromInteger(OutCompressedPackets));
netOutMap.put("kbytes", OSD.FromReal(OutKbytes));
netOutMap.put("packets", OSD.FromReal(OutPackets));
netOutMap.put("savings", OSD.FromReal(OutSavings));
netMap.put("out", netOutMap);
statsMap.put("net", netMap);
//system
OSDMap systemStatsMap = new OSDMap(7);
systemStatsMap.put("cpu", OSD.FromString(SystemCPU));
systemStatsMap.put("gpu", OSD.FromString(SystemGPU));
systemStatsMap.put("gpu_class", OSD.FromInteger(SystemGPUClass));
systemStatsMap.put("gpu_vendor", OSD.FromString(SystemGPUVendor));
systemStatsMap.put("gpu_version", OSD.FromString(SystemGPUVersion));
systemStatsMap.put("os", OSD.FromString(SystemOS));
systemStatsMap.put("ram", OSD.FromInteger(SystemInstalledRam));
map.put("system", systemStatsMap);
map.put("stats", statsMap);
return map;
}