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/Region/CoreModules/World/Archiver/ArchiveHelpers.cs | |
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/Region/CoreModules/World/Archiver/ArchiveHelpers.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs new file mode 100644 index 0000000..880bd7c --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework.Serialization; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.CoreModules.World.Archiver | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Helper methods for archive manipulation | ||
36 | /// </summary> | ||
37 | /// This is a separate class from ArchiveConstants because we need to bring in very OpenSim specific classes. | ||
38 | public static class ArchiveHelpers | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Create the filename used for objects in OpenSim Archives. | ||
42 | /// </summary> | ||
43 | /// <param name="objectName"></param> | ||
44 | /// <param name="uuid"></param> | ||
45 | /// <param name="pos"></param> | ||
46 | /// <returns></returns> | ||
47 | public static string CreateObjectFilename(SceneObjectGroup sog) | ||
48 | { | ||
49 | return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Create the path used to store an object in an OpenSim Archive. | ||
54 | /// </summary> | ||
55 | /// <param name="objectName"></param> | ||
56 | /// <param name="uuid"></param> | ||
57 | /// <param name="pos"></param> | ||
58 | /// <returns></returns> | ||
59 | public static string CreateObjectPath(SceneObjectGroup sog) | ||
60 | { | ||
61 | return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); | ||
62 | } | ||
63 | } | ||
64 | } \ No newline at end of file | ||