diff options
author | Melanie | 2010-05-21 21:16:04 +0100 |
---|---|---|
committer | Melanie | 2010-05-21 21:16:04 +0100 |
commit | 297bcb5c3d462128c5c81f35aa7a574e567583d5 (patch) | |
tree | be7744848c474a8241f1d1c0e1f0114cfb824e16 /OpenSim/Framework/Serialization | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.zip opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.gz opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.bz2 opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r-- | OpenSim/Framework/Serialization/ArchiveConstants.cs | 33 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/TarArchiveWriter.cs | 7 |
2 files changed, 39 insertions, 1 deletions
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 1cd80db..475a9de 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | 31 | ||
@@ -85,6 +86,11 @@ namespace OpenSim.Framework.Serialization | |||
85 | /// </value> | 86 | /// </value> |
86 | public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__"; | 87 | public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__"; |
87 | 88 | ||
89 | /// <summary> | ||
90 | /// Template used for creating filenames in OpenSim Archives. | ||
91 | /// </summary> | ||
92 | public const string OAR_OBJECT_FILENAME_TEMPLATE = "{0}_{1:000}-{2:000}-{3:000}__{4}.xml"; | ||
93 | |||
88 | /// <value> | 94 | /// <value> |
89 | /// Extensions used for asset types in the archive | 95 | /// Extensions used for asset types in the archive |
90 | /// </value> | 96 | /// </value> |
@@ -139,5 +145,32 @@ namespace OpenSim.Framework.Serialization | |||
139 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA; | 145 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA; |
140 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder; | 146 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder; |
141 | } | 147 | } |
148 | |||
149 | /// <summary> | ||
150 | /// Create the filename used to store an object in an OpenSim Archive. | ||
151 | /// </summary> | ||
152 | /// <param name="objectName"></param> | ||
153 | /// <param name="uuid"></param> | ||
154 | /// <param name="pos"></param> | ||
155 | /// <returns></returns> | ||
156 | public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos) | ||
157 | { | ||
158 | return string.Format( | ||
159 | OAR_OBJECT_FILENAME_TEMPLATE, objectName, | ||
160 | Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z), | ||
161 | uuid); | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// Create the path used to store an object in an OpenSim Archives. | ||
166 | /// </summary> | ||
167 | /// <param name="objectName"></param> | ||
168 | /// <param name="uuid"></param> | ||
169 | /// <param name="pos"></param> | ||
170 | /// <returns></returns> | ||
171 | public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) | ||
172 | { | ||
173 | return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); | ||
174 | } | ||
142 | } | 175 | } |
143 | } | 176 | } |
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs index 0bd639f..fca909f 100644 --- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs +++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs | |||
@@ -28,7 +28,9 @@ | |||
28 | using System; | 28 | 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.Text; | 32 | using System.Text; |
33 | using log4net; | ||
32 | 34 | ||
33 | namespace OpenSim.Framework.Serialization | 35 | namespace OpenSim.Framework.Serialization |
34 | { | 36 | { |
@@ -37,7 +39,7 @@ namespace OpenSim.Framework.Serialization | |||
37 | /// </summary> | 39 | /// </summary> |
38 | public class TarArchiveWriter | 40 | public class TarArchiveWriter |
39 | { | 41 | { |
40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 43 | ||
42 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | 44 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); |
43 | protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); | 45 | protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); |
@@ -148,6 +150,9 @@ namespace OpenSim.Framework.Serialization | |||
148 | /// <param name="fileType"></param> | 150 | /// <param name="fileType"></param> |
149 | protected void WriteEntry(string filePath, byte[] data, char fileType) | 151 | protected void WriteEntry(string filePath, byte[] data, char fileType) |
150 | { | 152 | { |
153 | // m_log.DebugFormat( | ||
154 | // "[TAR ARCHIVE WRITER]: Data for {0} is {1} bytes", filePath, (null == data ? "null" : data.Length.ToString())); | ||
155 | |||
151 | byte[] header = new byte[512]; | 156 | byte[] header = new byte[512]; |
152 | 157 | ||
153 | // file path field (100) | 158 | // file path field (100) |