aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs33
1 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index bcd4ccd..3884138 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -92,6 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
92 private StateSource m_stateSource; 92 private StateSource m_stateSource;
93 private bool m_postOnRez; 93 private bool m_postOnRez;
94 private bool m_startedFromSavedState = false; 94 private bool m_startedFromSavedState = false;
95 private string m_CurrentState = String.Empty;
95 96
96 //private ISponsor m_ScriptSponsor; 97 //private ISponsor m_ScriptSponsor;
97 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 98 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
@@ -870,21 +871,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
870 871
871 string xml = ScriptSerializer.Serialize(this); 872 string xml = ScriptSerializer.Serialize(this);
872 873
873 try 874 if (m_CurrentState != xml)
874 {
875 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
876 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
877 Byte[] buf = enc.GetBytes(xml);
878 fs.Write(buf, 0, buf.Length);
879 fs.Close();
880 }
881 catch(Exception e)
882 {
883 m_log.Error("Unable to save xml\n"+e.ToString());
884 }
885 if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
886 { 875 {
887 throw new Exception("Completed persistence save, but no file was created"); 876 try
877 {
878 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
879 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
880 Byte[] buf = enc.GetBytes(xml);
881 fs.Write(buf, 0, buf.Length);
882 fs.Close();
883 }
884 catch(Exception e)
885 {
886 m_log.Error("Unable to save xml\n"+e.ToString());
887 }
888 //if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
889 //{
890 // throw new Exception("Completed persistence save, but no file was created");
891 //}
892 m_CurrentState = xml;
888 } 893 }
889 } 894 }
890 895