aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-11-02 12:05:24 -0700
committerDiva Canto2010-11-02 12:05:24 -0700
commit9f5ab3b965b1a3324918b7b2267c24709d42919b (patch)
tree48f1a86e597cf22289442c148946a07277e72ec9
parentThanks Snoopy for a patch that addresses Mantis #0005165: osSetDynamicTexture... (diff)
downloadopensim-SC_OLD-9f5ab3b965b1a3324918b7b2267c24709d42919b.zip
opensim-SC_OLD-9f5ab3b965b1a3324918b7b2267c24709d42919b.tar.gz
opensim-SC_OLD-9f5ab3b965b1a3324918b7b2267c24709d42919b.tar.bz2
opensim-SC_OLD-9f5ab3b965b1a3324918b7b2267c24709d42919b.tar.xz
Old deserialization can't deal with commas in flag fields. Making use of -version option on save oar command. Bumped archives version to 0.5; version < 0.5 generates flag fields without commas. Everything else is identical.
-rw-r--r--OpenSim/Region/Application/OpenSim.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs20
4 files changed, 30 insertions, 21 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 7a0142f..f80cb34 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -264,9 +264,10 @@ namespace OpenSim
264 LoadOar); 264 LoadOar);
265 265
266 m_console.Commands.AddCommand("region", false, "save oar", 266 m_console.Commands.AddCommand("region", false, "save oar",
267 "save oar [<OAR path>]", 267 "save oar [-v|version=N] [<OAR path>]",
268 "Save a region's data to an OAR archive.", 268 "Save a region's data to an OAR archive.",
269 "The OAR path must be a filesystem path." 269 "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
270 + "The OAR path must be a filesystem path."
270 + " If this is not given then the oar is saved to region.oar in the current directory.", 271 + " If this is not given then the oar is saved to region.oar in the current directory.",
271 SaveOar); 272 SaveOar);
272 273
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index c062833..f8a599a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 137
138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
139 139
140 Dictionary<string, object> serializationOptions = new Dictionary<string, object>(); 140
141// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0")
142// serializationOptions["old-guids"] = true;
143
144 // Write out scene object metadata 141 // Write out scene object metadata
145 foreach (SceneObjectGroup sceneObject in m_sceneObjects) 142 foreach (SceneObjectGroup sceneObject in m_sceneObjects)
146 { 143 {
147 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 144 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
148 145
149 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); 146 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
150 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); 147 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
151 } 148 }
152 149
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 3182079..0567a82 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
187 /// <returns></returns> 187 /// <returns></returns>
188 public static string Create0p2ControlFile(Dictionary<string, object> options) 188 public static string Create0p2ControlFile(Dictionary<string, object> options)
189 { 189 {
190 int majorVersion = 0, minorVersion = 4; 190 int majorVersion = 0, minorVersion = 5;
191 191
192 /* 192 if (options.ContainsKey("version"))
193 if (options.ContainsKey("version") && (string)options["version"] == "0")
194 {
195 majorVersion = 0;
196 minorVersion = 3;
197 }
198 else
199 { 193 {
200 majorVersion = 1;
201 minorVersion = 0; 194 minorVersion = 0;
195 string[] parts = options["version"].ToString().Split('.');
196 if (parts.Length >= 1)
197 majorVersion = Int32.Parse(parts[0]);
198 if (parts.Length >= 2)
199 minorVersion = Int32.Parse(parts[1]);
202 } 200 }
203 */
204 201
205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 202 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
206// if (majorVersion == 1) 203// if (majorVersion == 1)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e661ca9..7f37878 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); 1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); 1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
1138 writer.WriteElementString("Flags", sop.Flags.ToString()); 1138 WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); 1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1141 if (sop.MediaUrl != null) 1141 if (sop.MediaUrl != null)
@@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1188 1188
1189 } 1189 }
1190 1190
1191 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1192 {
1193 // Older versions of serialization can't cope with commas
1194 if (options.ContainsKey("version"))
1195 {
1196 float version = 0.5F;
1197 float.TryParse(options["version"].ToString(), out version);
1198 if (version < 0.5)
1199 flagsStr = flagsStr.Replace(",", "");
1200 }
1201
1202 writer.WriteElementString(name, flagsStr);
1203 }
1204
1191 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) 1205 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
1192 { 1206 {
1193 if (tinv.Count > 0) // otherwise skip this 1207 if (tinv.Count > 0) // otherwise skip this
@@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1275 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1289 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1276 writer.WriteElementString("State", shp.State.ToString()); 1290 writer.WriteElementString("State", shp.State.ToString());
1277 1291
1278 writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); 1292 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1279 writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); 1293 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
1280 1294
1281 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1295 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1282 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1296 writer.WriteElementString("SculptType", shp.SculptType.ToString());