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.
parent
ed7959ddfb
commit
9f5ab3b965
|
@ -264,9 +264,10 @@ namespace OpenSim
|
|||
LoadOar);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save oar",
|
||||
"save oar [<OAR path>]",
|
||||
"save oar [-v|version=N] [<OAR path>]",
|
||||
"Save a region's data to an OAR archive.",
|
||||
"The OAR path must be a filesystem path."
|
||||
"-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||
+ "The OAR path must be a filesystem path."
|
||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||
SaveOar);
|
||||
|
||||
|
|
|
@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
|
||||
m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
|
||||
|
||||
Dictionary<string, object> serializationOptions = new Dictionary<string, object>();
|
||||
// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0")
|
||||
// serializationOptions["old-guids"] = true;
|
||||
|
||||
|
||||
// Write out scene object metadata
|
||||
foreach (SceneObjectGroup sceneObject in m_sceneObjects)
|
||||
{
|
||||
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
|
||||
|
||||
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions);
|
||||
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
|
||||
m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
|
||||
}
|
||||
|
||||
|
|
|
@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
/// <returns></returns>
|
||||
public static string Create0p2ControlFile(Dictionary<string, object> options)
|
||||
{
|
||||
int majorVersion = 0, minorVersion = 4;
|
||||
|
||||
/*
|
||||
if (options.ContainsKey("version") && (string)options["version"] == "0")
|
||||
int majorVersion = 0, minorVersion = 5;
|
||||
|
||||
if (options.ContainsKey("version"))
|
||||
{
|
||||
majorVersion = 0;
|
||||
minorVersion = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
majorVersion = 1;
|
||||
minorVersion = 0;
|
||||
string[] parts = options["version"].ToString().Split('.');
|
||||
if (parts.Length >= 1)
|
||||
majorVersion = Int32.Parse(parts[0]);
|
||||
if (parts.Length >= 2)
|
||||
minorVersion = Int32.Parse(parts[1]);
|
||||
}
|
||||
*/
|
||||
|
||||
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
|
||||
// if (majorVersion == 1)
|
||||
|
|
|
@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
|
||||
writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
|
||||
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
|
||||
writer.WriteElementString("Flags", sop.Flags.ToString());
|
||||
WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
|
||||
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
|
||||
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
|
||||
if (sop.MediaUrl != null)
|
||||
|
@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
}
|
||||
|
||||
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> 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);
|
||||
}
|
||||
|
||||
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
|
||||
{
|
||||
if (tinv.Count > 0) // otherwise skip this
|
||||
|
@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
|
||||
writer.WriteElementString("State", shp.State.ToString());
|
||||
|
||||
writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString());
|
||||
writer.WriteElementString("HollowShape", shp.HollowShape.ToString());
|
||||
WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
|
||||
WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
|
||||
|
||||
WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
|
||||
writer.WriteElementString("SculptType", shp.SculptType.ToString());
|
||||
|
|
Loading…
Reference in New Issue