From 721c1085da22229f4d40529dd2738a2cf62a91b7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 21 May 2010 20:43:11 +0100
Subject: make oar object filename/pathname creation a helper method reused in
both tests and oar code reduction in checking is outweighed by greater test
clarity
---
.../Framework/Serialization/ArchiveConstants.cs | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
(limited to 'OpenSim/Framework')
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 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
using System.Collections.Generic;
using OpenMetaverse;
@@ -85,6 +86,11 @@ namespace OpenSim.Framework.Serialization
///
public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
+ ///
+ /// Template used for creating filenames in OpenSim Archives.
+ ///
+ public const string OAR_OBJECT_FILENAME_TEMPLATE = "{0}_{1:000}-{2:000}-{3:000}__{4}.xml";
+
///
/// Extensions used for asset types in the archive
///
@@ -139,5 +145,32 @@ namespace OpenSim.Framework.Serialization
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder;
}
+
+ ///
+ /// Create the filename used to store an object in an OpenSim Archive.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
+ {
+ return string.Format(
+ OAR_OBJECT_FILENAME_TEMPLATE, objectName,
+ Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
+ uuid);
+ }
+
+ ///
+ /// Create the path used to store an object in an OpenSim Archives.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
+ {
+ return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
+ }
}
}
--
cgit v1.1