diff options
author | Justin Clarke Casey | 2008-06-27 20:08:29 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-06-27 20:08:29 +0000 |
commit | 810d3da2b9e90ca52bfaf9b03233fcda6181ec8e (patch) | |
tree | 9adfbafbc9c3396f1b6dfd532761ef8c6be9c0d7 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |
parent | move along, nothing to see here. just a couple of lazy variables. (diff) | |
download | opensim-SC_OLD-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.zip opensim-SC_OLD-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.gz opensim-SC_OLD-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.bz2 opensim-SC_OLD-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.xz |
* Experiment with not bothering with a seperate assets metadata file - extract necessary minimum metadata from asset filenames
* Make all file extensions single - double extensions look ugly and probably aren't good for Windows
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 8d882ea..8f73c2c 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
61 | protected void DearchiveRegion() | 61 | protected void DearchiveRegion() |
62 | { | 62 | { |
63 | TarArchiveReader archive = new TarArchiveReader(m_loadPath); | 63 | TarArchiveReader archive = new TarArchiveReader(m_loadPath); |
64 | AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); | 64 | //AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); |
65 | 65 | ||
66 | List<string> serialisedSceneObjects = new List<string>(); | 66 | List<string> serialisedSceneObjects = new List<string>(); |
67 | string filePath = "ERROR"; | 67 | string filePath = "ERROR"; |
@@ -76,14 +76,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
76 | { | 76 | { |
77 | serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); | 77 | serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); |
78 | } | 78 | } |
79 | else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH)) | 79 | // else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH)) |
80 | { | 80 | // { |
81 | string xml = m_asciiEncoding.GetString(data); | 81 | // string xml = m_asciiEncoding.GetString(data); |
82 | dearchiver.AddAssetMetadata(xml); | 82 | // dearchiver.AddAssetMetadata(xml); |
83 | } | 83 | // } |
84 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 84 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
85 | { | 85 | { |
86 | dearchiver.AddAssetData(filePath, data); | 86 | ResolveAssetData(filePath, data); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
@@ -103,5 +103,42 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
103 | 103 | ||
104 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); | 104 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); |
105 | } | 105 | } |
106 | |||
107 | /// <summary> | ||
108 | /// Resolve a new piece of asset data against stored metadata | ||
109 | /// </summary> | ||
110 | /// <param name="assetFilename"></param> | ||
111 | /// <param name="data"></param> | ||
112 | /// <returns>true if asset was successfully loaded, false otherwise</returns> | ||
113 | protected bool ResolveAssetData(string assetPath, byte[] data) | ||
114 | { | ||
115 | // Right now we're nastily obtaining the lluuid from the filename | ||
116 | string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); | ||
117 | string extension = filename.Substring(filename.LastIndexOf(".")); | ||
118 | string uuid = filename.Remove(filename.Length - extension.Length); | ||
119 | |||
120 | if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) | ||
121 | { | ||
122 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; | ||
123 | |||
124 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); | ||
125 | |||
126 | AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty); | ||
127 | asset.Type = assetType; | ||
128 | asset.Data = data; | ||
129 | |||
130 | m_scene.AssetCache.AddAsset(asset); | ||
131 | |||
132 | return true; | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | m_log.ErrorFormat( | ||
137 | "[DEARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}", | ||
138 | assetPath, extension); | ||
139 | |||
140 | return false; | ||
141 | } | ||
142 | } | ||
106 | } | 143 | } |
107 | } | 144 | } |