aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs136
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs4
2 files changed, 70 insertions, 70 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 364da72..f8b4483 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -443,49 +443,49 @@ namespace OpenSim.Region.Framework.Scenes
443 try 443 try
444 { 444 {
445 445
446 StringReader sr; 446 StringReader sr;
447 XmlTextReader reader; 447 XmlTextReader reader;
448 XmlNodeList parts; 448 XmlNodeList parts;
449 XmlDocument doc; 449 XmlDocument doc;
450 int linkNum; 450 int linkNum;
451 451
452 doc = new XmlDocument(); 452 doc = new XmlDocument();
453 doc.LoadXml(xmlData); 453 doc.LoadXml(xmlData);
454 parts = doc.GetElementsByTagName("RootPart"); 454 parts = doc.GetElementsByTagName("RootPart");
455 455
456 if(parts.Count == 0) 456 if (parts.Count == 0)
457 { 457 {
458 throw new Exception("[SCENE] Invalid Xml format - no root part"); 458 throw new Exception("[SCENE] Invalid Xml format - no root part");
459 } 459 }
460 else 460 else
461 { 461 {
462 sr = new StringReader(parts[0].InnerXml); 462 sr = new StringReader(parts[0].InnerXml);
463 reader = new XmlTextReader(sr); 463 reader = new XmlTextReader(sr);
464 SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); 464 SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader));
465 reader.Close(); 465 reader.Close();
466 sr.Close(); 466 sr.Close();
467 } 467 }
468 468
469 parts = doc.GetElementsByTagName("Part"); 469 parts = doc.GetElementsByTagName("Part");
470 470
471 for (int i=0; i<parts.Count ; i++) 471 for (int i=0; i<parts.Count ; i++)
472 { 472 {
473 sr = new StringReader(parts[i].InnerXml); 473 sr = new StringReader(parts[i].InnerXml);
474 reader = new XmlTextReader(sr); 474 reader = new XmlTextReader(sr);
475 SceneObjectPart part = SceneObjectPart.FromXml(reader); 475 SceneObjectPart part = SceneObjectPart.FromXml(reader);
476 linkNum = part.LinkNum; 476 linkNum = part.LinkNum;
477 AddPart(part); 477 AddPart(part);
478 part.LinkNum = linkNum; 478 part.LinkNum = linkNum;
479 part.TrimPermissions(); 479 part.TrimPermissions();
480 part.StoreUndoState(); 480 part.StoreUndoState();
481 reader.Close(); 481 reader.Close();
482 sr.Close(); 482 sr.Close();
483 } 483 }
484 484
485 // Script state may, or may not, exist. Not having any, is NOT 485 // Script state may, or may not, exist. Not having any, is NOT
486 // ever a problem. 486 // ever a problem.
487 487
488 LoadScriptState(doc); 488 LoadScriptState(doc);
489 489
490 } 490 }
491 catch (Exception e) 491 catch (Exception e)
@@ -521,37 +521,37 @@ namespace OpenSim.Region.Framework.Scenes
521 try 521 try
522 { 522 {
523 523
524 XmlDocument doc = new XmlDocument(); 524 XmlDocument doc = new XmlDocument();
525 doc.LoadXml(xmlData); 525 doc.LoadXml(xmlData);
526 526
527 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); 527 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
528 528
529 // Process the root part first 529 // Process the root part first
530 if(parts.Count > 0) 530 if (parts.Count > 0)
531 { 531 {
532 StringReader sr = new StringReader(parts[0].OuterXml); 532 StringReader sr = new StringReader(parts[0].OuterXml);
533 XmlTextReader reader = new XmlTextReader(sr); 533 XmlTextReader reader = new XmlTextReader(sr);
534 SetRootPart(CreatePartFromXml(reader)); 534 SetRootPart(CreatePartFromXml(reader));
535 reader.Close(); 535 reader.Close();
536 sr.Close(); 536 sr.Close();
537 } 537 }
538 538
539 // Then deal with the rest 539 // Then deal with the rest
540 for(int i=1; i<parts.Count; i++) 540 for (int i=1; i<parts.Count; i++)
541 { 541 {
542 StringReader sr = new StringReader(parts[i].OuterXml); 542 StringReader sr = new StringReader(parts[i].OuterXml);
543 XmlTextReader reader = new XmlTextReader(sr); 543 XmlTextReader reader = new XmlTextReader(sr);
544 SceneObjectPart part = CreatePartFromXml(reader); 544 SceneObjectPart part = CreatePartFromXml(reader);
545 AddPart(part); 545 AddPart(part);
546 part.StoreUndoState(); 546 part.StoreUndoState();
547 reader.Close(); 547 reader.Close();
548 sr.Close(); 548 sr.Close();
549 } 549 }
550 550
551 // Script state may, or may not, exist. Not having any, is NOT 551 // Script state may, or may not, exist. Not having any, is NOT
552 // ever a problem. 552 // ever a problem.
553 553
554 LoadScriptState(doc); 554 LoadScriptState(doc);
555 555
556 } 556 }
557 catch (Exception e) 557 catch (Exception e)
@@ -587,18 +587,18 @@ namespace OpenSim.Region.Framework.Scenes
587 587
588 private void LoadScriptState(XmlDocument doc) 588 private void LoadScriptState(XmlDocument doc)
589 { 589 {
590 XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); 590 XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState");
591 if(nodes.Count > 0) 591 if (nodes.Count > 0)
592 { 592 {
593 m_savedScriptState = new Dictionary<UUID, string>(); 593 m_savedScriptState = new Dictionary<UUID, string>();
594 foreach(XmlNode node in nodes) 594 foreach (XmlNode node in nodes)
595 { 595 {
596 if(node.Attributes["UUID"] != null) 596 if (node.Attributes["UUID"] != null)
597 { 597 {
598 UUID itemid = new UUID(node.Attributes["UUID"].Value); 598 UUID itemid = new UUID(node.Attributes["UUID"].Value);
599 m_savedScriptState.Add(itemid, node.InnerXml); 599 m_savedScriptState.Add(itemid, node.InnerXml);
600 } 600 }
601 } 601 }
602 } 602 }
603 } 603 }
604 604
@@ -851,19 +851,19 @@ namespace OpenSim.Region.Framework.Scenes
851 } 851 }
852 } 852 }
853 853
854 if(states.Count > 0) 854 if (states.Count > 0)
855 { 855 {
856 // Now generate the necessary XML wrappings 856 // Now generate the necessary XML wrappings
857 writer.WriteStartElement(String.Empty, "GroupScriptStates", String.Empty); 857 writer.WriteStartElement(String.Empty, "GroupScriptStates", String.Empty);
858 foreach(UUID itemid in states.Keys) 858 foreach (UUID itemid in states.Keys)
859 { 859 {
860 doc.LoadXml(states[itemid]); 860 doc.LoadXml(states[itemid]);
861 writer.WriteStartElement(String.Empty, "SavedScriptState", String.Empty); 861 writer.WriteStartElement(String.Empty, "SavedScriptState", String.Empty);
862 writer.WriteAttributeString(String.Empty, "UUID", String.Empty, itemid.ToString()); 862 writer.WriteAttributeString(String.Empty, "UUID", String.Empty, itemid.ToString());
863 writer.WriteRaw(doc.DocumentElement.OuterXml); // Writes ScriptState element 863 writer.WriteRaw(doc.DocumentElement.OuterXml); // Writes ScriptState element
864 writer.WriteEndElement(); // End of SavedScriptState 864 writer.WriteEndElement(); // End of SavedScriptState
865 } 865 }
866 writer.WriteEndElement(); // End of GroupScriptStates 866 writer.WriteEndElement(); // End of GroupScriptStates
867 } 867 }
868 868
869 } 869 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index e952799..6bf1654 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
265 } 265 }
266 else 266 else
267 { 267 {
268 if(m_part.ParentGroup.m_savedScriptState != null) 268 if (m_part.ParentGroup.m_savedScriptState != null)
269 RestoreSavedScriptState(item.OldItemID, item.ItemID); 269 RestoreSavedScriptState(item.OldItemID, item.ItemID);
270 m_items[item.ItemID].PermsMask = 0; 270 m_items[item.ItemID].PermsMask = 0;
271 m_items[item.ItemID].PermsGranter = UUID.Zero; 271 m_items[item.ItemID].PermsGranter = UUID.Zero;
@@ -283,7 +283,7 @@ namespace OpenSim.Region.Framework.Scenes
283 283
284 private void RestoreSavedScriptState(UUID oldID, UUID newID) 284 private void RestoreSavedScriptState(UUID oldID, UUID newID)
285 { 285 {
286 if(m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) 286 if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
287 { 287 {
288 string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(), 288 string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(),
289 newID.ToString()+".state"); 289 newID.ToString()+".state");