aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-26 17:36:54 +0000
committerJustin Clarke Casey2008-06-26 17:36:54 +0000
commitfa5f27acfa753d5f9e15b222bb826ea4a5f313b6 (patch)
treee7ef51dfd1d1c9d7608215ef8ba5fe85620e65b2 /OpenSim/Region/Environment
parentsmall change to last commit (diff)
downloadopensim-SC-fa5f27acfa753d5f9e15b222bb826ea4a5f313b6.zip
opensim-SC-fa5f27acfa753d5f9e15b222bb826ea4a5f313b6.tar.gz
opensim-SC-fa5f27acfa753d5f9e15b222bb826ea4a5f313b6.tar.bz2
opensim-SC-fa5f27acfa753d5f9e15b222bb826ea4a5f313b6.tar.xz
* Put extensions on all assets in an archive
* Choice of extensions is a scratch set, may not yet be correct * This facility is not useable yet - not least because I've just come across a significant save bug I need to investigate
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs63
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs7
3 files changed, 66 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
index 388c541..843dd0c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
@@ -25,6 +25,9 @@
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
28using System.Collections.Generic;
29using libsecondlife;
30
28namespace OpenSim.Region.Environment.Modules.World.Archiver 31namespace OpenSim.Region.Environment.Modules.World.Archiver
29{ 32{
30 /// <summary> 33 /// <summary>
@@ -38,11 +41,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
38 public static readonly string ASSETS_PATH = "assets/"; 41 public static readonly string ASSETS_PATH = "assets/";
39 42
40 /// <summary> 43 /// <summary>
41 /// Extension used for texture assets in archive
42 /// </summary>
43 public static readonly string TEXTURE_EXTENSION = ".jp2";
44
45 /// <summary>
46 /// Path for the assets metadata file 44 /// Path for the assets metadata file
47 /// </summary> 45 /// </summary>
48 public static readonly string ASSETS_METADATA_PATH = "assets.xml"; 46 public static readonly string ASSETS_METADATA_PATH = "assets.xml";
@@ -51,5 +49,60 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
51 /// Path for the prims file 49 /// Path for the prims file
52 /// </summary> 50 /// </summary>
53 public static readonly string OBJECTS_PATH = "objects/"; 51 public static readonly string OBJECTS_PATH = "objects/";
52
53 /// <summary>
54 /// Extensions used for asset types in the archive
55 /// </summary>
56 public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
57 public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
58
59 static ArchiveConstants()
60 {
61 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ".bvh";
62 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ".bpt.txt";
63 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ".ccd.txt";
64 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ".clo.txt";
65 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ".fld.txt"; // Not sure if we'll ever see this
66 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ".gst.txt";
67 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ".jpg";
68 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ".img.tga";
69 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ".lff.txt"; // Not sure if we'll ever see this
70 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ".lso";
71 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ".lsl";
72 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd.txt";
73 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".obj.xml";
74 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rof.txt"; // Not sure if we'll ever see this
75 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this
76 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this
77 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".ssf.txt"; // Not sure if we'll ever see this
78 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg";
79 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ".wav";
80 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ".jp2";
81 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ".tga";
82 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ".trf.txt"; // Not sure if we'll ever see this
83
84 EXTENSION_TO_ASSET_TYPE[".bvh"] = (sbyte)AssetType.Animation;
85 EXTENSION_TO_ASSET_TYPE[".bpt.txt"] = (sbyte)AssetType.Bodypart;
86 EXTENSION_TO_ASSET_TYPE[".ccd.txt"] = (sbyte)AssetType.CallingCard;
87 EXTENSION_TO_ASSET_TYPE[".clo.txt"] = (sbyte)AssetType.Clothing;
88 EXTENSION_TO_ASSET_TYPE[".fld.txt"] = (sbyte)AssetType.Folder;
89 EXTENSION_TO_ASSET_TYPE[".gst.txt"] = (sbyte)AssetType.Gesture;
90 EXTENSION_TO_ASSET_TYPE[".jpg"] = (sbyte)AssetType.ImageJPEG;
91 EXTENSION_TO_ASSET_TYPE[".img.tga"] = (sbyte)AssetType.ImageTGA;
92 EXTENSION_TO_ASSET_TYPE[".lff.txt"] = (sbyte)AssetType.LostAndFoundFolder;
93 EXTENSION_TO_ASSET_TYPE[".lso"] = (sbyte)AssetType.LSLBytecode;
94 EXTENSION_TO_ASSET_TYPE[".lsl"] = (sbyte)AssetType.LSLText;
95 EXTENSION_TO_ASSET_TYPE[".ncd.txt"] = (sbyte)AssetType.Notecard;
96 EXTENSION_TO_ASSET_TYPE[".obj.xml"] = (sbyte)AssetType.Object;
97 EXTENSION_TO_ASSET_TYPE[".rof.txt"] = (sbyte)AssetType.RootFolder;
98 EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script;
99 EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate;
100 EXTENSION_TO_ASSET_TYPE[".ssf.txt"] = (sbyte)AssetType.SnapshotFolder;
101 EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound;
102 EXTENSION_TO_ASSET_TYPE[".wav"] = (sbyte)AssetType.SoundWAV;
103 EXTENSION_TO_ASSET_TYPE[".jp2"] = (sbyte)AssetType.Texture;
104 EXTENSION_TO_ASSET_TYPE[".tga"] = (sbyte)AssetType.TextureTGA;
105 EXTENSION_TO_ASSET_TYPE[".trf.txt"] = (sbyte)AssetType.TrashFolder;
106 }
54 } 107 }
55} 108}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
index 8b4708c..4922362 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
@@ -86,10 +86,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
86 86
87 string extension = string.Empty; 87 string extension = string.Empty;
88 88
89 if ((sbyte)AssetType.Texture == asset.Type) 89 if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
90 { 90 {
91 extension = ArchiveConstants.TEXTURE_EXTENSION; 91 extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
92 } 92 }
93 93
94 xtw.WriteElementString("filename", uuid.ToString() + extension); 94 xtw.WriteElementString("filename", uuid.ToString() + extension);
95 95
@@ -125,9 +125,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
125 { 125 {
126 string extension = string.Empty; 126 string extension = string.Empty;
127 127
128 if ((sbyte)AssetType.Texture == asset.Type) 128 if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
129 { 129 {
130 extension = ArchiveConstants.TEXTURE_EXTENSION; 130 extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
131 } 131 }
132 132
133 archive.AddFile( 133 archive.AddFile(
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs
index 527d544..284a39e 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs
@@ -148,11 +148,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
148 { 148 {
149 AssetMetadata metadata = m_metadata[filename]; 149 AssetMetadata metadata = m_metadata[filename];
150 150
151 string extension = String.Empty; 151 if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType))
152
153 if ((sbyte)AssetType.Texture == metadata.AssetType)
154 { 152 {
155 filename = filename.Remove(filename.Length - ArchiveConstants.TEXTURE_EXTENSION.Length); 153 string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType];
154 filename = filename.Remove(filename.Length - extension.Length);
156 } 155 }
157 156
158 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); 157 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);