diff options
author | Justin Clark-Casey (justincc) | 2010-05-21 20:43:11 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-05-21 20:43:11 +0100 |
commit | 721c1085da22229f4d40529dd2738a2cf62a91b7 (patch) | |
tree | cae1c731191972cd0bf672bb2e42e312d4239a83 /OpenSim/Framework/Serialization | |
parent | minor: refactor CreateAsset to eliminate dupe code (diff) | |
download | opensim-SC_OLD-721c1085da22229f4d40529dd2738a2cf62a91b7.zip opensim-SC_OLD-721c1085da22229f4d40529dd2738a2cf62a91b7.tar.gz opensim-SC_OLD-721c1085da22229f4d40529dd2738a2cf62a91b7.tar.bz2 opensim-SC_OLD-721c1085da22229f4d40529dd2738a2cf62a91b7.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r-- | OpenSim/Framework/Serialization/ArchiveConstants.cs | 33 |
1 files changed, 33 insertions, 0 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 | } |