aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetServer
diff options
context:
space:
mode:
authorSean Dague2007-07-16 15:40:11 +0000
committerSean Dague2007-07-16 15:40:11 +0000
commit2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch)
treee3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Grid/AssetServer
parent*Trunk compiles now (diff)
downloadopensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Grid/AssetServer')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs812
-rw-r--r--OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs116
2 files changed, 464 insertions, 464 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 4126ff4..5093f4d 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -1,406 +1,406 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using Db4objects.Db4o; 32using Db4objects.Db4o;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37 37
38namespace OpenSim.Grid.AssetServer 38namespace OpenSim.Grid.AssetServer
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// An asset server 41 /// An asset server
42 /// </summary> 42 /// </summary>
43 public class OpenAsset_Main : conscmd_callback 43 public class OpenAsset_Main : conscmd_callback
44 { 44 {
45 private IObjectContainer db; 45 private IObjectContainer db;
46 46
47 public static OpenAsset_Main assetserver; 47 public static OpenAsset_Main assetserver;
48 48
49 private LogBase m_console; 49 private LogBase m_console;
50 50
51 [STAThread] 51 [STAThread]
52 public static void Main(string[] args) 52 public static void Main(string[] args)
53 { 53 {
54 Console.WriteLine("Starting...\n"); 54 Console.WriteLine("Starting...\n");
55 55
56 assetserver = new OpenAsset_Main(); 56 assetserver = new OpenAsset_Main();
57 assetserver.Startup(); 57 assetserver.Startup();
58 58
59 assetserver.Work(); 59 assetserver.Work();
60 } 60 }
61 61
62 private void Work() 62 private void Work()
63 { 63 {
64 m_console.Notice("Enter help for a list of commands"); 64 m_console.Notice("Enter help for a list of commands");
65 65
66 while (true) 66 while (true)
67 { 67 {
68 m_console.MainLogPrompt(); 68 m_console.MainLogPrompt();
69 } 69 }
70 } 70 }
71 71
72 private OpenAsset_Main() 72 private OpenAsset_Main()
73 { 73 {
74 m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); 74 m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false);
75 MainLog.Instance = m_console; 75 MainLog.Instance = m_console;
76 } 76 }
77 77
78 public void Startup() 78 public void Startup()
79 { 79 {
80 m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); 80 m_console.Verbose("Main.cs:Startup() - Setting up asset DB");
81 setupDB(); 81 setupDB();
82 82
83 m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); 83 m_console.Verbose("Main.cs:Startup() - Starting HTTP process");
84 BaseHttpServer httpServer = new BaseHttpServer(8003); 84 BaseHttpServer httpServer = new BaseHttpServer(8003);
85 85
86 httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); 86 httpServer.AddStreamHandler( new GetAssetStreamHandler(this));
87 httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); 87 httpServer.AddStreamHandler(new PostAssetStreamHandler( this ));
88 88
89 //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); 89 //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod);
90 //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); 90 //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod);
91 91
92 httpServer.Start(); 92 httpServer.Start();
93 93
94 } 94 }
95 95
96 //public string AssetPostMethod(string requestBody, string path, string param) 96 //public string AssetPostMethod(string requestBody, string path, string param)
97 //{ 97 //{
98 // AssetBase asset = new AssetBase(); 98 // AssetBase asset = new AssetBase();
99 // asset.Name = ""; 99 // asset.Name = "";
100 // asset.FullID = new LLUUID(param); 100 // asset.FullID = new LLUUID(param);
101 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); 101 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
102 // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); 102 // byte[] buffer = Windows1252Encoding.GetBytes(requestBody);
103 // asset.Data = buffer; 103 // asset.Data = buffer;
104 // AssetStorage store = new AssetStorage(); 104 // AssetStorage store = new AssetStorage();
105 // store.Data = asset.Data; 105 // store.Data = asset.Data;
106 // store.Name = asset.Name; 106 // store.Name = asset.Name;
107 // store.UUID = asset.FullID; 107 // store.UUID = asset.FullID;
108 // db.Set(store); 108 // db.Set(store);
109 // db.Commit(); 109 // db.Commit();
110 // return ""; 110 // return "";
111 //} 111 //}
112 112
113 //public string AssetGetMethod(string request, string path, string param) 113 //public string AssetGetMethod(string request, string path, string param)
114 //{ 114 //{
115 // Console.WriteLine("got a request " + param); 115 // Console.WriteLine("got a request " + param);
116 // byte[] assetdata = GetAssetData(new LLUUID(param), false); 116 // byte[] assetdata = GetAssetData(new LLUUID(param), false);
117 // if (assetdata != null) 117 // if (assetdata != null)
118 // { 118 // {
119 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); 119 // Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
120 // string ret = Windows1252Encoding.GetString(assetdata); 120 // string ret = Windows1252Encoding.GetString(assetdata);
121 // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); 121 // //string ret = System.Text.Encoding.Unicode.GetString(assetdata);
122 122
123 // return ret; 123 // return ret;
124 124
125 // } 125 // }
126 // else 126 // else
127 // { 127 // {
128 // return ""; 128 // return "";
129 // } 129 // }
130 130
131 //} 131 //}
132 132
133 public byte[] GetAssetData(LLUUID assetID, bool isTexture) 133 public byte[] GetAssetData(LLUUID assetID, bool isTexture)
134 { 134 {
135 bool found = false; 135 bool found = false;
136 AssetStorage foundAsset = null; 136 AssetStorage foundAsset = null;
137 137
138 IObjectSet result = db.Get(new AssetStorage(assetID)); 138 IObjectSet result = db.Get(new AssetStorage(assetID));
139 if (result.Count > 0) 139 if (result.Count > 0)
140 { 140 {
141 foundAsset = (AssetStorage)result.Next(); 141 foundAsset = (AssetStorage)result.Next();
142 found = true; 142 found = true;
143 } 143 }
144 144
145 if (found) 145 if (found)
146 { 146 {
147 return foundAsset.Data; 147 return foundAsset.Data;
148 } 148 }
149 else 149 else
150 { 150 {
151 return null; 151 return null;
152 } 152 }
153 } 153 }
154 154
155 public void setupDB() 155 public void setupDB()
156 { 156 {
157 bool yapfile = File.Exists("gridassets.yap"); 157 bool yapfile = File.Exists("gridassets.yap");
158 try 158 try
159 { 159 {
160 db = Db4oFactory.OpenFile("gridassets.yap"); 160 db = Db4oFactory.OpenFile("gridassets.yap");
161 MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); 161 MainLog.Instance.Verbose("Main.cs:setupDB() - creation");
162 } 162 }
163 catch (Exception e) 163 catch (Exception e)
164 { 164 {
165 db.Close(); 165 db.Close();
166 MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); 166 MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured");
167 MainLog.Instance.Warn(e.ToString()); 167 MainLog.Instance.Warn(e.ToString());
168 } 168 }
169 if (!yapfile) 169 if (!yapfile)
170 { 170 {
171 this.LoadDB(); 171 this.LoadDB();
172 } 172 }
173 } 173 }
174 174
175 public void LoadDB() 175 public void LoadDB()
176 { 176 {
177 try 177 try
178 { 178 {
179 179
180 Console.WriteLine("setting up Asset database"); 180 Console.WriteLine("setting up Asset database");
181 181
182 AssetBase Image = new AssetBase(); 182 AssetBase Image = new AssetBase();
183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); 183 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
184 Image.Name = "Bricks"; 184 Image.Name = "Bricks";
185 this.LoadAsset(Image, true, "bricks.jp2"); 185 this.LoadAsset(Image, true, "bricks.jp2");
186 AssetStorage store = new AssetStorage(); 186 AssetStorage store = new AssetStorage();
187 store.Data = Image.Data; 187 store.Data = Image.Data;
188 store.Name = Image.Name; 188 store.Name = Image.Name;
189 store.UUID = Image.FullID; 189 store.UUID = Image.FullID;
190 db.Set(store); 190 db.Set(store);
191 db.Commit(); 191 db.Commit();
192 192
193 Image = new AssetBase(); 193 Image = new AssetBase();
194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); 194 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
195 Image.Name = "Plywood"; 195 Image.Name = "Plywood";
196 this.LoadAsset(Image, true, "plywood.jp2"); 196 this.LoadAsset(Image, true, "plywood.jp2");
197 store = new AssetStorage(); 197 store = new AssetStorage();
198 store.Data = Image.Data; 198 store.Data = Image.Data;
199 store.Name = Image.Name; 199 store.Name = Image.Name;
200 store.UUID = Image.FullID; 200 store.UUID = Image.FullID;
201 db.Set(store); 201 db.Set(store);
202 db.Commit(); 202 db.Commit();
203 203
204 Image = new AssetBase(); 204 Image = new AssetBase();
205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); 205 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
206 Image.Name = "Rocks"; 206 Image.Name = "Rocks";
207 this.LoadAsset(Image, true, "rocks.jp2"); 207 this.LoadAsset(Image, true, "rocks.jp2");
208 store = new AssetStorage(); 208 store = new AssetStorage();
209 store.Data = Image.Data; 209 store.Data = Image.Data;
210 store.Name = Image.Name; 210 store.Name = Image.Name;
211 store.UUID = Image.FullID; 211 store.UUID = Image.FullID;
212 db.Set(store); 212 db.Set(store);
213 db.Commit(); 213 db.Commit();
214 214
215 Image = new AssetBase(); 215 Image = new AssetBase();
216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); 216 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
217 Image.Name = "Granite"; 217 Image.Name = "Granite";
218 this.LoadAsset(Image, true, "granite.jp2"); 218 this.LoadAsset(Image, true, "granite.jp2");
219 store = new AssetStorage(); 219 store = new AssetStorage();
220 store.Data = Image.Data; 220 store.Data = Image.Data;
221 store.Name = Image.Name; 221 store.Name = Image.Name;
222 store.UUID = Image.FullID; 222 store.UUID = Image.FullID;
223 db.Set(store); 223 db.Set(store);
224 db.Commit(); 224 db.Commit();
225 225
226 Image = new AssetBase(); 226 Image = new AssetBase();
227 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); 227 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
228 Image.Name = "Hardwood"; 228 Image.Name = "Hardwood";
229 this.LoadAsset(Image, true, "hardwood.jp2"); 229 this.LoadAsset(Image, true, "hardwood.jp2");
230 store = new AssetStorage(); 230 store = new AssetStorage();
231 store.Data = Image.Data; 231 store.Data = Image.Data;
232 store.Name = Image.Name; 232 store.Name = Image.Name;
233 store.UUID = Image.FullID; 233 store.UUID = Image.FullID;
234 db.Set(store); 234 db.Set(store);
235 db.Commit(); 235 db.Commit();
236 236
237 Image = new AssetBase(); 237 Image = new AssetBase();
238 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); 238 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
239 Image.Name = "Prim Base Texture"; 239 Image.Name = "Prim Base Texture";
240 this.LoadAsset(Image, true, "plywood.jp2"); 240 this.LoadAsset(Image, true, "plywood.jp2");
241 store = new AssetStorage(); 241 store = new AssetStorage();
242 store.Data = Image.Data; 242 store.Data = Image.Data;
243 store.Name = Image.Name; 243 store.Name = Image.Name;
244 store.UUID = Image.FullID; 244 store.UUID = Image.FullID;
245 db.Set(store); 245 db.Set(store);
246 db.Commit(); 246 db.Commit();
247 247
248 Image = new AssetBase(); 248 Image = new AssetBase();
249 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); 249 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
250 Image.Name = "Shape"; 250 Image.Name = "Shape";
251 this.LoadAsset(Image, false, "base_shape.dat"); 251 this.LoadAsset(Image, false, "base_shape.dat");
252 store = new AssetStorage(); 252 store = new AssetStorage();
253 store.Data = Image.Data; 253 store.Data = Image.Data;
254 store.Name = Image.Name; 254 store.Name = Image.Name;
255 store.UUID = Image.FullID; 255 store.UUID = Image.FullID;
256 db.Set(store); 256 db.Set(store);
257 db.Commit(); 257 db.Commit();
258 } 258 }
259 catch (Exception e) 259 catch (Exception e)
260 { 260 {
261 Console.WriteLine(e.Message); 261 Console.WriteLine(e.Message);
262 } 262 }
263 } 263 }
264 264
265 private void LoadAsset(AssetBase info, bool image, string filename) 265 private void LoadAsset(AssetBase info, bool image, string filename)
266 { 266 {
267 267
268 268
269 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; 269 string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
270 string fileName = Path.Combine(dataPath, filename); 270 string fileName = Path.Combine(dataPath, filename);
271 FileInfo fInfo = new FileInfo(fileName); 271 FileInfo fInfo = new FileInfo(fileName);
272 long numBytes = fInfo.Length; 272 long numBytes = fInfo.Length;
273 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 273 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
274 byte[] idata = new byte[numBytes]; 274 byte[] idata = new byte[numBytes];
275 BinaryReader br = new BinaryReader(fStream); 275 BinaryReader br = new BinaryReader(fStream);
276 idata = br.ReadBytes((int)numBytes); 276 idata = br.ReadBytes((int)numBytes);
277 br.Close(); 277 br.Close();
278 fStream.Close(); 278 fStream.Close();
279 info.Data = idata; 279 info.Data = idata;
280 //info.loaded=true; 280 //info.loaded=true;
281 } 281 }
282 282
283 /*private GridConfig LoadConfigDll(string dllName) 283 /*private GridConfig LoadConfigDll(string dllName)
284 { 284 {
285 Assembly pluginAssembly = Assembly.LoadFrom(dllName); 285 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
286 GridConfig config = null; 286 GridConfig config = null;
287 287
288 foreach (Type pluginType in pluginAssembly.GetTypes()) 288 foreach (Type pluginType in pluginAssembly.GetTypes())
289 { 289 {
290 if (pluginType.IsPublic) 290 if (pluginType.IsPublic)
291 { 291 {
292 if (!pluginType.IsAbstract) 292 if (!pluginType.IsAbstract)
293 { 293 {
294 Type typeInterface = pluginType.GetInterface("IGridConfig", true); 294 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
295 295
296 if (typeInterface != null) 296 if (typeInterface != null)
297 { 297 {
298 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 298 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
299 config = plug.GetConfigObject(); 299 config = plug.GetConfigObject();
300 break; 300 break;
301 } 301 }
302 302
303 typeInterface = null; 303 typeInterface = null;
304 } 304 }
305 } 305 }
306 } 306 }
307 pluginAssembly = null; 307 pluginAssembly = null;
308 return config; 308 return config;
309 }*/ 309 }*/
310 310
311 public void CreateAsset(LLUUID assetId, byte[] assetData) 311 public void CreateAsset(LLUUID assetId, byte[] assetData)
312 { 312 {
313 AssetBase asset = new AssetBase(); 313 AssetBase asset = new AssetBase();
314 asset.Name = ""; 314 asset.Name = "";
315 asset.FullID = assetId; 315 asset.FullID = assetId;
316 asset.Data = assetData; 316 asset.Data = assetData;
317 317
318 AssetStorage store = new AssetStorage(); 318 AssetStorage store = new AssetStorage();
319 store.Data = asset.Data; 319 store.Data = asset.Data;
320 store.Name = asset.Name; 320 store.Name = asset.Name;
321 store.UUID = asset.FullID; 321 store.UUID = asset.FullID;
322 db.Set(store); 322 db.Set(store);
323 db.Commit(); 323 db.Commit();
324 } 324 }
325 325
326 public void RunCmd(string cmd, string[] cmdparams) 326 public void RunCmd(string cmd, string[] cmdparams)
327 { 327 {
328 switch (cmd) 328 switch (cmd)
329 { 329 {
330 case "help": 330 case "help":
331 m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); 331 m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)");
332 break; 332 break;
333 333
334 case "shutdown": 334 case "shutdown":
335 m_console.Close(); 335 m_console.Close();
336 Environment.Exit(0); 336 Environment.Exit(0);
337 break; 337 break;
338 } 338 }
339 } 339 }
340 340
341 public void Show(string ShowWhat) 341 public void Show(string ShowWhat)
342 { 342 {
343 } 343 }
344 } 344 }
345 345
346 public class GetAssetStreamHandler : BaseStreamHandler 346 public class GetAssetStreamHandler : BaseStreamHandler
347 { 347 {
348 OpenAsset_Main m_assetManager; 348 OpenAsset_Main m_assetManager;
349 349
350 override public byte[] Handle(string path, Stream request) 350 override public byte[] Handle(string path, Stream request)
351 { 351 {
352 string param = GetParam(path); 352 string param = GetParam(path);
353 353
354 byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); 354 byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false);
355 if (assetdata != null) 355 if (assetdata != null)
356 { 356 {
357 return assetdata; 357 return assetdata;
358 } 358 }
359 else 359 else
360 { 360 {
361 return new byte[]{}; 361 return new byte[]{};
362 } 362 }
363 } 363 }
364 364
365 public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") 365 public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET")
366 { 366 {
367 m_assetManager = assetManager; 367 m_assetManager = assetManager;
368 } 368 }
369 } 369 }
370 370
371 public class PostAssetStreamHandler : BaseStreamHandler 371 public class PostAssetStreamHandler : BaseStreamHandler
372 { 372 {
373 OpenAsset_Main m_assetManager; 373 OpenAsset_Main m_assetManager;
374 374
375 override public byte[] Handle(string path, Stream request) 375 override public byte[] Handle(string path, Stream request)
376 { 376 {
377 string param = GetParam(path); 377 string param = GetParam(path);
378 LLUUID assetId = new LLUUID(param); 378 LLUUID assetId = new LLUUID(param);
379 byte[] txBuffer = new byte[4096]; 379 byte[] txBuffer = new byte[4096];
380 380
381 using( BinaryReader binReader = new BinaryReader( request ) ) 381 using( BinaryReader binReader = new BinaryReader( request ) )
382 { 382 {
383 using (MemoryStream memoryStream = new MemoryStream(4096)) 383 using (MemoryStream memoryStream = new MemoryStream(4096))
384 { 384 {
385 int count; 385 int count;
386 while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) 386 while ((count = binReader.Read(txBuffer, 0, 4096)) > 0)
387 { 387 {
388 memoryStream.Write(txBuffer, 0, count); 388 memoryStream.Write(txBuffer, 0, count);
389 } 389 }
390 390
391 byte[] assetData = memoryStream.ToArray(); 391 byte[] assetData = memoryStream.ToArray();
392 392
393 m_assetManager.CreateAsset(assetId, assetData); 393 m_assetManager.CreateAsset(assetId, assetData);
394 } 394 }
395 } 395 }
396 396
397 return new byte[]{}; 397 return new byte[]{};
398 } 398 }
399 399
400 public PostAssetStreamHandler( OpenAsset_Main assetManager ) 400 public PostAssetStreamHandler( OpenAsset_Main assetManager )
401 : base("/assets/", "POST") 401 : base("/assets/", "POST")
402 { 402 {
403 m_assetManager = assetManager; 403 m_assetManager = assetManager;
404 } 404 }
405 } 405 }
406} 406}
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index dc39ce2..f9b48d5 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -1,58 +1,58 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// General Information about an assembly is controlled through the following 30// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 31// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 32// associated with an assembly.
33[assembly: AssemblyTitle("OGS-AssetServer")] 33[assembly: AssemblyTitle("OGS-AssetServer")]
34[assembly: AssemblyDescription("")] 34[assembly: AssemblyDescription("")]
35[assembly: AssemblyConfiguration("")] 35[assembly: AssemblyConfiguration("")]
36[assembly: AssemblyCompany("")] 36[assembly: AssemblyCompany("")]
37[assembly: AssemblyProduct("OGS-AssetServer")] 37[assembly: AssemblyProduct("OGS-AssetServer")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 38[assembly: AssemblyCopyright("Copyright © 2007")]
39[assembly: AssemblyTrademark("")] 39[assembly: AssemblyTrademark("")]
40[assembly: AssemblyCulture("")] 40[assembly: AssemblyCulture("")]
41 41
42// Setting ComVisible to false makes the types in this assembly not visible 42// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 43// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 44// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 45[assembly: ComVisible(false)]
46 46
47// The following GUID is for the ID of the typelib if this project is exposed to COM 47// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] 48[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
49 49
50// Version information for an assembly consists of the following four values: 50// Version information for an assembly consists of the following four values:
51// 51//
52// Major Version 52// Major Version
53// Minor Version 53// Minor Version
54// Build Number 54// Build Number
55// Revision 55// Revision
56// 56//
57[assembly: AssemblyVersion("1.0.0.0")] 57[assembly: AssemblyVersion("1.0.0.0")]
58[assembly: AssemblyFileVersion("1.0.0.0")] 58[assembly: AssemblyFileVersion("1.0.0.0")]