change --old-guids switch on the save oar command line to --version=<x>
if x is 0, then an old version 0.3 archive is saved. If it is anything else or missing, then a version 1.0 archive is saved version 1.0 archives cannot be loaded on OpenSim 0.7.0.2 and earlier also add various informational notices about what version we've saving/loadingviewer-2-initial-appearance
							parent
							
								
									3df8d8ff76
								
							
						
					
					
						commit
						e41b23a1a4
					
				| 
						 | 
				
			
			@ -264,11 +264,11 @@ namespace OpenSim
 | 
			
		|||
                                          LoadOar);
 | 
			
		||||
 | 
			
		||||
            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.",
 | 
			
		||||
                                          "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
 | 
			
		||||
                                          + "--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);
 | 
			
		||||
 | 
			
		||||
            m_console.Commands.AddCommand("region", false, "edit scale",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
        /// bumps here should be compatible.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public static int MAX_MAJOR_VERSION = 0;
 | 
			
		||||
        public static int MAX_MAJOR_VERSION = 1;
 | 
			
		||||
 | 
			
		||||
        protected Scene m_scene;
 | 
			
		||||
        protected Stream m_loadStream;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,12 +137,16 @@ 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, m_options);
 | 
			
		||||
                string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions);
 | 
			
		||||
                m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
 | 
			
		|||
            m_log.InfoFormat("[ARCHIVER]: Creating archive file.  This may take some time.");
 | 
			
		||||
 | 
			
		||||
            // 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.");
 | 
			
		||||
            
 | 
			
		||||
            new AssetsRequest(
 | 
			
		||||
| 
						 | 
				
			
			@ -184,15 +184,33 @@ namespace OpenSim.Region.CoreModules.World.Archiver
 | 
			
		|||
        /// Create the control file for the most up to date archive
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <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();
 | 
			
		||||
            XmlTextWriter xtw = new XmlTextWriter(sw);
 | 
			
		||||
            xtw.Formatting = Formatting.Indented;
 | 
			
		||||
            xtw.WriteStartDocument();
 | 
			
		||||
            xtw.WriteStartElement("archive");
 | 
			
		||||
            xtw.WriteAttributeString("major_version", "0");
 | 
			
		||||
            xtw.WriteAttributeString("minor_version", "3");
 | 
			
		||||
            xtw.WriteAttributeString("major_version", majorVersion.ToString());
 | 
			
		||||
            xtw.WriteAttributeString("minor_version", minorVersion.ToString());
 | 
			
		||||
 | 
			
		||||
            xtw.WriteStartElement("creation_info");
 | 
			
		||||
            DateTime now = DateTime.UtcNow;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
 | 
			
		|||
            Dictionary<string, object> options = new Dictionary<string, object>();
 | 
			
		||||
 | 
			
		||||
            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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
 | 
			
		|||
            // upset load
 | 
			
		||||
            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();
 | 
			
		||||
            SceneObjectGroup object1 = new SceneObjectGroup(part1);
 | 
			
		||||
| 
						 | 
				
			
			@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
 | 
			
		|||
            TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
 | 
			
		||||
            
 | 
			
		||||
            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();
 | 
			
		||||
            rs.AgentLimit = 17;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue