aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs59
1 files changed, 46 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index e1362f9..39ebb1c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -353,30 +353,58 @@ namespace OpenSim.Region.Framework.Scenes
353 if (fn == String.Empty) 353 if (fn == String.Empty)
354 continue; 354 continue;
355 355
356 FileInfo fi = new FileInfo(assembly); 356 String filedata = String.Empty;
357 357
358 if (fi == null) 358 if (File.Exists(assembly+".text"))
359 continue; 359 {
360 FileInfo tfi = new FileInfo(assembly+".text");
360 361
361 Byte[] data = new Byte[fi.Length]; 362 if (tfi == null)
363 continue;
362 364
363 try 365 Byte[] tdata = new Byte[tfi.Length];
364 { 366
365 FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); 367 try
366 fs.Read(data, 0, data.Length); 368 {
367 fs.Close(); 369 FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
370 tfs.Read(tdata, 0, tdata.Length);
371 tfs.Close();
372 }
373 catch (Exception e)
374 {
375 m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
376 }
377
378 filedata = new System.Text.ASCIIEncoding().GetString(tdata);
368 } 379 }
369 catch (Exception e) 380 else
370 { 381 {
371 m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message); 382 FileInfo fi = new FileInfo(assembly);
372 }
373 383
384 if (fi == null)
385 continue;
386
387 Byte[] data = new Byte[fi.Length];
388
389 try
390 {
391 FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
392 fs.Read(data, 0, data.Length);
393 fs.Close();
394 }
395 catch (Exception e)
396 {
397 m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
398 }
399
400 filedata = System.Convert.ToBase64String(data);
401 }
374 XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", ""); 402 XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
375 XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", ""); 403 XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
376 assemblyName.Value = fn; 404 assemblyName.Value = fn;
377 assemblyData.Attributes.Append(assemblyName); 405 assemblyData.Attributes.Append(assemblyName);
378 406
379 assemblyData.InnerText = System.Convert.ToBase64String(data); 407 assemblyData.InnerText = filedata;
380 408
381 wrapper.AppendChild(assemblyData); 409 wrapper.AppendChild(assemblyData);
382 } 410 }
@@ -441,6 +469,11 @@ namespace OpenSim.Region.Framework.Scenes
441 FileStream fs = File.Create(path); 469 FileStream fs = File.Create(path);
442 fs.Write(filedata, 0, filedata.Length); 470 fs.Write(filedata, 0, filedata.Length);
443 fs.Close(); 471 fs.Close();
472
473 Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
474 fs = File.Create(path+".text");
475 fs.Write(textbytes, 0, textbytes.Length);
476 fs.Close();
444 } 477 }
445 } 478 }
446 break; 479 break;