aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-05 21:11:32 +0000
committerJustin Clark-Casey (justincc)2012-01-05 21:11:32 +0000
commitda0fc3c8f572adba69e52e1d7f528946ab1f6f23 (patch)
tree019ce96ad350912b15421cf66f38e2dab9da2d67
parentAdd size and temporary information to "show asset" command (diff)
downloadopensim-SC-da0fc3c8f572adba69e52e1d7f528946ab1f6f23.zip
opensim-SC-da0fc3c8f572adba69e52e1d7f528946ab1f6f23.tar.gz
opensim-SC-da0fc3c8f572adba69e52e1d7f528946ab1f6f23.tar.bz2
opensim-SC-da0fc3c8f572adba69e52e1d7f528946ab1f6f23.tar.xz
Make "show asset" command available simulator side. Actually make the service command be "show asset" instead of "show digest" this time.
Last time I accidnetally just changed the usage message.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs51
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs10
2 files changed, 56 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
index 9ea6343..a5207eb 100644
--- a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
@@ -88,6 +88,14 @@ namespace OpenSim.Region.OptionalModules.Asset
88 m_scene = scene; 88 m_scene = scene;
89 89
90 MainConsole.Instance.Commands.AddCommand( 90 MainConsole.Instance.Commands.AddCommand(
91 "asset",
92 false,
93 "show asset",
94 "show asset <ID>",
95 "Show asset information",
96 HandleShowAsset);
97
98 MainConsole.Instance.Commands.AddCommand(
91 "asset", false, "dump asset", 99 "asset", false, "dump asset",
92 "dump asset <id>", 100 "dump asset <id>",
93 "Dump an asset", 101 "Dump an asset",
@@ -130,5 +138,48 @@ namespace OpenSim.Region.OptionalModules.Asset
130 138
131 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); 139 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
132 } 140 }
141
142 void HandleShowAsset(string module, string[] args)
143 {
144 if (args.Length < 3)
145 {
146 MainConsole.Instance.Output("Syntax: show asset <ID>");
147 return;
148 }
149
150 AssetBase asset = m_scene.AssetService.Get(args[2]);
151
152 if (asset == null || asset.Data.Length == 0)
153 {
154 MainConsole.Instance.Output("Asset not found");
155 return;
156 }
157
158 int i;
159
160 MainConsole.Instance.OutputFormat("Name: {0}", asset.Name);
161 MainConsole.Instance.OutputFormat("Description: {0}", asset.Description);
162 MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type);
163 MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType);
164 MainConsole.Instance.OutputFormat("Size: {0} bytes", asset.Data.Length);
165 MainConsole.Instance.OutputFormat("Temporary: {0}", asset.Temporary ? "yes" : "no");
166 MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags);
167
168 for (i = 0 ; i < 5 ; i++)
169 {
170 int off = i * 16;
171 if (asset.Data.Length <= off)
172 break;
173 int len = 16;
174 if (asset.Data.Length < off + len)
175 len = asset.Data.Length - off;
176
177 byte[] line = new byte[len];
178 Array.Copy(asset.Data, off, line, 0, len);
179
180 string text = BitConverter.ToString(line);
181 MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
182 }
183 }
133 } 184 }
134} \ No newline at end of file 185} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index 5dcb33b..9b80245 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -73,10 +73,10 @@ namespace OpenSim.Server.Handlers.Asset
73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); 73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
74 74
75 MainConsole.Instance.Commands.AddCommand("kfs", false, 75 MainConsole.Instance.Commands.AddCommand("kfs", false,
76 "show digest", 76 "show asset",
77 "show digest <ID>", 77 "show asset <ID>",
78 "Show asset digest", 78 "Show asset information",
79 HandleShowDigest); 79 HandleShowAsset);
80 80
81 MainConsole.Instance.Commands.AddCommand("kfs", false, 81 MainConsole.Instance.Commands.AddCommand("kfs", false,
82 "delete asset", 82 "delete asset",
@@ -153,7 +153,7 @@ namespace OpenSim.Server.Handlers.Asset
153 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); 153 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
154 } 154 }
155 155
156 void HandleShowDigest(string module, string[] args) 156 void HandleShowAsset(string module, string[] args)
157 { 157 {
158 if (args.Length < 3) 158 if (args.Length < 3)
159 { 159 {