diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 164 |
1 files changed, 42 insertions, 122 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 9cf5a39..6c9826f 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -409,12 +409,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
409 | #region SOPXmlProcessors | 409 | #region SOPXmlProcessors |
410 | private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) | 410 | private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) |
411 | { | 411 | { |
412 | obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty); | 412 | obj.AllowedDrop = Util.ReadBoolean(reader); |
413 | } | 413 | } |
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) |
@@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
459 | 459 | ||
460 | private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) | 460 | private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) |
461 | { | 461 | { |
462 | obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty); | 462 | obj.PassTouches = Util.ReadBoolean(reader); |
463 | } | 463 | } |
464 | 464 | ||
465 | private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) | 465 | private static void ProcessRegionHandle(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) |
@@ -654,16 +654,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
654 | 654 | ||
655 | private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) | 655 | private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) |
656 | { | 656 | { |
657 | string value = reader.ReadElementContentAsString("Flags", String.Empty); | 657 | obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); |
658 | // !!!!! to deal with flags without commas | ||
659 | if (value.Contains(" ") && !value.Contains(",")) | ||
660 | value = value.Replace(" ", ", "); | ||
661 | obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value); | ||
662 | } | 658 | } |
663 | 659 | ||
664 | private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) | 660 | private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) |
665 | { | 661 | { |
666 | obj.CollisionSound = ReadUUID(reader, "CollisionSound"); | 662 | obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); |
667 | } | 663 | } |
668 | 664 | ||
669 | private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) | 665 | private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) |
@@ -690,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
690 | #region TaskInventoryXmlProcessors | 686 | #region TaskInventoryXmlProcessors |
691 | private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) | 687 | private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) |
692 | { | 688 | { |
693 | item.AssetID = ReadUUID(reader, "AssetID"); | 689 | item.AssetID = Util.ReadUUID(reader, "AssetID"); |
694 | } | 690 | } |
695 | 691 | ||
696 | private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) | 692 | private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) |
@@ -705,7 +701,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
705 | 701 | ||
706 | private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) | 702 | private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) |
707 | { | 703 | { |
708 | item.CreatorID = ReadUUID(reader, "CreatorID"); | 704 | item.CreatorID = Util.ReadUUID(reader, "CreatorID"); |
709 | } | 705 | } |
710 | 706 | ||
711 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) | 707 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) |
@@ -730,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
730 | 726 | ||
731 | private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) | 727 | private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) |
732 | { | 728 | { |
733 | item.GroupID = ReadUUID(reader, "GroupID"); | 729 | item.GroupID = Util.ReadUUID(reader, "GroupID"); |
734 | } | 730 | } |
735 | 731 | ||
736 | private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) | 732 | private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) |
@@ -745,20 +741,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
745 | 741 | ||
746 | private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) | 742 | private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) |
747 | { | 743 | { |
748 | item.ItemID = ReadUUID(reader, "ItemID"); | 744 | item.ItemID = Util.ReadUUID(reader, "ItemID"); |
749 | } | 745 | } |
750 | 746 | ||
751 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) | 747 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) |
752 | { | 748 | { |
753 | ReadUUID(reader, "OldItemID"); | 749 | Util.ReadUUID(reader, "OldItemID"); |
754 | // On deserialization, the old item id MUST BE UUID.Zero!!!!! | 750 | // On deserialization, the old item id MUST BE UUID.Zero!!!!! |
755 | // Setting this to the saved value will BREAK script persistence! | 751 | // Setting this to the saved value will BREAK script persistence! |
756 | // item.OldItemID = ReadUUID(reader, "OldItemID"); | 752 | // item.OldItemID = Util.ReadUUID(reader, "OldItemID"); |
757 | } | 753 | } |
758 | 754 | ||
759 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) | 755 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) |
760 | { | 756 | { |
761 | item.LastOwnerID = ReadUUID(reader, "LastOwnerID"); | 757 | item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); |
762 | } | 758 | } |
763 | 759 | ||
764 | private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) | 760 | private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) |
@@ -773,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
773 | 769 | ||
774 | private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) | 770 | private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) |
775 | { | 771 | { |
776 | item.OwnerID = ReadUUID(reader, "OwnerID"); | 772 | item.OwnerID = Util.ReadUUID(reader, "OwnerID"); |
777 | } | 773 | } |
778 | 774 | ||
779 | private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) | 775 | private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) |
@@ -783,17 +779,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
783 | 779 | ||
784 | private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) | 780 | private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) |
785 | { | 781 | { |
786 | item.ParentID = ReadUUID(reader, "ParentID"); | 782 | item.ParentID = Util.ReadUUID(reader, "ParentID"); |
787 | } | 783 | } |
788 | 784 | ||
789 | private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) | 785 | private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) |
790 | { | 786 | { |
791 | item.ParentPartID = ReadUUID(reader, "ParentPartID"); | 787 | item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); |
792 | } | 788 | } |
793 | 789 | ||
794 | private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) | 790 | private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) |
795 | { | 791 | { |
796 | item.PermsGranter = ReadUUID(reader, "PermsGranter"); | 792 | item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); |
797 | } | 793 | } |
798 | 794 | ||
799 | private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) | 795 | private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) |
@@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
808 | 804 | ||
809 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) | 805 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) |
810 | { | 806 | { |
811 | item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); | 807 | item.OwnerChanged = Util.ReadBoolean(reader); |
812 | } | 808 | } |
813 | 809 | ||
814 | #endregion | 810 | #endregion |
@@ -922,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
922 | 918 | ||
923 | private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) | 919 | private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) |
924 | { | 920 | { |
925 | shp.Scale = ReadVector(reader, "Scale"); | 921 | shp.Scale = Util.ReadVector(reader, "Scale"); |
926 | } | 922 | } |
927 | 923 | ||
928 | private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) | 924 | private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) |
@@ -932,25 +928,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
932 | 928 | ||
933 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) | 929 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) |
934 | { | 930 | { |
935 | string value = reader.ReadElementContentAsString("ProfileShape", String.Empty); | 931 | shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); |
936 | // !!!!! to deal with flags without commas | ||
937 | if (value.Contains(" ") && !value.Contains(",")) | ||
938 | value = value.Replace(" ", ", "); | ||
939 | shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value); | ||
940 | } | 932 | } |
941 | 933 | ||
942 | private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) | 934 | private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) |
943 | { | 935 | { |
944 | string value = reader.ReadElementContentAsString("HollowShape", String.Empty); | 936 | shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); |
945 | // !!!!! to deal with flags without commas | ||
946 | if (value.Contains(" ") && !value.Contains(",")) | ||
947 | value = value.Replace(" ", ", "); | ||
948 | shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value); | ||
949 | } | 937 | } |
950 | 938 | ||
951 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) | 939 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) |
952 | { | 940 | { |
953 | shp.SculptTexture = ReadUUID(reader, "SculptTexture"); | 941 | shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); |
954 | } | 942 | } |
955 | 943 | ||
956 | private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) | 944 | private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) |
@@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1045 | 1033 | ||
1046 | private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1034 | private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) |
1047 | { | 1035 | { |
1048 | shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty); | 1036 | shp.FlexiEntry = Util.ReadBoolean(reader); |
1049 | } | 1037 | } |
1050 | 1038 | ||
1051 | private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1039 | private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) |
1052 | { | 1040 | { |
1053 | shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty); | 1041 | shp.LightEntry = Util.ReadBoolean(reader); |
1054 | } | 1042 | } |
1055 | 1043 | ||
1056 | private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) | 1044 | private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) |
1057 | { | 1045 | { |
1058 | shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); | 1046 | shp.SculptEntry = Util.ReadBoolean(reader); |
1059 | } | 1047 | } |
1060 | 1048 | ||
1061 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) | 1049 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) |
@@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1220 | 1208 | ||
1221 | static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options) | 1209 | static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options) |
1222 | { | 1210 | { |
1223 | // Older versions of serialization can't cope with commas | 1211 | // Older versions of serialization can't cope with commas, so we eliminate the commas |
1224 | if (options.ContainsKey("version")) | 1212 | writer.WriteElementString(name, flagsStr.Replace(",", "")); |
1225 | { | ||
1226 | float version = 0.5F; | ||
1227 | float.TryParse(options["version"].ToString(), out version); | ||
1228 | if (version < 0.5) | ||
1229 | flagsStr = flagsStr.Replace(",", ""); | ||
1230 | } | ||
1231 | |||
1232 | writer.WriteElementString(name, flagsStr); | ||
1233 | } | 1213 | } |
1234 | 1214 | ||
1235 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) | 1215 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) |
@@ -1459,66 +1439,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1459 | return obj; | 1439 | return obj; |
1460 | } | 1440 | } |
1461 | 1441 | ||
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) | 1442 | static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) |
1523 | { | 1443 | { |
1524 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1444 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |