Merge branch 'master' into careminster

This commit is contained in:
Melanie
2009-12-21 10:28:50 +00:00
3 changed files with 78 additions and 26 deletions

View File

@@ -1348,6 +1348,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
XmlAttribute assetID = doc.CreateAttribute("", "Asset", "");
assetID.Value = instance.AssetID.ToString();
stateData.Attributes.Append(assetID);
XmlAttribute engineName = doc.CreateAttribute("", "Engine", "");
engineName.Value = ScriptEngineName;
stateData.Attributes.Append(engineName);
doc.AppendChild(stateData);
// Add <ScriptState>...</ScriptState>
@@ -1447,10 +1450,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
public void SetXMLState(UUID itemID, string xml)
public bool SetXMLState(UUID itemID, string xml)
{
if (xml == String.Empty)
return;
return false;
XmlDocument doc = new XmlDocument();
@@ -1461,24 +1464,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
catch (Exception)
{
m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
return;
return false;
}
XmlNodeList rootL = doc.GetElementsByTagName("State");
if (rootL.Count < 1)
return;
return false;
XmlElement rootE = (XmlElement)rootL[0];
if (rootE.GetAttribute("UUID") != itemID.ToString())
return;
if (rootE.GetAttribute("Engine") != ScriptEngineName)
return false;
// string assetID = rootE.GetAttribute("Asset");
// On rez from inventory, that ID will have changed. It was only
// advisory anyway. So we don't check it anymore.
//
// if (rootE.GetAttribute("UUID") != itemID.ToString())
// return;
XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
if (stateL.Count != 1)
return;
return false;
XmlElement stateE = (XmlElement)stateL[0];
@@ -1487,7 +1494,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
if (assemL.Count != 1)
return;
return false;
XmlElement assemE = (XmlElement)assemL[0];
@@ -1527,19 +1534,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sfs.Close();
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
XmlElement mapE = (XmlElement)mapL[0];
if (mapL.Count > 0)
{
XmlElement mapE = (XmlElement)mapL[0];
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
FileStream mfs = File.Create(mappath);
StreamWriter msw = new StreamWriter(mfs);
FileStream mfs = File.Create(mappath);
StreamWriter msw = new StreamWriter(mfs);
msw.Write(mapE.InnerText);
msw.Write(mapE.InnerText);
msw.Close();
mfs.Close();
msw.Close();
mfs.Close();
}
return true;
}
}
}