From 0086f9bd92a1af0b7998b81ee1f1742a16316894 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 18 Feb 2009 22:32:25 +0000 Subject: Fix the windows sharing violations on script crossings --- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 59 +++++++++++++++++----- 1 file changed, 46 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs') 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 if (fn == String.Empty) continue; - FileInfo fi = new FileInfo(assembly); + String filedata = String.Empty; - if (fi == null) - continue; + if (File.Exists(assembly+".text")) + { + FileInfo tfi = new FileInfo(assembly+".text"); - Byte[] data = new Byte[fi.Length]; + if (tfi == null) + continue; - try - { - FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); - fs.Read(data, 0, data.Length); - fs.Close(); + Byte[] tdata = new Byte[tfi.Length]; + + try + { + FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read); + tfs.Read(tdata, 0, tdata.Length); + tfs.Close(); + } + catch (Exception e) + { + m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message); + } + + filedata = new System.Text.ASCIIEncoding().GetString(tdata); } - catch (Exception e) + else { - m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message); - } + FileInfo fi = new FileInfo(assembly); + if (fi == null) + continue; + + Byte[] data = new Byte[fi.Length]; + + try + { + FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); + fs.Read(data, 0, data.Length); + fs.Close(); + } + catch (Exception e) + { + m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message); + } + + filedata = System.Convert.ToBase64String(data); + } XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", ""); XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", ""); assemblyName.Value = fn; assemblyData.Attributes.Append(assemblyName); - assemblyData.InnerText = System.Convert.ToBase64String(data); + assemblyData.InnerText = filedata; wrapper.AppendChild(assemblyData); } @@ -441,6 +469,11 @@ namespace OpenSim.Region.Framework.Scenes FileStream fs = File.Create(path); fs.Write(filedata, 0, filedata.Length); fs.Close(); + + Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText); + fs = File.Create(path+".text"); + fs.Write(textbytes, 0, textbytes.Length); + fs.Close(); } } break; -- cgit v1.1