From 3183a20632c2c3b7ed9d18398a06585bb5f96012 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 2 Jul 2008 22:53:36 +0000
Subject: * Start writing out control file in archive. Only contains version
information right now.
---
.../Modules/World/Archiver/ArchiveConstants.cs | 5 ++++
.../World/Archiver/ArchiveWriteRequestExecution.cs | 32 +++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Environment/Modules/World/Archiver')
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
index 22d1ed7d..a5688ef 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
@@ -36,6 +36,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
public class ArchiveConstants
{
///
+ /// The location of the archive control file
+ ///
+ public static readonly string CONTROL_FILE_PATH = "archive.xml";
+
+ ///
/// Path for the assets held in an archive
///
public static readonly string ASSETS_PATH = "assets/";
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index 2c43ffd..91de3c6 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
+using System.Xml;
using libsecondlife;
using log4net;
using OpenSim.Framework;
@@ -77,6 +78,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
TarArchiveWriter archive = new TarArchiveWriter();
+ // Write out control file
+ archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile());
+
// Write out terrain
string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName);
MemoryStream ms = new MemoryStream();
@@ -109,6 +113,32 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
archive.WriteTar(m_savePath);
m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath);
- }
+ }
+
+ ///
+ /// Create the control file for this archive
+ ///
+ ///
+ /// A
+ ///
+ protected string CreateControlFile()
+ {
+ 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", "1");
+ xtw.WriteEndElement();
+
+ xtw.Flush();
+ xtw.Close();
+
+ String s = sw.ToString();
+ sw.Close();
+
+ return s;
+ }
}
}
--
cgit v1.1