aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs133
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs58
-rw-r--r--OpenSim/Framework/AvatarAttachment.cs15
-rw-r--r--OpenSim/Framework/AvatarWearable.cs6
-rw-r--r--OpenSim/Framework/EntityTransferContext.cs14
-rw-r--r--OpenSim/Framework/WearableCacheItem.cs5
6 files changed, 124 insertions, 107 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 330a41e..ebb00d2 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -267,16 +267,17 @@ namespace OpenSim.Framework
267 /// <param name="args"></param> 267 /// <param name="args"></param>
268 public void UnpackAgentCircuitData(OSDMap args) 268 public void UnpackAgentCircuitData(OSDMap args)
269 { 269 {
270 if (args["agent_id"] != null) 270 OSD tmpOSD;
271 AgentID = args["agent_id"].AsUUID(); 271 if (args.TryGetValue("agent_id", out tmpOSD))
272 if (args["base_folder"] != null) 272 AgentID = tmpOSD.AsUUID();
273 BaseFolder = args["base_folder"].AsUUID(); 273 if (args.TryGetValue("base_folder", out tmpOSD))
274 if (args["caps_path"] != null) 274 BaseFolder =tmpOSD.AsUUID();
275 CapsPath = args["caps_path"].AsString(); 275 if (args.TryGetValue("caps_path", out tmpOSD))
276 276 CapsPath = tmpOSD.AsString();
277 if ((args["children_seeds"] != null) && (args["children_seeds"].Type == OSDType.Array)) 277
278 if ((args.TryGetValue("children_seeds", out tmpOSD) && tmpOSD is OSDArray))
278 { 279 {
279 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); 280 OSDArray childrenSeeds = (OSDArray)tmpOSD;
280 ChildrenCapSeeds = new Dictionary<ulong, string>(); 281 ChildrenCapSeeds = new Dictionary<ulong, string>();
281 foreach (OSD o in childrenSeeds) 282 foreach (OSD o in childrenSeeds)
282 { 283 {
@@ -285,53 +286,59 @@ namespace OpenSim.Framework
285 ulong handle = 0; 286 ulong handle = 0;
286 string seed = ""; 287 string seed = "";
287 OSDMap pair = (OSDMap)o; 288 OSDMap pair = (OSDMap)o;
288 if (pair["handle"] != null) 289 if (pair.TryGetValue("handle", out tmpOSD))
289 if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) 290 {
291 if (!UInt64.TryParse(tmpOSD.AsString(), out handle))
290 continue; 292 continue;
291 if (pair["seed"] != null) 293 }
292 seed = pair["seed"].AsString();
293 if (!ChildrenCapSeeds.ContainsKey(handle)) 294 if (!ChildrenCapSeeds.ContainsKey(handle))
294 ChildrenCapSeeds.Add(handle, seed); 295 {
296 if (pair.TryGetValue("seed", out tmpOSD))
297 {
298 seed = tmpOSD.AsString();
299 ChildrenCapSeeds.Add(handle, seed);
300 }
301 }
295 } 302 }
296 } 303 }
297 } 304 }
298 else 305 else
299 ChildrenCapSeeds = new Dictionary<ulong, string>(); 306 ChildrenCapSeeds = new Dictionary<ulong, string>();
300 307
301 if (args["child"] != null) 308 if (args.TryGetValue("child", out tmpOSD))
302 child = args["child"].AsBoolean(); 309 child = tmpOSD.AsBoolean();
303 if (args["circuit_code"] != null) 310 if (args.TryGetValue("circuit_code", out tmpOSD))
304 UInt32.TryParse(args["circuit_code"].AsString(), out circuitcode); 311 UInt32.TryParse(tmpOSD.AsString(), out circuitcode);
305 if (args["first_name"] != null) 312 if (args.TryGetValue("first_name", out tmpOSD))
306 firstname = args["first_name"].AsString(); 313 firstname = tmpOSD.AsString();
307 if (args["last_name"] != null) 314 if (args.TryGetValue("last_name", out tmpOSD))
308 lastname = args["last_name"].AsString(); 315 lastname = tmpOSD.AsString();
309 if (args["inventory_folder"] != null) 316 if (args.TryGetValue("inventory_folder", out tmpOSD))
310 InventoryFolder = args["inventory_folder"].AsUUID(); 317 InventoryFolder = tmpOSD.AsUUID();
311 if (args["secure_session_id"] != null) 318 if (args.TryGetValue("secure_session_id", out tmpOSD))
312 SecureSessionID = args["secure_session_id"].AsUUID(); 319 SecureSessionID = tmpOSD.AsUUID();
313 if (args["session_id"] != null) 320 if (args.TryGetValue("session_id", out tmpOSD))
314 SessionID = args["session_id"].AsUUID(); 321 SessionID = tmpOSD.AsUUID();
315 if (args["service_session_id"] != null) 322 if (args.TryGetValue("service_session_id", out tmpOSD))
316 ServiceSessionID = args["service_session_id"].AsString(); 323 ServiceSessionID = tmpOSD.AsString();
317 if (args["client_ip"] != null) 324 if (args.TryGetValue("client_ip", out tmpOSD))
318 IPAddress = args["client_ip"].AsString(); 325 IPAddress = tmpOSD.AsString();
319 if (args["viewer"] != null) 326 if (args.TryGetValue("viewer", out tmpOSD))
320 Viewer = args["viewer"].AsString(); 327 Viewer = tmpOSD.AsString();
321 if (args["channel"] != null) 328 if (args.TryGetValue("channel", out tmpOSD))
322 Channel = args["channel"].AsString(); 329 Channel = tmpOSD.AsString();
323 if (args["mac"] != null) 330 if (args.TryGetValue("mac", out tmpOSD))
324 Mac = args["mac"].AsString(); 331 Mac = tmpOSD.AsString();
325 if (args["id0"] != null) 332 if (args.TryGetValue("id0", out tmpOSD))
326 Id0 = args["id0"].AsString(); 333 Id0 = tmpOSD.AsString();
327 if (args["teleport_flags"] != null) 334 if (args.TryGetValue("teleport_flags", out tmpOSD))
328 teleportFlags = args["teleport_flags"].AsUInteger(); 335 teleportFlags = tmpOSD.AsUInteger();
329 336
330 if (args["start_pos"] != null) 337 if (args.TryGetValue("start_pos", out tmpOSD))
331 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 338 Vector3.TryParse(tmpOSD.AsString(), out startpos);
332 339
333 if(args["far"] != null) 340 if(args.TryGetValue("far", out tmpOSD))
334 startfar = (float)args["far"].AsReal(); 341 startfar = (float)tmpOSD.AsReal();
335 342
336 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); 343 //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
337 344
@@ -342,12 +349,12 @@ namespace OpenSim.Framework
342 349
343 // Eventually this code should be deprecated, use full appearance 350 // Eventually this code should be deprecated, use full appearance
344 // packing in packed_appearance 351 // packing in packed_appearance
345 if (args["appearance_serial"] != null) 352 if (args.TryGetValue("appearance_serial", out tmpOSD))
346 Appearance.Serial = args["appearance_serial"].AsInteger(); 353 Appearance.Serial = tmpOSD.AsInteger();
347 354
348 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) 355 if (args.TryGetValue("packed_appearance", out tmpOSD) && (tmpOSD is OSDMap))
349 { 356 {
350 Appearance.Unpack((OSDMap)args["packed_appearance"]); 357 Appearance.Unpack((OSDMap)tmpOSD);
351// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); 358// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
352 } 359 }
353 else 360 else
@@ -362,31 +369,29 @@ namespace OpenSim.Framework
362 369
363 ServiceURLs = new Dictionary<string, object>(); 370 ServiceURLs = new Dictionary<string, object>();
364 // Try parse the new way, OSDMap 371 // Try parse the new way, OSDMap
365 if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) 372 if (args.TryGetValue("serviceurls", out tmpOSD) && (tmpOSD is OSDMap))
366 { 373 {
367 OSDMap urls = (OSDMap)(args["serviceurls"]); 374 OSDMap urls = (OSDMap)tmpOSD;
368 foreach (KeyValuePair<String, OSD> kvp in urls) 375 foreach (KeyValuePair<String, OSD> kvp in urls)
369 { 376 {
370 ServiceURLs[kvp.Key] = kvp.Value.AsString(); 377 ServiceURLs[kvp.Key] = kvp.Value;
371 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); 378 //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]);
372
373 } 379 }
374 } 380 }
375 // else try the old way, OSDArray 381 // else try the old way, OSDArray
376 // OBSOLETE -- soon to be deleted 382 // OBSOLETE -- soon to be deleted
377 else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 383 else if (args.TryGetValue("service_urls", out tmpOSD) && (tmpOSD is OSDArray))
378 { 384 {
379 OSDArray urls = (OSDArray)(args["service_urls"]); 385 OSDArray urls = (OSDArray)tmpOSD;
380 for (int i = 0; i < urls.Count / 2; i++) 386 OSD tmpOSDb;
387 for (int i = 0; i < urls.Count - 1; i += 2)
381 { 388 {
382 ServiceURLs[urls[i * 2].AsString()] = urls[(i * 2) + 1].AsString(); 389 tmpOSD = urls[i];
390 tmpOSDb = urls[i + 1];
391 ServiceURLs[tmpOSD.AsString()] = tmpOSDb.AsString();
383 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString()); 392 //System.Console.WriteLine("XXX " + urls[i * 2].AsString() + "=" + urls[(i * 2) + 1].AsString());
384
385 } 393 }
386 } 394 }
387 } 395 }
388
389 } 396 }
390
391
392} 397}
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 77a7621..f1713a6 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -796,25 +796,33 @@ namespace OpenSim.Framework
796 /// </summary> 796 /// </summary>
797 public void Unpack(OSDMap data) 797 public void Unpack(OSDMap data)
798 { 798 {
799 if ((data != null) && (data["serial"] != null)) 799 SetDefaultWearables();
800 m_serial = data["serial"].AsInteger(); 800 SetDefaultTexture();
801 if ((data != null) && (data["height"] != null)) 801 SetDefaultParams();
802 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
803
804 if(data == null)
805 {
806 m_log.Warn("[AVATAR APPEARANCE]: data to unpack is null");
807 return;
808 }
809
810 OSD tmpOSD;
811 if (data.TryGetValue("serial", out tmpOSD))
812 m_serial = tmpOSD.AsInteger();
813 if (data.TryGetValue("height", out tmpOSD))
802// m_avatarHeight = (float)data["height"].AsReal(); 814// m_avatarHeight = (float)data["height"].AsReal();
803 SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); 815 SetSize(new Vector3(0.45f,0.6f, (float)tmpOSD.AsReal()));
804 816
805 try 817 try
806 { 818 {
807 // Wearables 819 // Wearables
808 SetDefaultWearables(); 820 if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
809 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
810 { 821 {
811 OSDArray wears = (OSDArray)(data["wearables"]); 822 OSDArray wears = (OSDArray)tmpOSD;
812 823 m_wearables = new AvatarWearable[wears.Count];
813 int count = wears.Count;
814
815 m_wearables = new AvatarWearable[count];
816 824
817 for (int i = 0; i < count; i++) 825 for (int i = 0; i < wears.Count; i++)
818 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); 826 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
819 } 827 }
820 else 828 else
@@ -823,15 +831,15 @@ namespace OpenSim.Framework
823 } 831 }
824 832
825 // Avatar Textures 833 // Avatar Textures
826 SetDefaultTexture(); 834 if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
827 if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
828 { 835 {
829 OSDArray textures = (OSDArray)(data["textures"]); 836 OSDArray textures = (OSDArray)tmpOSD;
830 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) 837 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
831 { 838 {
832 UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; 839 UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
833 if (textures[i] != null) 840 tmpOSD = textures[i];
834 textureID = textures[i].AsUUID(); 841 if (tmpOSD != null)
842 textureID = tmpOSD.AsUUID();
835 m_texture.CreateFace((uint)i).TextureID = new UUID(textureID); 843 m_texture.CreateFace((uint)i).TextureID = new UUID(textureID);
836 } 844 }
837 } 845 }
@@ -840,18 +848,17 @@ namespace OpenSim.Framework
840 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); 848 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
841 } 849 }
842 850
843 if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array) 851 if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
844 { 852 {
845 OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]); 853 OSDArray bakedOSDArray = (OSDArray)tmpOSD;
846 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray); 854 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
847 } 855 }
848 856
849 // Visual Parameters 857 // Visual Parameters
850 SetDefaultParams(); 858 if (data.TryGetValue("visualparams", out tmpOSD))
851 if ((data != null) && (data["visualparams"] != null))
852 { 859 {
853 if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array)) 860 if (tmpOSD is OSDBinary || tmpOSD is OSDArray)
854 m_visualparams = data["visualparams"].AsBinary(); 861 m_visualparams = tmpOSD.AsBinary();
855 } 862 }
856 else 863 else
857 { 864 {
@@ -859,10 +866,9 @@ namespace OpenSim.Framework
859 } 866 }
860 867
861 // Attachments 868 // Attachments
862 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 869 if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
863 if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
864 { 870 {
865 OSDArray attachs = (OSDArray)(data["attachments"]); 871 OSDArray attachs = (OSDArray)tmpOSD;
866 for (int i = 0; i < attachs.Count; i++) 872 for (int i = 0; i < attachs.Count; i++)
867 { 873 {
868 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]); 874 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
diff --git a/OpenSim/Framework/AvatarAttachment.cs b/OpenSim/Framework/AvatarAttachment.cs
index 07dd385..d8a0ffc 100644
--- a/OpenSim/Framework/AvatarAttachment.cs
+++ b/OpenSim/Framework/AvatarAttachment.cs
@@ -68,11 +68,18 @@ namespace OpenSim.Framework
68 68
69 public void Unpack(OSDMap args) 69 public void Unpack(OSDMap args)
70 { 70 {
71 if (args["point"] != null) 71 OSD tmpOSD;
72 AttachPoint = args["point"].AsInteger(); 72 if (args.TryGetValue("point", out tmpOSD))
73 AttachPoint = tmpOSD.AsInteger();
74 if (args.TryGetValue("item", out tmpOSD))
75 ItemID = tmpOSD.AsUUID();
76 else
77 ItemID = UUID.Zero;
73 78
74 ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; 79 if (args.TryGetValue("asset", out tmpOSD))
75 AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; 80 AssetID = tmpOSD.AsUUID();
81 else
82 AssetID = UUID.Zero;
76 } 83 }
77 } 84 }
78} 85}
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index fddd0f0..abf5759 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -132,10 +132,12 @@ namespace OpenSim.Framework
132 public void Unpack(OSDArray args) 132 public void Unpack(OSDArray args)
133 { 133 {
134 Clear(); 134 Clear();
135 135 OSD tmpOSDA, tmpOSDB;
136 foreach (OSDMap weardata in args) 136 foreach (OSDMap weardata in args)
137 { 137 {
138 Add(weardata["item"].AsUUID(), weardata["asset"].AsUUID()); 138 tmpOSDA = weardata["item"];
139 tmpOSDB = weardata["asset"];
140 Add(tmpOSDA.AsUUID(), tmpOSDB.AsUUID());
139 } 141 }
140 } 142 }
141 143
diff --git a/OpenSim/Framework/EntityTransferContext.cs b/OpenSim/Framework/EntityTransferContext.cs
index 860414e..257c6d1 100644
--- a/OpenSim/Framework/EntityTransferContext.cs
+++ b/OpenSim/Framework/EntityTransferContext.cs
@@ -58,13 +58,13 @@ namespace OpenSim.Framework
58 public void Unpack(OSD data) 58 public void Unpack(OSD data)
59 { 59 {
60 OSDMap map = (OSDMap)data; 60 OSDMap map = (OSDMap)data;
61 61 OSD tmpOSD;
62 if (map.ContainsKey("InboundVersion")) 62 if (map.TryGetValue("InboundVersion", out tmpOSD))
63 InboundVersion = (float)map["InboundVersion"].AsReal(); 63 InboundVersion = (float)tmpOSD.AsReal();
64 if (map.ContainsKey("OutboundVersion")) 64 if (map.TryGetValue("OutboundVersion", out tmpOSD))
65 OutboundVersion = (float)map["OutboundVersion"].AsReal(); 65 OutboundVersion = (float)tmpOSD.AsReal();
66 if (map.ContainsKey("WearablesCount")) 66 if (map.TryGetValue("WearablesCount", out tmpOSD))
67 WearablesCount = map["WearablesCount"].AsInteger(); 67 WearablesCount = tmpOSD.AsInteger();
68 } 68 }
69 } 69 }
70} 70}
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs
index 427e149..e060f22 100644
--- a/OpenSim/Framework/WearableCacheItem.cs
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -161,13 +161,12 @@ namespace OpenSim.Framework
161 public static WearableCacheItem[] BakedFromOSD(OSD pInput) 161 public static WearableCacheItem[] BakedFromOSD(OSD pInput)
162 { 162 {
163 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem(); 163 WearableCacheItem[] pcache = WearableCacheItem.GetDefaultCacheItem();
164
165 if (pInput.Type == OSDType.Array) 164 if (pInput.Type == OSDType.Array)
166 { 165 {
167 OSDArray itemarray = (OSDArray)pInput; 166 OSDArray itemarray = (OSDArray)pInput;
168 foreach (OSDMap item in itemarray) 167 foreach (OSDMap item in itemarray)
169 { 168 {
170 int idx = (int)item["textureindex"].AsUInteger(); 169 int idx = item["textureindex"].AsInteger();
171 if (idx < 0 || idx > pcache.Length) 170 if (idx < 0 || idx > pcache.Length)
172 continue; 171 continue;
173 pcache[idx].CacheId = item["cacheid"].AsUUID(); 172 pcache[idx].CacheId = item["cacheid"].AsUUID();
@@ -217,6 +216,4 @@ namespace OpenSim.Framework
217 return null; 216 return null;
218 } 217 }
219 } 218 }
220
221
222} 219}