Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-07-11 13:32:10 +01:00
commit 922e874653
8 changed files with 104 additions and 61 deletions

View File

@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLite
public EstateSettings LoadEstateSettings(int estateID) public EstateSettings LoadEstateSettings(int estateID)
{ {
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLite
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLiteLegacy
public EstateSettings LoadEstateSettings(int estateID) public EstateSettings LoadEstateSettings(int estateID)
{ {
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLiteLegacy
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -183,7 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
public event ScriptChangedEvent OnScriptChangedEvent; public event ScriptChangedEvent OnScriptChangedEvent;
public delegate void ScriptChangedEvent(uint localID, uint change); public delegate void ScriptChangedEvent(uint localID, uint change);
public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
public event ScriptControlEvent OnScriptControlEvent; public event ScriptControlEvent OnScriptControlEvent;
public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
@ -1619,7 +1619,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
{ {
ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
if (handlerScriptControlEvent != null) if (handlerScriptControlEvent != null)
@ -1628,7 +1628,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
try try
{ {
d(p, scriptUUID, avatarID, held, _changed); d(scriptUUID, avatarID, held, _changed);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -61,7 +61,6 @@ namespace OpenSim.Region.Framework.Scenes
struct ScriptControllers struct ScriptControllers
{ {
public UUID itemID; public UUID itemID;
public uint objID;
public ScriptControlled ignoreControls; public ScriptControlled ignoreControls;
public ScriptControlled eventControls; public ScriptControlled eventControls;
} }
@ -3945,7 +3944,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
obj.eventControls = ScriptControlled.CONTROL_ZERO; obj.eventControls = ScriptControlled.CONTROL_ZERO;
obj.itemID = Script_item_UUID; obj.itemID = Script_item_UUID;
obj.objID = Obj_localID;
if (pass_on == 0 && accept == 0) if (pass_on == 0 && accept == 0)
{ {
IgnoredControls |= (ScriptControlled)controls; IgnoredControls |= (ScriptControlled)controls;
@ -4088,7 +4086,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
{ {
// only send if still pressed or just changed // only send if still pressed or just changed
m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, UUID, (uint)localHeld, (uint)localChange); m_scene.EventManager.TriggerControlEvent(scriptUUID, UUID, (uint)localHeld, (uint)localChange);
} }
} }
} }

View File

@ -356,9 +356,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// timer: not handled here // timer: not handled here
// listen: not handled here // listen: not handled here
public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change) public void control(UUID itemID, UUID agentID, uint held, uint change)
{ {
myScriptEngine.PostObjectEvent(localID, new EventParams( myScriptEngine.PostScriptEvent(itemID, new EventParams(
"control",new object[] { "control",new object[] {
new LSL_Types.LSLString(agentID.ToString()), new LSL_Types.LSLString(agentID.ToString()),
new LSL_Types.LSLInteger(held), new LSL_Types.LSLInteger(held),

View File

@ -1425,10 +1425,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
FileStream tfs = File.Open(assemName + ".text", using (FileStream tfs = File.Open(assemName + ".text",
FileMode.Open, FileAccess.Read); FileMode.Open, FileAccess.Read))
{
tfs.Read(tdata, 0, tdata.Length); tfs.Read(tdata, 0, tdata.Length);
tfs.Close(); tfs.Close();
}
assem = new System.Text.ASCIIEncoding().GetString(tdata); assem = new System.Text.ASCIIEncoding().GetString(tdata);
} }
@ -1448,9 +1450,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
{
fs.Read(data, 0, data.Length); fs.Read(data, 0, data.Length);
fs.Close(); fs.Close();
}
assem = System.Convert.ToBase64String(data); assem = System.Convert.ToBase64String(data);
} }
@ -1466,14 +1470,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (File.Exists(fn + ".map")) if (File.Exists(fn + ".map"))
{ {
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
StreamReader msr = new StreamReader(mfs); {
using (StreamReader msr = new StreamReader(mfs))
{
map = msr.ReadToEnd(); map = msr.ReadToEnd();
msr.Close(); msr.Close();
}
mfs.Close(); mfs.Close();
} }
}
XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
@ -1560,30 +1566,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
Byte[] filedata = Convert.FromBase64String(base64); Byte[] filedata = Convert.FromBase64String(base64);
FileStream fs = File.Create(path); try
{
using (FileStream fs = File.Create(path))
{
fs.Write(filedata, 0, filedata.Length); fs.Write(filedata, 0, filedata.Length);
fs.Close(); fs.Close();
}
fs = File.Create(path + ".text"); }
StreamWriter sw = new StreamWriter(fs); catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
}
try
{
using (FileStream fs = File.Create(path + ".text"))
{
using (StreamWriter sw = new StreamWriter(fs))
{
sw.Write(base64); sw.Write(base64);
sw.Close(); sw.Close();
}
fs.Close(); fs.Close();
} }
} }
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
}
}
}
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
statepath = Path.Combine(statepath, itemID.ToString() + ".state"); statepath = Path.Combine(statepath, itemID.ToString() + ".state");
FileStream sfs = File.Create(statepath); try
StreamWriter ssw = new StreamWriter(sfs); {
using (FileStream sfs = File.Create(statepath))
{
using (StreamWriter ssw = new StreamWriter(sfs))
{
ssw.Write(stateE.OuterXml); ssw.Write(stateE.OuterXml);
ssw.Close(); ssw.Close();
}
sfs.Close(); sfs.Close();
}
}
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
}
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
if (mapL.Count > 0) if (mapL.Count > 0)
@ -1593,14 +1628,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
FileStream mfs = File.Create(mappath); try
StreamWriter msw = new StreamWriter(mfs); {
using (FileStream mfs = File.Create(mappath))
{
using (StreamWriter msw = new StreamWriter(mfs))
{
msw.Write(mapE.InnerText); msw.Write(mapE.InnerText);
msw.Close(); msw.Close();
}
mfs.Close(); mfs.Close();
} }
}
catch (IOException ex)
{
// if there already exists a file at that location, it may be locked.
m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
}
}
return true; return true;
} }