diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | 32 |
2 files changed, 36 insertions, 1 deletions
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 | |||
36 | public class ArchiveConstants | 36 | public class ArchiveConstants |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// The location of the archive control file | ||
40 | /// </summary> | ||
41 | public static readonly string CONTROL_FILE_PATH = "archive.xml"; | ||
42 | |||
43 | /// <summary> | ||
39 | /// Path for the assets held in an archive | 44 | /// Path for the assets held in an archive |
40 | /// </summary> | 45 | /// </summary> |
41 | public static readonly string ASSETS_PATH = "assets/"; | 46 | 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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | ||
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using log4net; | 34 | using log4net; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -77,6 +78,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
77 | 78 | ||
78 | TarArchiveWriter archive = new TarArchiveWriter(); | 79 | TarArchiveWriter archive = new TarArchiveWriter(); |
79 | 80 | ||
81 | // Write out control file | ||
82 | archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile()); | ||
83 | |||
80 | // Write out terrain | 84 | // Write out terrain |
81 | string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName); | 85 | string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName); |
82 | MemoryStream ms = new MemoryStream(); | 86 | MemoryStream ms = new MemoryStream(); |
@@ -109,6 +113,32 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
109 | archive.WriteTar(m_savePath); | 113 | archive.WriteTar(m_savePath); |
110 | 114 | ||
111 | m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); | 115 | m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); |
112 | } | 116 | } |
117 | |||
118 | /// <summary> | ||
119 | /// Create the control file for this archive | ||
120 | /// </summary> | ||
121 | /// <returns> | ||
122 | /// A <see cref="System.String"/> | ||
123 | /// </returns> | ||
124 | protected string CreateControlFile() | ||
125 | { | ||
126 | StringWriter sw = new StringWriter(); | ||
127 | XmlTextWriter xtw = new XmlTextWriter(sw); | ||
128 | xtw.Formatting = Formatting.Indented; | ||
129 | xtw.WriteStartDocument(); | ||
130 | xtw.WriteStartElement("archive"); | ||
131 | xtw.WriteAttributeString("major_version", "0"); | ||
132 | xtw.WriteAttributeString("minor_version", "1"); | ||
133 | xtw.WriteEndElement(); | ||
134 | |||
135 | xtw.Flush(); | ||
136 | xtw.Close(); | ||
137 | |||
138 | String s = sw.ToString(); | ||
139 | sw.Close(); | ||
140 | |||
141 | return s; | ||
142 | } | ||
113 | } | 143 | } |
114 | } | 144 | } |