aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-02 22:53:36 +0000
committerJustin Clarke Casey2008-07-02 22:53:36 +0000
commit3183a20632c2c3b7ed9d18398a06585bb5f96012 (patch)
treedef4d2cd71b1b46e28b20584d61e0f3be1e55b2c
parentproperty encapsulation for SOP (diff)
downloadopensim-SC_OLD-3183a20632c2c3b7ed9d18398a06585bb5f96012.zip
opensim-SC_OLD-3183a20632c2c3b7ed9d18398a06585bb5f96012.tar.gz
opensim-SC_OLD-3183a20632c2c3b7ed9d18398a06585bb5f96012.tar.bz2
opensim-SC_OLD-3183a20632c2c3b7ed9d18398a06585bb5f96012.tar.xz
* Start writing out control file in archive. Only contains version information right now.
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs32
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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Xml;
32using libsecondlife; 33using libsecondlife;
33using log4net; 34using log4net;
34using OpenSim.Framework; 35using 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}