Merge branch 'master' of /home/opensim/var/repo/opensim
commit
8dda6e9ea1
|
@ -146,6 +146,7 @@ what it is today.
|
|||
* Stefan_Boom / stoehr
|
||||
* Strawberry Fride
|
||||
* Talun
|
||||
* TBG Renfold
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
* tyre
|
||||
|
|
|
@ -163,52 +163,51 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd =
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||
dbcon);
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
dbcon))
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
// need to ensure we dispose
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,33 +220,31 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd =
|
||||
new MySqlCommand("update assets set access_time=?access_time where id=?id",
|
||||
dbcon);
|
||||
|
||||
// need to ensure we dispose
|
||||
try
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||
{
|
||||
using (cmd)
|
||||
try
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSETS DB]: " +
|
||||
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSETS DB]: " +
|
||||
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -310,35 +307,41 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", dbcon);
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||
dbcon))
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
{
|
||||
while (dbReader.Read())
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
while (dbReader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,11 +356,12 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.Dispose();
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,4 +370,4 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,30 +70,34 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon);
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
|
||||
IDataReader result = cmd.ExecuteReader();
|
||||
|
||||
if (result.Read())
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon))
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
IDataReader result = cmd.ExecuteReader();
|
||||
|
||||
if (result.Read())
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
ret.PrincipalID = principalID;
|
||||
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,57 +123,53 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
string update = "update `"+m_Realm+"` set ";
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += "`" + field + "` = ?"+field;
|
||||
|
||||
first = false;
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||
}
|
||||
|
||||
update += " where UUID = ?principalID";
|
||||
|
||||
cmd.CommandText = update;
|
||||
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
string update = "update `"+m_Realm+"` set ";
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += "`" + field + "` = ?"+field;
|
||||
|
||||
first = false;
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||
}
|
||||
|
||||
update += " where UUID = ?principalID";
|
||||
|
||||
cmd.CommandText = update;
|
||||
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
{
|
||||
cmd.Dispose();
|
||||
return false;
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDataItem(UUID principalID, string item, string value)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
|
||||
"` set `" + item + "` = ?" + item + " where UUID = ?UUID");
|
||||
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+item, value);
|
||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where UUID = ?UUID"))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?"+item, value);
|
||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -179,18 +179,18 @@ namespace OpenSim.Data.MySQL
|
|||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))");
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))"))
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -199,30 +199,29 @@ namespace OpenSim.Data.MySQL
|
|||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()");
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()"))
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
}
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
cmd.Dispose();
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DoExpire()
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()");
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Dispose();
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()"))
|
||||
{
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
m_LastExpire = System.Environment.TickCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,14 +52,15 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public bool Delete(UUID principalID, string name)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -49,34 +49,38 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public bool Delete(string principalID, string friend)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Friend", friend);
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Friend", friend);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(UUID principalID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(string principalID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -467,43 +467,43 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand result = new MySqlCommand(sql, dbcon);
|
||||
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
||||
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
||||
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
||||
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryName", itemName);
|
||||
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
||||
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
||||
item.CurrentPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?invType", item.InvType);
|
||||
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
||||
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
||||
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
||||
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||
result.Parameters.AddWithValue("?flags", item.Flags);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand result = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
result.ExecuteNonQuery();
|
||||
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
||||
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
||||
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
||||
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryName", itemName);
|
||||
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
||||
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
||||
item.CurrentPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?invType", item.InvType);
|
||||
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
||||
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
||||
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
||||
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||
result.Parameters.AddWithValue("?flags", item.Flags);
|
||||
|
||||
lock (m_dbLock)
|
||||
result.ExecuteNonQuery();
|
||||
|
||||
result.Dispose();
|
||||
}
|
||||
|
||||
result.Dispose();
|
||||
|
||||
result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon);
|
||||
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
|
||||
{
|
||||
result.ExecuteNonQuery();
|
||||
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
result.ExecuteNonQuery();
|
||||
}
|
||||
result.Dispose();
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
|
@ -533,12 +533,12 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon);
|
||||
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -579,24 +579,26 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
cmd.Parameters.AddWithValue("?folderName", folderName);
|
||||
cmd.Parameters.AddWithValue("?type", folder.Type);
|
||||
cmd.Parameters.AddWithValue("?version", folder.Version);
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
cmd.Parameters.AddWithValue("?folderName", folderName);
|
||||
cmd.Parameters.AddWithValue("?type", folder.Type);
|
||||
cmd.Parameters.AddWithValue("?version", folder.Version);
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_dbLock)
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (m_dbLock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,20 +626,22 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
|
||||
try
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
lock (m_dbLock)
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (m_dbLock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,13 +74,14 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
|
@ -92,15 +93,16 @@ namespace OpenSim.Data.MySQL
|
|||
if (regionID == UUID.Zero)
|
||||
return false;
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -329,11 +329,12 @@ namespace OpenSim.Data.MySQL
|
|||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command);
|
||||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -129,114 +129,114 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = dbcon.CreateCommand();
|
||||
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into prims (" +
|
||||
"UUID, CreationDate, " +
|
||||
"Name, Text, Description, " +
|
||||
"SitName, TouchName, ObjectFlags, " +
|
||||
"OwnerMask, NextOwnerMask, GroupMask, " +
|
||||
"EveryoneMask, BaseMask, PositionX, " +
|
||||
"PositionY, PositionZ, GroupPositionX, " +
|
||||
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
||||
"VelocityY, VelocityZ, AngularVelocityX, " +
|
||||
"AngularVelocityY, AngularVelocityZ, " +
|
||||
"AccelerationX, AccelerationY, " +
|
||||
"AccelerationZ, RotationX, " +
|
||||
"RotationY, RotationZ, " +
|
||||
"RotationW, SitTargetOffsetX, " +
|
||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"SitTargetOrientW, SitTargetOrientX, " +
|
||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||
"RegionUUID, CreatorID, " +
|
||||
"OwnerID, GroupID, " +
|
||||
"LastOwnerID, SceneGroupID, " +
|
||||
"PayPrice, PayButton1, " +
|
||||
"PayButton2, PayButton3, " +
|
||||
"PayButton4, LoopedSound, " +
|
||||
"LoopedSoundGain, TextureAnimation, " +
|
||||
"OmegaX, OmegaY, OmegaZ, " +
|
||||
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
||||
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
||||
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
||||
"ForceMouselook, ScriptAccessPin, " +
|
||||
"AllowedDrop, DieAtEdge, " +
|
||||
"SalePrice, SaleType, " +
|
||||
"ColorR, ColorG, ColorB, ColorA, " +
|
||||
"ParticleSystem, ClickAction, Material, " +
|
||||
"CollisionSound, CollisionSoundVolume, " +
|
||||
"PassTouches, " +
|
||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||
"?CreationDate, ?Name, ?Text, " +
|
||||
"?Description, ?SitName, ?TouchName, " +
|
||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
||||
"?PositionX, ?PositionY, ?PositionZ, " +
|
||||
"?GroupPositionX, ?GroupPositionY, " +
|
||||
"?GroupPositionZ, ?VelocityX, " +
|
||||
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
||||
"?AngularVelocityY, ?AngularVelocityZ, " +
|
||||
"?AccelerationX, ?AccelerationY, " +
|
||||
"?AccelerationZ, ?RotationX, " +
|
||||
"?RotationY, ?RotationZ, " +
|
||||
"?RotationW, ?SitTargetOffsetX, " +
|
||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
||||
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
||||
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
||||
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
||||
"?ForceMouselook, ?ScriptAccessPin, " +
|
||||
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
||||
"?SaleType, ?ColorR, ?ColorG, " +
|
||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into primshapes (" +
|
||||
"UUID, Shape, ScaleX, ScaleY, " +
|
||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||
"PathScaleX, PathScaleY, PathShearX, " +
|
||||
"PathShearY, PathSkew, PathCurve, " +
|
||||
"PathRadiusOffset, PathRevolutions, " +
|
||||
"PathTaperX, PathTaperY, PathTwist, " +
|
||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||
"ProfileCurve, ProfileHollow, Texture, " +
|
||||
"ExtraParams, State, Media) values (?UUID, " +
|
||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||
"?PathScaleX, ?PathScaleY, " +
|
||||
"?PathShearX, ?PathShearY, " +
|
||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||
"?PathRevolutions, ?PathTaperX, " +
|
||||
"?PathTaperY, ?PathTwist, " +
|
||||
"?PathTwistBegin, ?ProfileBegin, " +
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State, ?Media)";
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into prims (" +
|
||||
"UUID, CreationDate, " +
|
||||
"Name, Text, Description, " +
|
||||
"SitName, TouchName, ObjectFlags, " +
|
||||
"OwnerMask, NextOwnerMask, GroupMask, " +
|
||||
"EveryoneMask, BaseMask, PositionX, " +
|
||||
"PositionY, PositionZ, GroupPositionX, " +
|
||||
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
||||
"VelocityY, VelocityZ, AngularVelocityX, " +
|
||||
"AngularVelocityY, AngularVelocityZ, " +
|
||||
"AccelerationX, AccelerationY, " +
|
||||
"AccelerationZ, RotationX, " +
|
||||
"RotationY, RotationZ, " +
|
||||
"RotationW, SitTargetOffsetX, " +
|
||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"SitTargetOrientW, SitTargetOrientX, " +
|
||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||
"RegionUUID, CreatorID, " +
|
||||
"OwnerID, GroupID, " +
|
||||
"LastOwnerID, SceneGroupID, " +
|
||||
"PayPrice, PayButton1, " +
|
||||
"PayButton2, PayButton3, " +
|
||||
"PayButton4, LoopedSound, " +
|
||||
"LoopedSoundGain, TextureAnimation, " +
|
||||
"OmegaX, OmegaY, OmegaZ, " +
|
||||
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
||||
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
||||
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
||||
"ForceMouselook, ScriptAccessPin, " +
|
||||
"AllowedDrop, DieAtEdge, " +
|
||||
"SalePrice, SaleType, " +
|
||||
"ColorR, ColorG, ColorB, ColorA, " +
|
||||
"ParticleSystem, ClickAction, Material, " +
|
||||
"CollisionSound, CollisionSoundVolume, " +
|
||||
"PassTouches, " +
|
||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||
"?CreationDate, ?Name, ?Text, " +
|
||||
"?Description, ?SitName, ?TouchName, " +
|
||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
||||
"?PositionX, ?PositionY, ?PositionZ, " +
|
||||
"?GroupPositionX, ?GroupPositionY, " +
|
||||
"?GroupPositionZ, ?VelocityX, " +
|
||||
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
||||
"?AngularVelocityY, ?AngularVelocityZ, " +
|
||||
"?AccelerationX, ?AccelerationY, " +
|
||||
"?AccelerationZ, ?RotationX, " +
|
||||
"?RotationY, ?RotationZ, " +
|
||||
"?RotationW, ?SitTargetOffsetX, " +
|
||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
||||
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
||||
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
||||
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
||||
"?ForceMouselook, ?ScriptAccessPin, " +
|
||||
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
||||
"?SaleType, ?ColorR, ?ColorG, " +
|
||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into primshapes (" +
|
||||
"UUID, Shape, ScaleX, ScaleY, " +
|
||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||
"PathScaleX, PathScaleY, PathShearX, " +
|
||||
"PathShearY, PathSkew, PathCurve, " +
|
||||
"PathRadiusOffset, PathRevolutions, " +
|
||||
"PathTaperX, PathTaperY, PathTwist, " +
|
||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||
"ProfileCurve, ProfileHollow, Texture, " +
|
||||
"ExtraParams, State, Media) values (?UUID, " +
|
||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||
"?PathScaleX, ?PathScaleY, " +
|
||||
"?PathShearX, ?PathShearY, " +
|
||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||
"?PathRevolutions, ?PathTaperX, " +
|
||||
"?PathTaperY, ?PathTwist, " +
|
||||
"?PathTwistBegin, ?ProfileBegin, " +
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State, ?Media)";
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1800,41 +1800,40 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
RemoveItems(primID);
|
||||
|
||||
if (items.Count == 0)
|
||||
return;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = dbcon.CreateCommand();
|
||||
|
||||
if (items.Count == 0)
|
||||
return;
|
||||
|
||||
cmd.CommandText = "insert into primitems (" +
|
||||
"invType, assetType, name, " +
|
||||
"description, creationDate, nextPermissions, " +
|
||||
"currentPermissions, basePermissions, " +
|
||||
"everyonePermissions, groupPermissions, " +
|
||||
"flags, itemID, primID, assetID, " +
|
||||
"parentFolderID, creatorID, ownerID, " +
|
||||
"groupID, lastOwnerID) values (?invType, " +
|
||||
"?assetType, ?name, ?description, " +
|
||||
"?creationDate, ?nextPermissions, " +
|
||||
"?currentPermissions, ?basePermissions, " +
|
||||
"?everyonePermissions, ?groupPermissions, " +
|
||||
"?flags, ?itemID, ?primID, ?assetID, " +
|
||||
"?parentFolderID, ?creatorID, ?ownerID, " +
|
||||
"?groupID, ?lastOwnerID)";
|
||||
|
||||
foreach (TaskInventoryItem item in items)
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
FillItemCommand(cmd, item);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
cmd.CommandText = "insert into primitems (" +
|
||||
"invType, assetType, name, " +
|
||||
"description, creationDate, nextPermissions, " +
|
||||
"currentPermissions, basePermissions, " +
|
||||
"everyonePermissions, groupPermissions, " +
|
||||
"flags, itemID, primID, assetID, " +
|
||||
"parentFolderID, creatorID, ownerID, " +
|
||||
"groupID, lastOwnerID) values (?invType, " +
|
||||
"?assetType, ?name, ?description, " +
|
||||
"?creationDate, ?nextPermissions, " +
|
||||
"?currentPermissions, ?basePermissions, " +
|
||||
"?everyonePermissions, ?groupPermissions, " +
|
||||
"?flags, ?itemID, ?primID, ?assetID, " +
|
||||
"?parentFolderID, ?creatorID, ?ownerID, " +
|
||||
"?groupID, ?lastOwnerID)";
|
||||
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
FillItemCommand(cmd, item);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,23 +62,24 @@ namespace OpenSim.Data.MySQL
|
|||
if (words.Length > 2)
|
||||
return new UserAccountData[0];
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
if (words.Length == 1)
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -240,13 +240,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
|||
{
|
||||
ScenePresence sp = scene.GetScenePresence(client.AgentId);
|
||||
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
if (transferMod != null && sp != null && eq != null)
|
||||
transferMod.DoTeleport(sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags, eq);
|
||||
|
||||
if (transferMod != null && sp != null)
|
||||
transferMod.DoTeleport(
|
||||
sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
|
||||
Vector3.UnitX, teleportflags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,15 +51,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public const int DefaultMaxTransferDistance = 4095;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
|
||||
/// </summary>
|
||||
private int m_MaxTransferDistance = 4095;
|
||||
public int MaxTransferDistance
|
||||
{
|
||||
get { return m_MaxTransferDistance; }
|
||||
set { m_MaxTransferDistance = value; }
|
||||
}
|
||||
public int MaxTransferDistance { get; set; }
|
||||
|
||||
protected bool m_Enabled = false;
|
||||
protected Scene m_aScene;
|
||||
|
@ -102,9 +99,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
IConfig transferConfig = source.Configs["EntityTransfer"];
|
||||
if (transferConfig != null)
|
||||
{
|
||||
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
||||
}
|
||||
MaxTransferDistance = transferConfig.GetInt("max_distance", DefaultMaxTransferDistance);
|
||||
else
|
||||
MaxTransferDistance = DefaultMaxTransferDistance;
|
||||
|
||||
m_agentsInTransit = new List<UUID>();
|
||||
m_Enabled = true;
|
||||
|
@ -170,8 +167,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
if (!sp.Scene.Permissions.CanTeleport(sp.UUID))
|
||||
return;
|
||||
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
|
||||
// Reset animations; the viewer does that in teleports.
|
||||
sp.Animator.ResetAnimations();
|
||||
|
||||
|
@ -183,130 +178,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
destinationRegionName = sp.Scene.RegionInfo.RegionName;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
|
||||
sp.Name, position, destinationRegionName);
|
||||
|
||||
// Teleport within the same region
|
||||
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
||||
{
|
||||
Vector3 emergencyPos = new Vector3(128, 128, 128);
|
||||
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
|
||||
position, sp.Name, sp.UUID, emergencyPos);
|
||||
|
||||
position = emergencyPos;
|
||||
}
|
||||
|
||||
// TODO: Get proper AVG Height
|
||||
float localAVHeight = 1.56f;
|
||||
float posZLimit = 22;
|
||||
|
||||
// TODO: Check other Scene HeightField
|
||||
if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize)
|
||||
{
|
||||
posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y];
|
||||
}
|
||||
|
||||
float newPosZ = posZLimit + localAVHeight;
|
||||
if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
|
||||
{
|
||||
position.Z = newPosZ;
|
||||
}
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
TeleportAgentWithinRegion(sp, position, lookAt, teleportFlags);
|
||||
}
|
||||
else // Another region possibly in another simulator
|
||||
{
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
GridRegion finalDestination = GetFinalDestination(reg);
|
||||
if (finalDestination == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}",
|
||||
sp.Name, sp.UUID);
|
||||
|
||||
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
||||
return;
|
||||
}
|
||||
GridRegion finalDestination;
|
||||
TeleportAgentToDifferentRegion(
|
||||
sp, regionHandle, position, lookAt, teleportFlags, out finalDestination);
|
||||
|
||||
if (finalDestination != null)
|
||||
destinationRegionName = finalDestination.RegionName;
|
||||
|
||||
uint curX = 0, curY = 0;
|
||||
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
||||
int curCellX = (int)(curX / Constants.RegionSize);
|
||||
int curCellY = (int)(curY / Constants.RegionSize);
|
||||
int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize);
|
||||
int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize);
|
||||
|
||||
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
|
||||
//
|
||||
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
|
||||
// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
|
||||
|
||||
// Check that these are not the same coordinates
|
||||
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
||||
finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
|
||||
{
|
||||
// Can't do. Viewer crashes
|
||||
sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance)
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(
|
||||
string.Format(
|
||||
"Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
|
||||
finalDestination.RegionName, destCellX, destCellY,
|
||||
sp.Scene.RegionInfo.RegionName, curCellX, curCellY,
|
||||
MaxTransferDistance));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// This is it
|
||||
//
|
||||
DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags, eq);
|
||||
//
|
||||
//
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
// TP to a place that doesn't exist (anymore)
|
||||
// Inform the viewer about that
|
||||
sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore");
|
||||
|
||||
// and set the map-tile to '(Offline)'
|
||||
uint regX, regY;
|
||||
Utils.LongToUInts(regionHandle, out regX, out regY);
|
||||
|
||||
MapBlockData block = new MapBlockData();
|
||||
block.X = (ushort)(regX / Constants.RegionSize);
|
||||
block.Y = (ushort)(regY / Constants.RegionSize);
|
||||
block.Access = 254; // == not there
|
||||
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
blocks.Add(block);
|
||||
sp.ControllingClient.SendMapBlock(blocks, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -320,8 +201,170 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
}
|
||||
|
||||
public void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq)
|
||||
/// <summary>
|
||||
/// Teleports the agent within its current region.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="lookAt"></param>
|
||||
/// <param name="teleportFlags"></param
|
||||
private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
|
||||
sp.Name, position, sp.Scene.RegionInfo.RegionName);
|
||||
|
||||
// Teleport within the same region
|
||||
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
||||
{
|
||||
Vector3 emergencyPos = new Vector3(128, 128, 128);
|
||||
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
|
||||
position, sp.Name, sp.UUID, emergencyPos);
|
||||
|
||||
position = emergencyPos;
|
||||
}
|
||||
|
||||
// TODO: Get proper AVG Height
|
||||
float localAVHeight = 1.56f;
|
||||
float posZLimit = 22;
|
||||
|
||||
// TODO: Check other Scene HeightField
|
||||
if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize)
|
||||
{
|
||||
posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y];
|
||||
}
|
||||
|
||||
float newPosZ = posZLimit + localAVHeight;
|
||||
if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
|
||||
{
|
||||
position.Z = newPosZ;
|
||||
}
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Teleports the agent to a different region.
|
||||
/// </summary>
|
||||
/// <param name='sp'></param>
|
||||
/// <param name='regionHandle'>/param>
|
||||
/// <param name='position'></param>
|
||||
/// <param name='lookAt'></param>
|
||||
/// <param name='teleportFlags'></param>
|
||||
/// <param name='finalDestination'></param>
|
||||
private void TeleportAgentToDifferentRegion(
|
||||
ScenePresence sp, ulong regionHandle, Vector3 position,
|
||||
Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
|
||||
{
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
finalDestination = GetFinalDestination(reg);
|
||||
|
||||
if (finalDestination == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}",
|
||||
sp.Name, sp.UUID);
|
||||
|
||||
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that these are not the same coordinates
|
||||
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
||||
finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
|
||||
{
|
||||
// Can't do. Viewer crashes
|
||||
sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// This is it
|
||||
//
|
||||
DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags);
|
||||
//
|
||||
//
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
finalDestination = null;
|
||||
|
||||
// TP to a place that doesn't exist (anymore)
|
||||
// Inform the viewer about that
|
||||
sp.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore");
|
||||
|
||||
// and set the map-tile to '(Offline)'
|
||||
uint regX, regY;
|
||||
Utils.LongToUInts(regionHandle, out regX, out regY);
|
||||
|
||||
MapBlockData block = new MapBlockData();
|
||||
block.X = (ushort)(regX / Constants.RegionSize);
|
||||
block.Y = (ushort)(regY / Constants.RegionSize);
|
||||
block.Access = 254; // == not there
|
||||
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
blocks.Add(block);
|
||||
sp.ControllingClient.SendMapBlock(blocks, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance is within the max transfer distance.
|
||||
/// </summary>
|
||||
/// <param name="sourceRegion"></param>
|
||||
/// <param name="destRegion"></param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if this instance is within max transfer distance; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
private bool IsWithinMaxTeleportDistance(RegionInfo sourceRegion, GridRegion destRegion)
|
||||
{
|
||||
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
|
||||
//
|
||||
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
|
||||
// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
|
||||
|
||||
// Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position.
|
||||
return Math.Abs(sourceRegion.RegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance
|
||||
&& Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance;
|
||||
}
|
||||
|
||||
public void DoTeleport(
|
||||
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
|
||||
Vector3 position, Vector3 lookAt, uint teleportFlags)
|
||||
{
|
||||
RegionInfo sourceRegion = sp.Scene.RegionInfo;
|
||||
|
||||
if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(
|
||||
string.Format(
|
||||
"Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
|
||||
finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY,
|
||||
sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
|
||||
MaxTransferDistance));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
|
||||
if (reg == null || finalDestination == null)
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
|
||||
|
@ -629,7 +672,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
|
||||
{
|
||||
|
||||
if (s.TestBorderCross(pos, Cardinals.N))
|
||||
return true;
|
||||
if (s.TestBorderCross(pos, Cardinals.S))
|
||||
|
@ -770,7 +812,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
neighboury = ba.TriggerRegionY;
|
||||
neighbourx = ba.TriggerRegionX;
|
||||
|
||||
|
||||
Vector3 newposition = pos;
|
||||
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
|
||||
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
|
||||
|
@ -778,7 +819,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
|
||||
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -818,8 +858,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
|
||||
newpos.Y = enterDistance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
|
||||
{
|
||||
|
@ -846,7 +884,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
|
||||
{
|
||||
|
||||
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
|
||||
neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
|
||||
newpos.Y = enterDistance;
|
||||
|
|
|
@ -242,13 +242,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
}
|
||||
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
GridRegion homeGatekeeper = MakeRegion(aCircuit);
|
||||
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}",
|
||||
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ServerURI, homeGatekeeper.RegionName);
|
||||
|
||||
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
|
||||
DoTeleport(
|
||||
sp, homeGatekeeper, finalDestination,
|
||||
position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -288,17 +289,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
|
||||
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
if (transferMod != null && sp != null && eq != null)
|
||||
transferMod.DoTeleport(sp, gatekeeper, finalDestination, lm.Position,
|
||||
Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark), eq);
|
||||
|
||||
if (transferMod != null && sp != null)
|
||||
transferMod.DoTeleport(
|
||||
sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
|
||||
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// can't find the region: Tell viewer and abort
|
||||
remoteClient.SendTeleportFailed("The teleport destination could not be found.");
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -37,12 +37,41 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
public interface IEntityTransferModule
|
||||
{
|
||||
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position,
|
||||
Vector3 lookAt, uint teleportFlags);
|
||||
/// <summary>
|
||||
/// Teleport an agent within the same or to a different region.
|
||||
/// </summary>
|
||||
/// <param name='agent'></param>
|
||||
/// <param name='regionHandle'>
|
||||
/// The handle of the destination region. If it's the same as the region currently
|
||||
/// occupied by the agent then the teleport will be within that region.
|
||||
/// </param>
|
||||
/// <param name='position'></param>
|
||||
/// <param name='lookAt'></param>
|
||||
/// <param name='teleportFlags'></param>
|
||||
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags);
|
||||
|
||||
void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination,
|
||||
Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq);
|
||||
/// <summary>
|
||||
/// Teleport an agent directly to a given region without checking whether the region should be subsituted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please use Teleport() instead unless you know exactly what you're doing.
|
||||
/// Do not use for same region teleports.
|
||||
/// </remarks>
|
||||
/// <param name='sp'></param>
|
||||
/// <param name='reg'></param>
|
||||
/// <param name='finalDestination'>/param>
|
||||
/// <param name='position'></param>
|
||||
/// <param name='lookAt'></param>
|
||||
/// <param name='teleportFlags'></param>
|
||||
void DoTeleport(
|
||||
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
|
||||
Vector3 position, Vector3 lookAt, uint teleportFlags);
|
||||
|
||||
/// <summary>
|
||||
/// Teleports the agent for the given client to their home destination.
|
||||
/// </summary>
|
||||
/// <param name='id'></param>
|
||||
/// <param name='client'></param>
|
||||
void TeleportHome(UUID id, IClientAPI client);
|
||||
|
||||
bool Cross(ScenePresence agent, bool isFlying);
|
||||
|
|
|
@ -1336,6 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
PhysicsActor actor = PhysicsActor;
|
||||
if (actor == null)
|
||||
{
|
||||
SendControlsToScripts(flagsForScripts);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1512,15 +1513,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (update_movementflag && ParentID == 0)
|
||||
Animator.UpdateMovementAnimations();
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (scriptedcontrols.Count > 0)
|
||||
{
|
||||
// Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
|
||||
// (e.g., a walking script) checks which animation is active it will be the correct animation.
|
||||
SendControlToScripts(flagsForScripts);
|
||||
}
|
||||
}
|
||||
SendControlsToScripts(flagsForScripts);
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
@ -3681,77 +3674,92 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
internal void SendControlToScripts(uint flags)
|
||||
private void SendControlsToScripts(uint flags)
|
||||
{
|
||||
ScriptControlled allflags = ScriptControlled.CONTROL_ZERO;
|
||||
|
||||
if (MouseDown)
|
||||
// Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
|
||||
// (e.g., a walking script) checks which animation is active it will be the correct animation.
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON);
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0)
|
||||
if (scriptedcontrols.Count <= 0)
|
||||
return;
|
||||
|
||||
ScriptControlled allflags = ScriptControlled.CONTROL_ZERO;
|
||||
|
||||
if (MouseDown)
|
||||
{
|
||||
allflags = ScriptControlled.CONTROL_ZERO;
|
||||
allflags = LastCommands & (ScriptControlled.CONTROL_ML_LBUTTON | ScriptControlled.CONTROL_LBUTTON);
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & unchecked((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_UP)) != 0)
|
||||
{
|
||||
allflags = ScriptControlled.CONTROL_ZERO;
|
||||
MouseDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ML_LBUTTON;
|
||||
MouseDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_LBUTTON;
|
||||
MouseDown = true;
|
||||
}
|
||||
|
||||
// find all activated controls, whether the scripts are interested in them or not
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_FWD;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_BACK;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_UP;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_DOWN;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ML_LBUTTON;
|
||||
MouseDown = true;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_LBUTTON;
|
||||
MouseDown = true;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_LEFT;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_RIGHT;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
|
||||
}
|
||||
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ROT_LEFT;
|
||||
}
|
||||
|
||||
// find all activated controls, whether the scripts are interested in them or not
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_FWD;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_BACK;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_UP;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_DOWN;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_LEFT;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_RIGHT;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
|
||||
}
|
||||
if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
|
||||
{
|
||||
allflags |= ScriptControlled.CONTROL_ROT_LEFT;
|
||||
}
|
||||
// optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
|
||||
if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
|
||||
{
|
||||
lock (scriptedcontrols)
|
||||
// optimization; we have to check per script, but if nothing is pressed and nothing changed, we can skip that
|
||||
if (allflags != ScriptControlled.CONTROL_ZERO || allflags != LastCommands)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, ScriptControllers> kvp in scriptedcontrols)
|
||||
{
|
||||
UUID scriptUUID = kvp.Key;
|
||||
ScriptControllers scriptControlData = kvp.Value;
|
||||
|
||||
|
||||
ScriptControlled localHeld = allflags & scriptControlData.eventControls; // the flags interesting for us
|
||||
ScriptControlled localLast = LastCommands & scriptControlData.eventControls; // the activated controls in the last cycle
|
||||
ScriptControlled localChange = localHeld ^ localLast; // the changed bits
|
||||
|
||||
if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
|
||||
{
|
||||
// only send if still pressed or just changed
|
||||
|
@ -3759,9 +3767,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
LastCommands = allflags;
|
||||
}
|
||||
|
||||
LastCommands = allflags;
|
||||
}
|
||||
|
||||
internal static AgentManager.ControlFlags RemoveIgnoredControls(AgentManager.ControlFlags flags, ScriptControlled ignored)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
|
@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
Vector3 position = new Vector3(200,200,21);
|
||||
|
||||
foreach (Border b in testborders)
|
||||
{
|
||||
Assert.That(!b.TestCross(position));
|
||||
|
||||
}
|
||||
|
||||
position = new Vector3(200,280,21);
|
||||
Assert.That(NorthBorder.TestCross(position));
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
@ -44,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
public void TestDuplicateObject()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
|
||||
|
@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
Assert.That(dupePart1.PhysActor, Is.Not.Null);
|
||||
Assert.That(dupePart2.PhysActor, Is.Not.Null);
|
||||
*/
|
||||
|
||||
// TestHelpers.DisableLogging();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,7 +38,8 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
|
|
|
@ -1734,6 +1734,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
rgb.y = texcolor.G;
|
||||
rgb.z = texcolor.B;
|
||||
return rgb;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3192,6 +3193,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return m_host.UUID.ToString();
|
||||
}
|
||||
|
||||
public LSL_Key llGenerateKey()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return UUID.Random().ToString();
|
||||
}
|
||||
|
||||
public void llSetBuoyancy(double buoyancy)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
|
|
@ -105,6 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_Integer llFloor(double f);
|
||||
void llForceMouselook(int mouselook);
|
||||
LSL_Float llFrand(double mag);
|
||||
LSL_Key llGenerateKey();
|
||||
LSL_Vector llGetAccel();
|
||||
LSL_Integer llGetAgentInfo(string id);
|
||||
LSL_String llGetAgentLanguage(string id);
|
||||
|
|
|
@ -369,6 +369,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_LSL_Functions.llFrand(mag);
|
||||
}
|
||||
|
||||
public LSL_Key llGenerateKey()
|
||||
{
|
||||
return m_LSL_Functions.llGenerateKey();
|
||||
}
|
||||
|
||||
public LSL_Vector llGetAccel()
|
||||
{
|
||||
return m_LSL_Functions.llGetAccel();
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -34,6 +36,37 @@ namespace OpenSim.Tests.Common
|
|||
{
|
||||
public class TestHelpers
|
||||
{
|
||||
private static Stream EnableLoggingConfigStream
|
||||
= new MemoryStream(
|
||||
Encoding.UTF8.GetBytes(
|
||||
@"<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name=""A1"" type=""log4net.Appender.ConsoleAppender"">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type=""log4net.Layout.PatternLayout"">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value=""%date [%thread] %-5level %logger %ndc - %message%newline"" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value=""DEBUG"" />
|
||||
<appender-ref ref=""A1"" />
|
||||
</root>
|
||||
</log4net>"));
|
||||
|
||||
private static Stream DisableLoggingConfigStream
|
||||
= new MemoryStream(
|
||||
Encoding.UTF8.GetBytes(
|
||||
// "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>")));
|
||||
//"<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>")));
|
||||
//"<configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>")));
|
||||
//"<configuration><log4net><root></root></log4net></configuration>")));
|
||||
//"<configuration><log4net><root/></log4net></configuration>")));
|
||||
"<log4net><root/></log4net>"));
|
||||
|
||||
public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)
|
||||
{
|
||||
try
|
||||
|
@ -58,6 +91,19 @@ namespace OpenSim.Tests.Common
|
|||
Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name);
|
||||
}
|
||||
|
||||
public static void EnableLogging()
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable logging whilst running the tests.
|
||||
/// </summary>
|
||||
public static void DisableLogging()
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse tail section into full UUID.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
|
||||
</configSections>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
|
||||
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
|
||||
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<log4net>
|
||||
<!-- A1 is set to be a ConsoleAppender -->
|
||||
<appender name="A1" type="log4net.Appender.ConsoleAppender">
|
||||
|
||||
<!-- A1 uses PatternLayout -->
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<!-- Print the date in ISO 8601 format -->
|
||||
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Set root logger level to DEBUG and its only appender to A1 -->
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="A1" />
|
||||
</root>
|
||||
</log4net>
|
||||
</configuration>
|
Loading…
Reference in New Issue