aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Asset
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Asset')
-rw-r--r--OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs51
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