aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs103
1 files changed, 29 insertions, 74 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 6303cb1..ba33122 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -34,6 +34,7 @@ using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization.External;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
39 40
@@ -276,14 +277,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
276 277
277 #region manual serialization 278 #region manual serialization
278 279
279 private delegate void SOPXmlProcessor(SceneObjectPart sop, XmlTextReader reader); 280 private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors
280 private static Dictionary<string, SOPXmlProcessor> m_SOPXmlProcessors = new Dictionary<string, SOPXmlProcessor>(); 281 = new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>();
281 282
282 private delegate void TaskInventoryXmlProcessor(TaskInventoryItem item, XmlTextReader reader); 283 private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors
283 private static Dictionary<string, TaskInventoryXmlProcessor> m_TaskInventoryXmlProcessors = new Dictionary<string, TaskInventoryXmlProcessor>(); 284 = new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>();
284 285
285 private delegate void ShapeXmlProcessor(PrimitiveBaseShape shape, XmlTextReader reader); 286 private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors
286 private static Dictionary<string, ShapeXmlProcessor> m_ShapeXmlProcessors = new Dictionary<string, ShapeXmlProcessor>(); 287 = new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>();
287 288
288 static SceneObjectSerializer() 289 static SceneObjectSerializer()
289 { 290 {
@@ -1480,34 +1481,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1480 1481
1481 reader.ReadStartElement("SceneObjectPart"); 1482 reader.ReadStartElement("SceneObjectPart");
1482 1483
1483 string nodeName = string.Empty; 1484 ExternalRepresentationUtils.ExecuteReadProcessors(
1484 while (reader.NodeType != XmlNodeType.EndElement) 1485 obj,
1485 { 1486 m_SOPXmlProcessors,
1486 nodeName = reader.Name; 1487 reader,
1487 SOPXmlProcessor p = null; 1488 (o, nodeName, e)
1488 if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p)) 1489 => m_log.ErrorFormat(
1489 { 1490 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
1490 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); 1491 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
1491 try
1492 {
1493 p(obj, reader);
1494 }
1495 catch (Exception e)
1496 {
1497 m_log.DebugFormat(
1498 "[SceneObjectSerializer]: exception while parsing {0} in object {1} {2}: {3}{4}",
1499 obj.Name, obj.UUID, nodeName, e.Message, e.StackTrace);
1500 if (reader.NodeType == XmlNodeType.EndElement)
1501 reader.Read();
1502 }
1503 }
1504 else
1505 {
1506// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName);
1507 reader.ReadOuterXml(); // ignore
1508 }
1509
1510 }
1511 1492
1512 reader.ReadEndElement(); // SceneObjectPart 1493 reader.ReadEndElement(); // SceneObjectPart
1513 1494
@@ -1526,17 +1507,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1526 reader.ReadStartElement("TaskInventoryItem", String.Empty); // TaskInventory 1507 reader.ReadStartElement("TaskInventoryItem", String.Empty); // TaskInventory
1527 1508
1528 TaskInventoryItem item = new TaskInventoryItem(); 1509 TaskInventoryItem item = new TaskInventoryItem();
1529 while (reader.NodeType != XmlNodeType.EndElement) 1510
1530 { 1511 ExternalRepresentationUtils.ExecuteReadProcessors(
1531 TaskInventoryXmlProcessor p = null; 1512 item,
1532 if (m_TaskInventoryXmlProcessors.TryGetValue(reader.Name, out p)) 1513 m_TaskInventoryXmlProcessors,
1533 p(item, reader); 1514 reader);
1534 else 1515
1535 {
1536// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value);
1537 reader.ReadOuterXml();
1538 }
1539 }
1540 reader.ReadEndElement(); // TaskInventoryItem 1516 reader.ReadEndElement(); // TaskInventoryItem
1541 tinv.Add(item.ItemID, item); 1517 tinv.Add(item.ItemID, item);
1542 1518
@@ -1563,35 +1539,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1563 1539
1564 reader.ReadStartElement(name, String.Empty); // Shape 1540 reader.ReadStartElement(name, String.Empty); // Shape
1565 1541
1566 string nodeName = string.Empty; 1542 ExternalRepresentationUtils.ExecuteReadProcessors(
1567 while (reader.NodeType != XmlNodeType.EndElement) 1543 shape,
1568 { 1544 m_ShapeXmlProcessors,
1569 nodeName = reader.Name; 1545 reader,
1570 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); 1546 (o, nodeName, e)
1571 ShapeXmlProcessor p = null; 1547 => m_log.ErrorFormat(
1572 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) 1548 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1573 { 1549 nodeName, e.Message, e.StackTrace));
1574 try
1575 {
1576 p(shape, reader);
1577 }
1578 catch (Exception e)
1579 {
1580 errors = true;
1581 m_log.DebugFormat(
1582 "[SceneObjectSerializer]: exception while parsing Shape property {0}: {1}{2}",
1583 nodeName, e.Message, e.StackTrace);
1584
1585 if (reader.NodeType == XmlNodeType.EndElement)
1586 reader.Read();
1587 }
1588 }
1589 else
1590 {
1591 // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
1592 reader.ReadOuterXml();
1593 }
1594 }
1595 1550
1596 reader.ReadEndElement(); // Shape 1551 reader.ReadEndElement(); // Shape
1597 1552