aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorMelanie2010-07-11 13:32:10 +0100
committerMelanie2010-07-11 13:32:10 +0100
commit922e874653e81ae9b72da210ecfe1d2eb5efa9c6 (patch)
tree25ac2c896c952ca7298cecb700b61f7301439216 /OpenSim/Region/ScriptEngine/XEngine
parentFix the synchronousrestformsrequester so it will successfully handle a respon... (diff)
parentRemove localID from script controls data. It won't transfer to another (diff)
downloadopensim-SC-922e874653e81ae9b72da210ecfe1d2eb5efa9c6.zip
opensim-SC-922e874653e81ae9b72da210ecfe1d2eb5efa9c6.tar.gz
opensim-SC-922e874653e81ae9b72da210ecfe1d2eb5efa9c6.tar.bz2
opensim-SC-922e874653e81ae9b72da210ecfe1d2eb5efa9c6.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs123
2 files changed, 86 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 09b79d0..0ac8b5c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -356,9 +356,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
356 // timer: not handled here 356 // timer: not handled here
357 // listen: not handled here 357 // listen: not handled here
358 358
359 public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change) 359 public void control(UUID itemID, UUID agentID, uint held, uint change)
360 { 360 {
361 myScriptEngine.PostObjectEvent(localID, new EventParams( 361 myScriptEngine.PostScriptEvent(itemID, new EventParams(
362 "control",new object[] { 362 "control",new object[] {
363 new LSL_Types.LSLString(agentID.ToString()), 363 new LSL_Types.LSLString(agentID.ToString()),
364 new LSL_Types.LSLInteger(held), 364 new LSL_Types.LSLInteger(held),
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a6ab5e9..d4c1727 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1425,10 +1425,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1425 1425
1426 try 1426 try
1427 { 1427 {
1428 FileStream tfs = File.Open(assemName + ".text", 1428 using (FileStream tfs = File.Open(assemName + ".text",
1429 FileMode.Open, FileAccess.Read); 1429 FileMode.Open, FileAccess.Read))
1430 tfs.Read(tdata, 0, tdata.Length); 1430 {
1431 tfs.Close(); 1431 tfs.Read(tdata, 0, tdata.Length);
1432 tfs.Close();
1433 }
1432 1434
1433 assem = new System.Text.ASCIIEncoding().GetString(tdata); 1435 assem = new System.Text.ASCIIEncoding().GetString(tdata);
1434 } 1436 }
@@ -1448,9 +1450,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1448 1450
1449 try 1451 try
1450 { 1452 {
1451 FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); 1453 using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
1452 fs.Read(data, 0, data.Length); 1454 {
1453 fs.Close(); 1455 fs.Read(data, 0, data.Length);
1456 fs.Close();
1457 }
1454 1458
1455 assem = System.Convert.ToBase64String(data); 1459 assem = System.Convert.ToBase64String(data);
1456 } 1460 }
@@ -1466,13 +1470,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1466 1470
1467 if (File.Exists(fn + ".map")) 1471 if (File.Exists(fn + ".map"))
1468 { 1472 {
1469 FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); 1473 using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
1470 StreamReader msr = new StreamReader(mfs); 1474 {
1471 1475 using (StreamReader msr = new StreamReader(mfs))
1472 map = msr.ReadToEnd(); 1476 {
1473 1477 map = msr.ReadToEnd();
1474 msr.Close(); 1478 msr.Close();
1475 mfs.Close(); 1479 }
1480 mfs.Close();
1481 }
1476 } 1482 }
1477 1483
1478 XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); 1484 XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
@@ -1560,30 +1566,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1560 { 1566 {
1561 Byte[] filedata = Convert.FromBase64String(base64); 1567 Byte[] filedata = Convert.FromBase64String(base64);
1562 1568
1563 FileStream fs = File.Create(path); 1569 try
1564 fs.Write(filedata, 0, filedata.Length); 1570 {
1565 fs.Close(); 1571 using (FileStream fs = File.Create(path))
1566 1572 {
1567 fs = File.Create(path + ".text"); 1573 fs.Write(filedata, 0, filedata.Length);
1568 StreamWriter sw = new StreamWriter(fs); 1574 fs.Close();
1569 1575 }
1570 sw.Write(base64); 1576 }
1571 1577 catch (IOException ex)
1572 sw.Close(); 1578 {
1573 fs.Close(); 1579 // if there already exists a file at that location, it may be locked.
1580 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1581 }
1582 try
1583 {
1584 using (FileStream fs = File.Create(path + ".text"))
1585 {
1586 using (StreamWriter sw = new StreamWriter(fs))
1587 {
1588 sw.Write(base64);
1589 sw.Close();
1590 }
1591 fs.Close();
1592 }
1593 }
1594 catch (IOException ex)
1595 {
1596 // if there already exists a file at that location, it may be locked.
1597 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1598 }
1574 } 1599 }
1575 } 1600 }
1576 1601
1577 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1602 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1578 statepath = Path.Combine(statepath, itemID.ToString() + ".state"); 1603 statepath = Path.Combine(statepath, itemID.ToString() + ".state");
1579 1604
1580 FileStream sfs = File.Create(statepath); 1605 try
1581 StreamWriter ssw = new StreamWriter(sfs); 1606 {
1582 1607 using (FileStream sfs = File.Create(statepath))
1583 ssw.Write(stateE.OuterXml); 1608 {
1584 1609 using (StreamWriter ssw = new StreamWriter(sfs))
1585 ssw.Close(); 1610 {
1586 sfs.Close(); 1611 ssw.Write(stateE.OuterXml);
1612 ssw.Close();
1613 }
1614 sfs.Close();
1615 }
1616 }
1617 catch (IOException ex)
1618 {
1619 // if there already exists a file at that location, it may be locked.
1620 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1621 }
1587 1622
1588 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); 1623 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1589 if (mapL.Count > 0) 1624 if (mapL.Count > 0)
@@ -1593,13 +1628,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1593 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1628 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1594 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); 1629 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1595 1630
1596 FileStream mfs = File.Create(mappath); 1631 try
1597 StreamWriter msw = new StreamWriter(mfs); 1632 {
1598 1633 using (FileStream mfs = File.Create(mappath))
1599 msw.Write(mapE.InnerText); 1634 {
1600 1635 using (StreamWriter msw = new StreamWriter(mfs))
1601 msw.Close(); 1636 {
1602 mfs.Close(); 1637 msw.Write(mapE.InnerText);
1638 msw.Close();
1639 }
1640 mfs.Close();
1641 }
1642 }
1643 catch (IOException ex)
1644 {
1645 // if there already exists a file at that location, it may be locked.
1646 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1647 }
1603 } 1648 }
1604 1649
1605 return true; 1650 return true;