aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-02-18 22:32:25 +0000
committerMelanie Thielker2009-02-18 22:32:25 +0000
commit0086f9bd92a1af0b7998b81ee1f1742a16316894 (patch)
tree08cfd370dcd803a6ae265cb5f1da621ef6a7942c /OpenSim
parentStops animations on Teleports, to conform with what the viewer does. (diff)
downloadopensim-SC-0086f9bd92a1af0b7998b81ee1f1742a16316894.zip
opensim-SC-0086f9bd92a1af0b7998b81ee1f1742a16316894.tar.gz
opensim-SC-0086f9bd92a1af0b7998b81ee1f1742a16316894.tar.bz2
opensim-SC-0086f9bd92a1af0b7998b81ee1f1742a16316894.tar.xz
Fix the windows sharing violations on script crossings
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs59
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs44
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs4
3 files changed, 91 insertions, 16 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;
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 5d8f445..5b3dce7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -343,7 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
343 343
344 // Check this late so the map is generated on sim start 344 // Check this late so the map is generated on sim start
345 // 345 //
346 if (File.Exists(OutFile)) 346 if (File.Exists(OutFile) && File.Exists(OutFile+".text"))
347 { 347 {
348// m_scriptEngine.Log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); 348// m_scriptEngine.Log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset);
349 return OutFile; 349 return OutFile;
@@ -579,6 +579,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
579 } 579 }
580// m_scriptEngine.Log.DebugFormat("[Compiler] Compiled new assembly "+ 580// m_scriptEngine.Log.DebugFormat("[Compiler] Compiled new assembly "+
581// "for {0}", asset); 581// "for {0}", asset);
582
583 // Because windows likes to perform exclusive locks, we simply
584 // write out a textual representation of the file here
585 //
586 // Read the binary file into a buffer
587 //
588 FileInfo fi = new FileInfo(OutFile);
589
590 if (fi == null)
591 {
592 string errtext = String.Empty;
593 errtext += "No compile error. But not able to stat file.";
594 throw new Exception(errtext);
595 }
596
597 Byte[] data = new Byte[fi.Length];
598
599 try
600 {
601 FileStream fs = File.Open(OutFile, FileMode.Open, FileAccess.Read);
602 fs.Read(data, 0, data.Length);
603 fs.Close();
604 }
605 catch (Exception e)
606 {
607 string errtext = String.Empty;
608 errtext += "No compile error. But not able to open file.";
609 throw new Exception(errtext);
610 }
611
612 // Convert to base64
613 //
614 string filetext = System.Convert.ToBase64String(data);
615
616 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
617
618 Byte[] buf = enc.GetBytes(filetext);
619
620 FileStream sfs = File.Create(OutFile+".text");
621 sfs.Write(buf, 0, buf.Length);
622 sfs.Close();
623
582 return OutFile; 624 return OutFile;
583 } 625 }
584 626
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a5570b3..7a36bc2 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -744,8 +744,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
744 if (File.Exists(m_Assemblies[assetID])) 744 if (File.Exists(m_Assemblies[assetID]))
745 File.Delete(m_Assemblies[assetID]); 745 File.Delete(m_Assemblies[assetID]);
746 746
747 if (File.Exists(m_Assemblies[assetID]+".state")) 747 if (File.Exists(m_Assemblies[assetID]+".text"))
748 File.Delete(m_Assemblies[assetID]+".state"); 748 File.Delete(m_Assemblies[assetID]+".text");
749 749
750 if (File.Exists(m_Assemblies[assetID]+".mdb")) 750 if (File.Exists(m_Assemblies[assetID]+".mdb"))
751 File.Delete(m_Assemblies[assetID]+".mdb"); 751 File.Delete(m_Assemblies[assetID]+".mdb");