diff options
author | diva | 2009-01-03 03:41:41 +0000 |
---|---|---|
committer | diva | 2009-01-03 03:41:41 +0000 |
commit | 1b7ce1c8747877a90de21aeb4b9ab901e55c2834 (patch) | |
tree | b2fca7ad101aef9ab55f0bcb8244825c20c4b56a /OpenSim/Framework | |
parent | * Updates the sim stats module. Cleans out some of the rot. (diff) | |
download | opensim-SC_OLD-1b7ce1c8747877a90de21aeb4b9ab901e55c2834.zip opensim-SC_OLD-1b7ce1c8747877a90de21aeb4b9ab901e55c2834.tar.gz opensim-SC_OLD-1b7ce1c8747877a90de21aeb4b9ab901e55c2834.tar.bz2 opensim-SC_OLD-1b7ce1c8747877a90de21aeb4b9ab901e55c2834.tar.xz |
Plumbing for moving InformRegionOfChildAgent over to RESTComms: pack and unpack methods for AgentCircuitData. This code is not used yet.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 2671e87..9d40af9 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -28,6 +28,10 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OSD = OpenMetaverse.StructuredData.OSD; | ||
32 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
33 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | ||
34 | using OSDParser = OpenMetaverse.StructuredData.OSDParser; | ||
31 | 35 | ||
32 | namespace OpenSim.Framework | 36 | namespace OpenSim.Framework |
33 | { | 37 | { |
@@ -65,6 +69,86 @@ namespace OpenSim.Framework | |||
65 | CapsPath = cAgent.CapsPath; | 69 | CapsPath = cAgent.CapsPath; |
66 | ChildrenCapSeeds = cAgent.ChildrenCapSeeds; | 70 | ChildrenCapSeeds = cAgent.ChildrenCapSeeds; |
67 | } | 71 | } |
72 | |||
73 | public OSDMap PackAgentCircuitData() | ||
74 | { | ||
75 | OSDMap args = new OSDMap(); | ||
76 | args["agent_id"] = OSD.FromUUID(AgentID); | ||
77 | args["base_folder"] = OSD.FromUUID(BaseFolder); | ||
78 | args["caps_path"] = OSD.FromString(CapsPath); | ||
79 | |||
80 | OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); | ||
81 | foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds) | ||
82 | { | ||
83 | OSDMap pair = new OSDMap(); | ||
84 | pair["handle"] = OSD.FromString(kvp.Key.ToString()); | ||
85 | pair["seed"] = OSD.FromString(kvp.Value); | ||
86 | childrenSeeds.Add(pair); | ||
87 | } | ||
88 | args["children_seeds"] = childrenSeeds; | ||
89 | |||
90 | args["child"] = OSD.FromBoolean(child); | ||
91 | args["circuit_code"] = OSD.FromString(circuitcode.ToString()); | ||
92 | args["first_name"] = OSD.FromString(firstname); | ||
93 | args["last_name"] = OSD.FromString(lastname); | ||
94 | args["inventory_folder"] = OSD.FromUUID(InventoryFolder); | ||
95 | args["secure_session_id"] = OSD.FromUUID(SecureSessionID); | ||
96 | args["session_id"] = OSD.FromUUID(SessionID); | ||
97 | args["start_pos"] = OSD.FromString(startpos.ToString()); | ||
98 | |||
99 | return args; | ||
100 | } | ||
101 | |||
102 | public void UnpackAgentCircuitData(OSDMap args) | ||
103 | { | ||
104 | if (args["agent_id"] != null) | ||
105 | AgentID = args["agent_id"].AsUUID(); | ||
106 | if (args["base_folder"] != null) | ||
107 | BaseFolder = args["base_folder"].AsUUID(); | ||
108 | if (args["caps_path"] != null) | ||
109 | CapsPath = args["caps_path"].AsString(); | ||
110 | |||
111 | if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OpenMetaverse.StructuredData.OSDType.Array)) | ||
112 | { | ||
113 | OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); | ||
114 | ChildrenCapSeeds = new Dictionary<ulong, string>(); | ||
115 | foreach (OSD o in childrenSeeds) | ||
116 | { | ||
117 | if (o.Type == OpenMetaverse.StructuredData.OSDType.Map) | ||
118 | { | ||
119 | ulong handle = 0; | ||
120 | string seed = ""; | ||
121 | OSDMap pair = (OSDMap)o; | ||
122 | if (pair["handle"] != null) | ||
123 | if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) | ||
124 | continue; | ||
125 | if (pair["seed"] != null) | ||
126 | seed = pair["seed"].AsString(); | ||
127 | if (!ChildrenCapSeeds.ContainsKey(handle)) | ||
128 | ChildrenCapSeeds.Add(handle, seed); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | if (args["child"] != null) | ||
134 | child = args["child"].AsBoolean(); | ||
135 | if (args["circuit_code"] != null) | ||
136 | UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode); | ||
137 | if (args["first_name"] != null) | ||
138 | firstname = args["first_name"].AsString(); | ||
139 | if (args["last_name"] != null) | ||
140 | lastname = args["last_name"].AsString(); | ||
141 | if (args["inventory_folder"] != null) | ||
142 | InventoryFolder = args["inventory_folder"].AsUUID(); | ||
143 | if (args["secure_session_id"] != null) | ||
144 | SecureSessionID = args["secure_session_id"].AsUUID(); | ||
145 | if (args["session_id"] != null) | ||
146 | SessionID = args["session_id"].AsUUID(); | ||
147 | if (args["start_pos"] != null) | ||
148 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | ||
149 | |||
150 | |||
151 | } | ||
68 | } | 152 | } |
69 | 153 | ||
70 | [Serializable] | 154 | [Serializable] |