Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-10-15 21:40:03 -07:00
commit 907c576c00
6 changed files with 33 additions and 11 deletions

View File

@ -264,11 +264,11 @@ namespace OpenSim
LoadOar); LoadOar);
m_console.Commands.AddCommand("region", false, "save oar", m_console.Commands.AddCommand("region", false, "save oar",
"save oar [--old-guids] [<OAR path>]", "save oar [--version=<version>] [<OAR path>]",
"Save a region's data to an OAR archive.", "Save a region's data to an OAR archive.",
"The OAR path must be a filesystem path." "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." + Environment.NewLine + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine
+ "--old-guids produces OARs compatible with older (pre 0.7.1) OpenSim versions.", + "--version=0 produces old version 0.3 OARs that are compatible with OpenSim 0.7.0.2 and earlier. Current OAR version is 1.0. This version of OpenSim can load any OAR later than version 0.3",
SaveOar); SaveOar);
m_console.Commands.AddCommand("region", false, "edit scale", m_console.Commands.AddCommand("region", false, "edit scale",

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version
/// bumps here should be compatible. /// bumps here should be compatible.
/// </summary> /// </summary>
public static int MAX_MAJOR_VERSION = 0; public static int MAX_MAJOR_VERSION = 1;
protected Scene m_scene; protected Scene m_scene;
protected Stream m_loadStream; protected Stream m_loadStream;

View File

@ -137,12 +137,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 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 // Write out scene object metadata
foreach (SceneObjectGroup sceneObject in m_sceneObjects) foreach (SceneObjectGroup sceneObject in m_sceneObjects)
{ {
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions);
m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
} }

View File

@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
// Write out control file // Write out control file
archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options));
m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
new AssetsRequest( new AssetsRequest(
@ -184,15 +184,33 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// Create the control file for the most up to date archive /// Create the control file for the most up to date archive
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static string Create0p2ControlFile() public static string Create0p2ControlFile(Dictionary<string, object> options)
{ {
int majorVersion, minorVersion;
if (options.ContainsKey("version") && (string)options["version"] == "0")
{
majorVersion = 0;
minorVersion = 3;
}
else
{
majorVersion = 1;
minorVersion = 0;
}
m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
if (majorVersion == 1)
{
m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
}
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw); XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented; xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument(); xtw.WriteStartDocument();
xtw.WriteStartElement("archive"); xtw.WriteStartElement("archive");
xtw.WriteAttributeString("major_version", "0"); xtw.WriteAttributeString("major_version", majorVersion.ToString());
xtw.WriteAttributeString("minor_version", "3"); xtw.WriteAttributeString("minor_version", minorVersion.ToString());
xtw.WriteStartElement("creation_info"); xtw.WriteStartElement("creation_info");
DateTime now = DateTime.UtcNow; DateTime now = DateTime.UtcNow;

View File

@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Dictionary<string, object> options = new Dictionary<string, object>(); Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet ops = new OptionSet(); OptionSet ops = new OptionSet();
ops.Add("old|old-guids", delegate(string v) { options["old-guids"] = (v != null); }); ops.Add("v|version=", delegate(string v) { options["version"] = v; });
List<string> mainParams = ops.Parse(cmdparams); List<string> mainParams = ops.Parse(cmdparams);

View File

@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
// upset load // upset load
tar.WriteDir(ArchiveConstants.TERRAINS_PATH); tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary<string, Object>()));
SceneObjectPart part1 = CreateSceneObjectPart1(); SceneObjectPart part1 = CreateSceneObjectPart1();
SceneObjectGroup object1 = new SceneObjectGroup(part1); SceneObjectGroup object1 = new SceneObjectGroup(part1);
@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
tar.WriteDir(ArchiveConstants.TERRAINS_PATH); tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary<string, Object>()));
RegionSettings rs = new RegionSettings(); RegionSettings rs = new RegionSettings();
rs.AgentLimit = 17; rs.AgentLimit = 17;