aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-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);