diff options
author | Justin Clark-Casey (justincc) | 2012-01-05 21:11:32 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-05 21:11:32 +0000 |
commit | da0fc3c8f572adba69e52e1d7f528946ab1f6f23 (patch) | |
tree | 019ce96ad350912b15421cf66f38e2dab9da2d67 /OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs | |
parent | Add size and temporary information to "show asset" command (diff) | |
download | opensim-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 'OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs | 51 |
1 files changed, 51 insertions, 0 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 |