diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 19 |
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 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using OpenMetaverse; | 32 | using 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> |