aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
diff options
context:
space:
mode:
authorDr Scofield2009-04-22 18:09:55 +0000
committerDr Scofield2009-04-22 18:09:55 +0000
commit7dbcf0570f0f5d521373df6d381c2d75dc2845d3 (patch)
tree63d7b2429f78b4b66e9194c5ee35476ac9b1e5e0 /OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
parentmore cleanup (diff)
downloadopensim-SC_OLD-7dbcf0570f0f5d521373df6d381c2d75dc2845d3.zip
opensim-SC_OLD-7dbcf0570f0f5d521373df6d381c2d75dc2845d3.tar.gz
opensim-SC_OLD-7dbcf0570f0f5d521373df6d381c2d75dc2845d3.tar.bz2
opensim-SC_OLD-7dbcf0570f0f5d521373df6d381c2d75dc2845d3.tar.xz
From: Alan Webb <alan_webb@us.ibm.com>
Changes to enable script state persistence across non-restart serialization situations (inventory/OAR/attachments) Also fixing test cases for OAR and IAR so they don't barf with the new code.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 9666525..e952799 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
@@ -264,6 +265,8 @@ namespace OpenSim.Region.Framework.Scenes
264 } 265 }
265 else 266 else
266 { 267 {
268 if(m_part.ParentGroup.m_savedScriptState != null)
269 RestoreSavedScriptState(item.OldItemID, item.ItemID);
267 m_items[item.ItemID].PermsMask = 0; 270 m_items[item.ItemID].PermsMask = 0;
268 m_items[item.ItemID].PermsGranter = UUID.Zero; 271 m_items[item.ItemID].PermsGranter = UUID.Zero;
269 string script = Utils.BytesToString(asset.Data); 272 string script = Utils.BytesToString(asset.Data);
@@ -276,6 +279,22 @@ namespace OpenSim.Region.Framework.Scenes
276 } 279 }
277 } 280 }
278 281
282 static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
283
284 private void RestoreSavedScriptState(UUID oldID, UUID newID)
285 {
286 if(m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
287 {
288 string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(),
289 newID.ToString()+".state");
290 FileStream fs = File.Create(fpath);
291 Byte[] buffer = enc.GetBytes(m_part.ParentGroup.m_savedScriptState[oldID]);
292 fs.Write(buffer,0,buffer.Length);
293 fs.Close();
294 m_part.ParentGroup.m_savedScriptState.Remove(oldID);
295 }
296 }
297
279 /// <summary> 298 /// <summary>
280 /// Start a script which is in this prim's inventory. 299 /// Start a script which is in this prim's inventory.
281 /// </summary> 300 /// </summary>