aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index ffc8e4c..d16112d 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -32,9 +32,11 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
35using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenMetaverse;
38 40
39namespace OpenSim.Services.Connectors 41namespace OpenSim.Services.Connectors
40{ 42{
@@ -79,6 +81,10 @@ namespace OpenSim.Services.Connectors
79 throw new Exception("Asset connector init error"); 81 throw new Exception("Asset connector init error");
80 } 82 }
81 m_ServerURI = serviceURI; 83 m_ServerURI = serviceURI;
84
85 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
86 "dump asset <id> <file>",
87 "dump one cached asset", HandleDumpAsset);
82 } 88 }
83 89
84 protected void SetCache(IImprovedAssetCache cache) 90 protected void SetCache(IImprovedAssetCache cache)
@@ -264,5 +270,43 @@ namespace OpenSim.Services.Connectors
264 } 270 }
265 return false; 271 return false;
266 } 272 }
273
274 private void HandleDumpAsset(string module, string[] args)
275 {
276 if (args.Length != 4)
277 {
278 MainConsole.Instance.Output("Syntax: dump asset <id> <file>");
279 return;
280 }
281
282 UUID assetID;
283
284 if (!UUID.TryParse(args[2], out assetID))
285 {
286 MainConsole.Instance.Output("Invalid asset ID");
287 return;
288 }
289
290 if (m_Cache == null)
291 {
292 MainConsole.Instance.Output("Instance uses no cache");
293 return;
294 }
295
296 AssetBase asset = asset = m_Cache.Get(assetID.ToString());
297
298 if (asset == null)
299 {
300 MainConsole.Instance.Output("Asset not found in cache");
301 return;
302 }
303
304 string fileName = args[3];
305
306 FileStream fs = File.Create(fileName);
307 fs.Write(asset.Data, 0, asset.Data.Length);
308
309 fs.Close();
310 }
267 } 311 }
268} 312}