aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs93
1 files changed, 1 insertions, 92 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 99e6e1e..b0de405 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -406,96 +406,6 @@ namespace OpenSim.Region.Framework.Scenes
406 SetRootPart(part); 406 SetRootPart(part);
407 } 407 }
408 408
409 public SceneObjectGroup(string xmlData, bool isOriginalXmlFormat)
410 : this(UUID.Zero, xmlData, isOriginalXmlFormat)
411 {
412 }
413
414 /// <summary>
415 /// Create an object using serialized data in OpenSim's original xml format.
416 /// </summary>
417 /// <param name="fromUserInventoryItemID">
418 /// If applicable, the user inventory item id from which this object was rezzed. If not applicable then this
419 /// should be UUID.Zero
420 /// </param>
421 /// <param name="xmlData"></param>
422 /// <param name="isOriginalXmlFormat">
423 /// This parameter only exists to separate the two different xml constructors. In the future, versions should
424 /// be specified within the xml itself.
425 /// </param>
426 public SceneObjectGroup(UUID fromUserInventoryItemID, string xmlData, bool isOriginalXmlFormat)
427 {
428
429 if (!isOriginalXmlFormat)
430 throw new Exception("This constructor must specify the xml is in OpenSim's original format");
431
432 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
433 //int time = System.Environment.TickCount;
434
435 // libomv.types changes UUID to Guid
436 xmlData = xmlData.Replace("<UUID>", "<Guid>");
437 xmlData = xmlData.Replace("</UUID>", "</Guid>");
438
439 // Handle Nested <UUID><UUID> property
440 xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
441 xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
442
443 try
444 {
445
446 StringReader sr;
447 XmlTextReader reader;
448 XmlNodeList parts;
449 XmlDocument doc;
450 int linkNum;
451
452 doc = new XmlDocument();
453 doc.LoadXml(xmlData);
454 parts = doc.GetElementsByTagName("RootPart");
455
456 if (parts.Count == 0)
457 {
458 throw new Exception("[SCENE] Invalid Xml format - no root part");
459 }
460 else
461 {
462 sr = new StringReader(parts[0].InnerXml);
463 reader = new XmlTextReader(sr);
464 SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
465 reader.Close();
466 sr.Close();
467 }
468
469 parts = doc.GetElementsByTagName("Part");
470
471 for (int i=0; i<parts.Count ; i++)
472 {
473 sr = new StringReader(parts[i].InnerXml);
474 reader = new XmlTextReader(sr);
475 SceneObjectPart part = SceneObjectPart.FromXml(reader);
476 linkNum = part.LinkNum;
477 AddPart(part);
478 part.LinkNum = linkNum;
479 part.TrimPermissions();
480 part.StoreUndoState();
481 reader.Close();
482 sr.Close();
483 }
484
485 // Script state may, or may not, exist. Not having any, is NOT
486 // ever a problem.
487
488 LoadScriptState(doc);
489
490 }
491 catch (Exception e)
492 {
493 m_log.ErrorFormat("[SCENE]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
494 }
495
496 //m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
497 }
498
499 /// <summary> 409 /// <summary>
500 /// Create an object using serialized data in OpenSim's xml2 format. 410 /// Create an object using serialized data in OpenSim's xml2 format.
501 /// </summary> 411 /// </summary>
@@ -585,7 +495,7 @@ namespace OpenSim.Region.Framework.Scenes
585 { 495 {
586 } 496 }
587 497
588 private void LoadScriptState(XmlDocument doc) 498 public void LoadScriptState(XmlDocument doc)
589 { 499 {
590 XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); 500 XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState");
591 if (nodes.Count > 0) 501 if (nodes.Count > 0)
@@ -745,7 +655,6 @@ namespace OpenSim.Region.Framework.Scenes
745 655
746 #endregion 656 #endregion
747 657
748
749 public string ToXmlString() 658 public string ToXmlString()
750 { 659 {
751 using (StringWriter sw = new StringWriter()) 660 using (StringWriter sw = new StringWriter())