diff options
author | Diva Canto | 2009-10-01 16:40:04 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-01 16:40:04 -0700 |
commit | ac0927c9221cda055942e045d379364cba47022d (patch) | |
tree | 0715a907d4bce9462c254e7e19371d0d4b0a27b4 /OpenSim | |
parent | Switched log level of an annoying message in SQLite to Debug, and commented i... (diff) | |
parent | Add "dump asset" command to remote asset connector (the only one that uses a (diff) | |
download | opensim-SC-ac0927c9221cda055942e045d379364cba47022d.zip opensim-SC-ac0927c9221cda055942e045d379364cba47022d.tar.gz opensim-SC-ac0927c9221cda055942e045d379364cba47022d.tar.bz2 opensim-SC-ac0927c9221cda055942e045d379364cba47022d.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | 44 |
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; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | ||
38 | 40 | ||
39 | namespace OpenSim.Services.Connectors | 41 | namespace 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 | } |