aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine
diff options
context:
space:
mode:
authorUbitUmarov2018-11-20 23:07:14 +0000
committerUbitUmarov2018-11-20 23:07:14 +0000
commitfb0c8036f025f0211e0205d65aead79eac695060 (patch)
treefcc2b5fb6c1e6fa902f084d7e26db53cdc191b86 /OpenSim/Region/ScriptEngine/YEngine
parentYengine: change script first line processing, also look to language option (diff)
downloadopensim-SC-fb0c8036f025f0211e0205d65aead79eac695060.zip
opensim-SC-fb0c8036f025f0211e0205d65aead79eac695060.tar.gz
opensim-SC-fb0c8036f025f0211e0205d65aead79eac695060.tar.bz2
opensim-SC-fb0c8036f025f0211e0205d65aead79eac695060.tar.xz
Yengine: use using...
Diffstat (limited to 'OpenSim/Region/ScriptEngine/YEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs3
2 files changed, 14 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs
index e90d83b..9bb894d 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCapture.cs
@@ -87,10 +87,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
87 CheckRunLockInvariants(true); 87 CheckRunLockInvariants(true);
88 88
89 // Get copy of script globals and stack in relocateable form. 89 // Get copy of script globals and stack in relocateable form.
90 MemoryStream snapshotStream = new MemoryStream(); 90 Byte[] snapshotBytes;
91 MigrateOutEventHandler(snapshotStream); 91 using (MemoryStream snapshotStream = new MemoryStream())
92 Byte[] snapshotBytes = snapshotStream.ToArray(); 92 {
93 snapshotStream.Close(); 93 MigrateOutEventHandler(snapshotStream);
94 snapshotBytes = snapshotStream.ToArray();
95 }
96
94 string snapshotString = Convert.ToBase64String(snapshotBytes); 97 string snapshotString = Convert.ToBase64String(snapshotBytes);
95 XmlElement snapshotN = doc.CreateElement("", "Snapshot", ""); 98 XmlElement snapshotN = doc.CreateElement("", "Snapshot", "");
96 snapshotN.AppendChild(doc.CreateTextNode(snapshotString)); 99 snapshotN.AppendChild(doc.CreateTextNode(snapshotString));
@@ -180,11 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Yengine
180 183
181 // scriptStateN represents the contents of the .state file so 184 // scriptStateN represents the contents of the .state file so
182 // write the .state file while we are here. 185 // write the .state file while we are here.
183 FileStream fs = File.Create(m_StateFileName); 186 using(FileStream fs = File.Create(m_StateFileName))
184 StreamWriter sw = new StreamWriter(fs); 187 {
185 sw.Write(scriptStateN.OuterXml); 188 using(StreamWriter sw = new StreamWriter(fs))
186 sw.Close(); 189 sw.Write(scriptStateN.OuterXml);
187 fs.Close(); 190 }
188 191
189 return scriptStateN; 192 return scriptStateN;
190 } 193 }
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs
index 8cea9f2..f7c4a7d 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs
@@ -190,7 +190,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
190 // copy scripts or not. 190 // copy scripts or not.
191 byte[] scbytes = System.Text.Encoding.UTF8.GetBytes(m_SourceCode); 191 byte[] scbytes = System.Text.Encoding.UTF8.GetBytes(m_SourceCode);
192 StringBuilder sb = new StringBuilder((256 + 5) / 6); 192 StringBuilder sb = new StringBuilder((256 + 5) / 6);
193 ByteArrayToSixbitStr(sb, System.Security.Cryptography.SHA256.Create().ComputeHash(scbytes)); 193 using (System.Security.Cryptography.SHA256 sha = System.Security.Cryptography.SHA256.Create())
194 ByteArrayToSixbitStr(sb, sha.ComputeHash(scbytes));
194 m_ScriptObjCodeKey = sb.ToString(); 195 m_ScriptObjCodeKey = sb.ToString();
195 196
196 // But source code can be just a sixbit string itself 197 // But source code can be just a sixbit string itself