aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDiva Canto2010-11-27 11:40:54 -0800
committerDiva Canto2010-11-27 11:40:54 -0800
commitca8d0157333823b549c7ae36b40ea3c05045fc25 (patch)
tree267f4219ef8447178e494c7637cf7a1d89367460 /OpenSim/Region/Framework
parentCreator information preserved upon HG transfers. (diff)
downloadopensim-SC_OLD-ca8d0157333823b549c7ae36b40ea3c05045fc25.zip
opensim-SC_OLD-ca8d0157333823b549c7ae36b40ea3c05045fc25.tar.gz
opensim-SC_OLD-ca8d0157333823b549c7ae36b40ea3c05045fc25.tar.bz2
opensim-SC_OLD-ca8d0157333823b549c7ae36b40ea3c05045fc25.tar.xz
Changed the parser for InventoryItem deserialization. Moved some utility functions around.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs122
1 files changed, 31 insertions, 91 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 9cf5a39..da25e80 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -414,7 +414,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
414 414
415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) 415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
416 { 416 {
417 obj.CreatorID = ReadUUID(reader, "CreatorID"); 417 obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
418 } 418 }
419 419
420 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) 420 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
424 424
425 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) 425 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
426 { 426 {
427 obj.FolderID = ReadUUID(reader, "FolderID"); 427 obj.FolderID = Util.ReadUUID(reader, "FolderID");
428 } 428 }
429 429
430 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) 430 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader)
@@ -439,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
439 439
440 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) 440 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
441 { 441 {
442 obj.UUID = ReadUUID(reader, "UUID"); 442 obj.UUID = Util.ReadUUID(reader, "UUID");
443 } 443 }
444 444
445 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) 445 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
@@ -474,32 +474,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
474 474
475 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) 475 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
476 { 476 {
477 obj.GroupPosition = ReadVector(reader, "GroupPosition"); 477 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
478 } 478 }
479 479
480 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) 480 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
481 { 481 {
482 obj.OffsetPosition = ReadVector(reader, "OffsetPosition"); ; 482 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
483 } 483 }
484 484
485 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) 485 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
486 { 486 {
487 obj.RotationOffset = ReadQuaternion(reader, "RotationOffset"); 487 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
488 } 488 }
489 489
490 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) 490 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
491 { 491 {
492 obj.Velocity = ReadVector(reader, "Velocity"); 492 obj.Velocity = Util.ReadVector(reader, "Velocity");
493 } 493 }
494 494
495 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) 495 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
496 { 496 {
497 obj.AngularVelocity = ReadVector(reader, "AngularVelocity"); 497 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
498 } 498 }
499 499
500 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) 500 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
501 { 501 {
502 obj.Acceleration = ReadVector(reader, "Acceleration"); 502 obj.Acceleration = Util.ReadVector(reader, "Acceleration");
503 } 503 }
504 504
505 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) 505 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader)
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
553 553
554 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 554 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
555 { 555 {
556 obj.Scale = ReadVector(reader, "Scale"); 556 obj.Scale = Util.ReadVector(reader, "Scale");
557 } 557 }
558 558
559 private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader) 559 private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
@@ -563,22 +563,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
563 563
564 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) 564 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
565 { 565 {
566 obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation"); 566 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
567 } 567 }
568 568
569 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) 569 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader)
570 { 570 {
571 obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition"); 571 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
572 } 572 }
573 573
574 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) 574 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader)
575 { 575 {
576 obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL"); 576 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
577 } 577 }
578 578
579 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) 579 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader)
580 { 580 {
581 obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL"); 581 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
582 } 582 }
583 583
584 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) 584 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader)
@@ -614,17 +614,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
614 614
615 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) 615 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader)
616 { 616 {
617 obj.GroupID = ReadUUID(reader, "GroupID"); 617 obj.GroupID = Util.ReadUUID(reader, "GroupID");
618 } 618 }
619 619
620 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) 620 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader)
621 { 621 {
622 obj.OwnerID = ReadUUID(reader, "OwnerID"); 622 obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
623 } 623 }
624 624
625 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) 625 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader)
626 { 626 {
627 obj.LastOwnerID = ReadUUID(reader, "LastOwnerID"); 627 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
628 } 628 }
629 629
630 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) 630 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader)
@@ -663,7 +663,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
663 663
664 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) 664 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
665 { 665 {
666 obj.CollisionSound = ReadUUID(reader, "CollisionSound"); 666 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
667 } 667 }
668 668
669 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) 669 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader)
@@ -690,7 +690,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
690 #region TaskInventoryXmlProcessors 690 #region TaskInventoryXmlProcessors
691 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) 691 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader)
692 { 692 {
693 item.AssetID = ReadUUID(reader, "AssetID"); 693 item.AssetID = Util.ReadUUID(reader, "AssetID");
694 } 694 }
695 695
696 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) 696 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -705,7 +705,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
705 705
706 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) 706 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader)
707 { 707 {
708 item.CreatorID = ReadUUID(reader, "CreatorID"); 708 item.CreatorID = Util.ReadUUID(reader, "CreatorID");
709 } 709 }
710 710
711 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) 711 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
@@ -730,7 +730,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
730 730
731 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) 731 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader)
732 { 732 {
733 item.GroupID = ReadUUID(reader, "GroupID"); 733 item.GroupID = Util.ReadUUID(reader, "GroupID");
734 } 734 }
735 735
736 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) 736 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -745,20 +745,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
745 745
746 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) 746 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader)
747 { 747 {
748 item.ItemID = ReadUUID(reader, "ItemID"); 748 item.ItemID = Util.ReadUUID(reader, "ItemID");
749 } 749 }
750 750
751 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) 751 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
752 { 752 {
753 ReadUUID(reader, "OldItemID"); 753 Util.ReadUUID(reader, "OldItemID");
754 // On deserialization, the old item id MUST BE UUID.Zero!!!!! 754 // On deserialization, the old item id MUST BE UUID.Zero!!!!!
755 // Setting this to the saved value will BREAK script persistence! 755 // Setting this to the saved value will BREAK script persistence!
756 // item.OldItemID = ReadUUID(reader, "OldItemID"); 756 // item.OldItemID = Util.ReadUUID(reader, "OldItemID");
757 } 757 }
758 758
759 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) 759 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
760 { 760 {
761 item.LastOwnerID = ReadUUID(reader, "LastOwnerID"); 761 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
762 } 762 }
763 763
764 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) 764 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
@@ -773,7 +773,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
773 773
774 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) 774 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
775 { 775 {
776 item.OwnerID = ReadUUID(reader, "OwnerID"); 776 item.OwnerID = Util.ReadUUID(reader, "OwnerID");
777 } 777 }
778 778
779 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) 779 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -783,17 +783,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
783 783
784 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) 784 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader)
785 { 785 {
786 item.ParentID = ReadUUID(reader, "ParentID"); 786 item.ParentID = Util.ReadUUID(reader, "ParentID");
787 } 787 }
788 788
789 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) 789 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
790 { 790 {
791 item.ParentPartID = ReadUUID(reader, "ParentPartID"); 791 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
792 } 792 }
793 793
794 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) 794 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
795 { 795 {
796 item.PermsGranter = ReadUUID(reader, "PermsGranter"); 796 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
797 } 797 }
798 798
799 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) 799 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
@@ -922,7 +922,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
922 922
923 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) 923 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader)
924 { 924 {
925 shp.Scale = ReadVector(reader, "Scale"); 925 shp.Scale = Util.ReadVector(reader, "Scale");
926 } 926 }
927 927
928 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) 928 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -950,7 +950,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
950 950
951 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) 951 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
952 { 952 {
953 shp.SculptTexture = ReadUUID(reader, "SculptTexture"); 953 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
954 } 954 }
955 955
956 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) 956 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1459,66 +1459,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1459 return obj; 1459 return obj;
1460 } 1460 }
1461 1461
1462 static UUID ReadUUID(XmlTextReader reader, string name)
1463 {
1464 UUID id;
1465 string idStr;
1466
1467 reader.ReadStartElement(name);
1468
1469 if (reader.Name == "Guid")
1470 idStr = reader.ReadElementString("Guid");
1471 else // UUID
1472 idStr = reader.ReadElementString("UUID");
1473
1474 UUID.TryParse(idStr, out id);
1475 reader.ReadEndElement();
1476
1477 return id;
1478 }
1479
1480 static Vector3 ReadVector(XmlTextReader reader, string name)
1481 {
1482 Vector3 vec;
1483
1484 reader.ReadStartElement(name);
1485 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
1486 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
1487 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
1488 reader.ReadEndElement();
1489
1490 return vec;
1491 }
1492
1493 static Quaternion ReadQuaternion(XmlTextReader reader, string name)
1494 {
1495 Quaternion quat = new Quaternion();
1496
1497 reader.ReadStartElement(name);
1498 while (reader.NodeType != XmlNodeType.EndElement)
1499 {
1500 switch (reader.Name.ToLower())
1501 {
1502 case "x":
1503 quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1504 break;
1505 case "y":
1506 quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1507 break;
1508 case "z":
1509 quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1510 break;
1511 case "w":
1512 quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1513 break;
1514 }
1515 }
1516
1517 reader.ReadEndElement();
1518
1519 return quat;
1520 }
1521
1522 static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) 1462 static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
1523 { 1463 {
1524 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1464 TaskInventoryDictionary tinv = new TaskInventoryDictionary();