From f86c438653fc3c8356a8f0c43a055b1928183f02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 29 Nov 2010 08:43:33 -0800 Subject: Preservation of creator information now also working in IARs. Cleaned up usage help. Moved Osp around, deleted unnecessary OspInventoryWrapperPlugin, added manipulation of SOP's xml representation in a generic ExternalRepresentationUtils function. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index da25e80..6c9826f 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization #region SOPXmlProcessors private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) { - obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty); + obj.AllowedDrop = Util.ReadBoolean(reader); } private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) @@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) { - obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty); + obj.PassTouches = Util.ReadBoolean(reader); } private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) @@ -654,11 +654,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) { - string value = reader.ReadElementContentAsString("Flags", String.Empty); - // !!!!! to deal with flags without commas - if (value.Contains(" ") && !value.Contains(",")) - value = value.Replace(" ", ", "); - obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value); + obj.Flags = Util.ReadEnum(reader, "Flags"); } private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) @@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) { - item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); + item.OwnerChanged = Util.ReadBoolean(reader); } #endregion @@ -932,20 +928,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) { - string value = reader.ReadElementContentAsString("ProfileShape", String.Empty); - // !!!!! to deal with flags without commas - if (value.Contains(" ") && !value.Contains(",")) - value = value.Replace(" ", ", "); - shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value); + shp.ProfileShape = Util.ReadEnum(reader, "ProfileShape"); } private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) { - string value = reader.ReadElementContentAsString("HollowShape", String.Empty); - // !!!!! to deal with flags without commas - if (value.Contains(" ") && !value.Contains(",")) - value = value.Replace(" ", ", "); - shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value); + shp.HollowShape = Util.ReadEnum(reader, "HollowShape"); } private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) @@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) { - shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty); + shp.FlexiEntry = Util.ReadBoolean(reader); } private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) { - shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty); + shp.LightEntry = Util.ReadBoolean(reader); } private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) { - shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); + shp.SculptEntry = Util.ReadBoolean(reader); } private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) @@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary options) { - // Older versions of serialization can't cope with commas - if (options.ContainsKey("version")) - { - float version = 0.5F; - float.TryParse(options["version"].ToString(), out version); - if (version < 0.5) - flagsStr = flagsStr.Replace(",", ""); - } - - writer.WriteElementString(name, flagsStr); + // Older versions of serialization can't cope with commas, so we eliminate the commas + writer.WriteElementString(name, flagsStr.Replace(",", "")); } static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) -- cgit v1.1