Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
fc4dc7708d
|
@ -2,13 +2,37 @@
|
|||
<!-- please leave the top comment for us emacs folks -->
|
||||
<property name="nunitcmd" value="nunit-console" />
|
||||
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<property name="distbindir" value="distbin" />
|
||||
<target name="distbin">
|
||||
<!-- This target produces a source distribution of OpenSimulator -->
|
||||
<!-- TODO: A few parameters still need to be tweaked after running this - need to do this automatically with sed or similar -->
|
||||
<target name="distsrc">
|
||||
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
|
||||
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
|
||||
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
|
||||
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
|
||||
<delete>
|
||||
<fileset basedir="OpenSim">
|
||||
<include name="**/*.build"/>
|
||||
<include name="**/*.csproj*"/>
|
||||
<include name="**/*.dll.build"/>
|
||||
<include name="**/*.pidb"/>
|
||||
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
|
||||
<exclude name="Tools/Robust.32BitLaunch/**"/>
|
||||
<exclude name="Tools/LaunchSLClient/**"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete>
|
||||
<fileset>
|
||||
<include name="OpenSim.build"/>
|
||||
<include name="OpenSim.sln"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<property name="distbindir" value="distbin" />
|
||||
<!-- This target produces a binary directory called distbin/ in OpenSim/bin which contains everything needed for binary distribution -->
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<target name="distbin">
|
||||
<delete dir="${distbindir}"/>
|
||||
<copy todir="${distbindir}">
|
||||
<fileset>
|
||||
|
|
|
@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(Guid principalID)
|
||||
{
|
||||
return GetFriends(principalID.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
try
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection))
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ VALUES
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)";
|
||||
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
|
@ -1215,6 +1215,8 @@ VALUES
|
|||
//Store new values
|
||||
StoreNewRegionSettings(regionSettings);
|
||||
|
||||
LoadSpawnPoints(regionSettings);
|
||||
|
||||
return regionSettings;
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1254,7 @@ VALUES
|
|||
,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
|
||||
,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
|
||||
,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
|
||||
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
|
||||
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID
|
||||
WHERE [regionUUID] = @regionUUID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
|
@ -1263,6 +1265,7 @@ VALUES
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
SaveSpawnPoints(regionSettings);
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
|
@ -1367,7 +1370,7 @@ VALUES
|
|||
newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
|
||||
newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
|
||||
newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
|
||||
newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
|
||||
newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]);
|
||||
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
|
||||
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
||||
newSettings.SunVector = new Vector3(
|
||||
|
@ -1383,6 +1386,11 @@ VALUES
|
|||
newSettings.LoadedCreationID = "";
|
||||
else
|
||||
newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
|
||||
|
||||
newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
|
||||
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
|
||||
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
|
@ -1454,6 +1462,13 @@ VALUES
|
|||
}
|
||||
|
||||
newData.ParcelAccessList = new List<LandAccessEntry>();
|
||||
newData.MediaDescription = (string)row["MediaDescription"];
|
||||
newData.MediaType = (string)row["MediaType"];
|
||||
newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
|
||||
newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
|
||||
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
|
||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
@ -1468,7 +1483,7 @@ VALUES
|
|||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = new UUID((Guid)row["AccessUUID"]);
|
||||
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
|
||||
entry.Expires = 0;
|
||||
entry.Expires = Convert.ToInt32(row["Expires"]);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1512,8 @@ VALUES
|
|||
prim.TouchName = (string)primRow["TouchName"];
|
||||
// permissions
|
||||
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
|
||||
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
|
||||
//prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
|
||||
prim.CreatorIdentification = (string)primRow["CreatorID"];
|
||||
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
||||
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
||||
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
||||
|
@ -1691,7 +1707,8 @@ VALUES
|
|||
taskItem.Name = (string)inventoryRow["name"];
|
||||
taskItem.Description = (string)inventoryRow["description"];
|
||||
taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
|
||||
taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
|
||||
//taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
|
||||
taskItem.CreatorIdentification = (string)inventoryRow["creatorID"];
|
||||
taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
|
||||
taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
|
||||
taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
|
||||
|
@ -1782,7 +1799,7 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
|
||||
parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
|
||||
parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
|
||||
parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox));
|
||||
parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox));
|
||||
parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
|
||||
parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
|
||||
parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
|
||||
|
@ -1792,6 +1809,9 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
|
||||
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
|
||||
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
|
||||
parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
|
||||
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
|
||||
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
@ -1859,6 +1879,7 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
|
||||
parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
|
||||
parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
|
||||
parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
@ -2063,5 +2084,57 @@ VALUES
|
|||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
private void LoadSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
rs.ClearSpawnPoints();
|
||||
|
||||
string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString()));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
|
||||
sp.Yaw = (float)reader["Yaw"];
|
||||
sp.Pitch = (float)reader["Pitch"];
|
||||
sp.Distance = (float)reader["Distance"];
|
||||
|
||||
rs.AddSpawnPoint(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
foreach (SpawnPoint p in rs.SpawnPoints())
|
||||
{
|
||||
sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
|
|||
|
||||
COMMIT
|
||||
|
||||
:VERSION 29 #---------------------
|
||||
:VERSION 29 #----------------- Region Covenant changed time
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
|
||||
EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 31 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims ADD CreatorID varchar(255)
|
||||
ALTER TABLE primitems ADD CreatorID varchar(255)
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 32 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
|
||||
UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 33 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims
|
||||
ADD CONSTRAINT DF_prims_CreatorIDNew
|
||||
DEFAULT '00000000-0000-0000-0000-000000000000'
|
||||
FOR CreatorID
|
||||
|
||||
ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL
|
||||
|
||||
ALTER TABLE primitems
|
||||
ADD CONSTRAINT DF_primitems_CreatorIDNew
|
||||
DEFAULT '00000000-0000-0000-0000-000000000000'
|
||||
FOR CreatorID
|
||||
|
||||
ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 34 #--------------- Telehub support
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [dbo].[Spawn_Points](
|
||||
[RegionUUID] [uniqueidentifier] NOT NULL,
|
||||
[Yaw] [float] NOT NULL,
|
||||
[Pitch] [float] NOT NULL,
|
||||
[Distance] [float] NOT NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[RegionUUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 35 #---------------- Parcels for sale
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 36 #---------------- Timed bans/access
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT
|
||||
|
||||
|
|
|
@ -1315,7 +1315,7 @@ namespace OpenSim.Data.MySQL
|
|||
newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
|
||||
newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
|
||||
newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
|
||||
newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
|
||||
newSettings.Sandbox = Convert.ToBoolean(row["Sandbox"]);
|
||||
newSettings.SunVector = new Vector3 (
|
||||
Convert.ToSingle(row["sunvectorx"]),
|
||||
Convert.ToSingle(row["sunvectory"]),
|
||||
|
|
|
@ -0,0 +1,500 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Data.MySQL
|
||||
{
|
||||
public class MySQLXAssetData : AssetDataBase
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
get { return GetType().Assembly; }
|
||||
}
|
||||
|
||||
private bool m_enableCompression = false;
|
||||
private string m_connectionString;
|
||||
private object m_dbLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
|
||||
/// </summary>
|
||||
private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
|
||||
|
||||
#region IPlugin Members
|
||||
|
||||
public override string Version { get { return "1.0.0.0"; } }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Initialises Asset interface</para>
|
||||
/// <para>
|
||||
/// <list type="bullet">
|
||||
/// <item>Loads and initialises the MySQL storage plugin.</item>
|
||||
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
|
||||
/// <item>Check for migration</item>
|
||||
/// </list>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="connect">connect string</param>
|
||||
public override void Initialise(string connect)
|
||||
{
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: THIS PLUGIN IS STRICTLY EXPERIMENTAL.");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: DO NOT USE FOR ANY DATA THAT YOU DO NOT MIND LOSING.");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: DATABASE TABLES CAN CHANGE AT ANY TIME, CAUSING EXISTING DATA TO BE LOST.");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
|
||||
|
||||
m_connectionString = connect;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
|
||||
m.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialise()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Dispose() { }
|
||||
|
||||
/// <summary>
|
||||
/// The name of this DB provider
|
||||
/// </summary>
|
||||
override public string Name
|
||||
{
|
||||
get { return "MySQL XAsset storage engine"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IAssetDataPlugin Members
|
||||
|
||||
/// <summary>
|
||||
/// Fetch Asset <paramref name="assetID"/> from database
|
||||
/// </summary>
|
||||
/// <param name="assetID">Asset UUID to fetch</param>
|
||||
/// <returns>Return the asset</returns>
|
||||
/// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
|
||||
override public AssetBase GetAsset(UUID assetID)
|
||||
{
|
||||
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
|
||||
|
||||
AssetBase asset = null;
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"SELECT name, description, asset_type, local, temporary, asset_flags, creator_id, data FROM xassetsmeta JOIN xassetsdata ON xassetsmeta.hash = xassetsdata.hash WHERE id=?id",
|
||||
dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", assetID.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["asset_type"], dbReader["creator_id"].ToString());
|
||||
asset.Data = (byte[])dbReader["data"];
|
||||
asset.Description = (string)dbReader["description"];
|
||||
|
||||
string local = dbReader["local"].ToString();
|
||||
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
|
||||
asset.Local = true;
|
||||
else
|
||||
asset.Local = false;
|
||||
|
||||
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
|
||||
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
|
||||
if (m_enableCompression)
|
||||
{
|
||||
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
|
||||
{
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue);
|
||||
// int compressedLength = asset.Data.Length;
|
||||
asset.Data = outputStream.ToArray();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
|
||||
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset " + assetID + ": " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an asset in database, or update it if existing.
|
||||
/// </summary>
|
||||
/// <param name="asset">Asset UUID to create</param>
|
||||
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlTransaction transaction = dbcon.BeginTransaction())
|
||||
{
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[XASSET 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("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
if (m_enableCompression)
|
||||
{
|
||||
MemoryStream outputStream = new MemoryStream();
|
||||
|
||||
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
|
||||
{
|
||||
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
|
||||
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
|
||||
compressionStream.Close();
|
||||
byte[] compressedData = outputStream.ToArray();
|
||||
asset.Data = compressedData;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] hash = hasher.ComputeHash(asset.Data);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
|
||||
// asset.ID, asset.Name, hash, compressedData.Length);
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" +
|
||||
"VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)",
|
||||
dbcon))
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?hash", hash);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?asset_type", 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("?creator_id", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset metadata {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ExistsData(dbcon, transaction, hash))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"INSERT INTO xassetsdata(hash, data) VALUES(?hash, ?data)",
|
||||
dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?hash", hash);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[XASSET DB]: MySQL failure creating asset data {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
|
||||
transaction.Rollback();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private void UpdateAccessTime(AssetBase asset)
|
||||
// {
|
||||
// lock (m_dbLock)
|
||||
// {
|
||||
// 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 (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();
|
||||
// cmd.Dispose();
|
||||
// }
|
||||
// }
|
||||
// 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>
|
||||
/// We assume we already have the m_dbLock.
|
||||
/// </summary>
|
||||
/// TODO: need to actually use the transaction.
|
||||
/// <param name="dbcon"></param>
|
||||
/// <param name="transaction"></param>
|
||||
/// <param name="hash"></param>
|
||||
/// <returns></returns>
|
||||
private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, byte[] hash)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
|
||||
bool exists = false;
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("SELECT hash FROM xassetsdata WHERE hash=?hash", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?hash", hash);
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[XASSETS DB]: MySql failure in ExistsData fetching hash {0}. Exception {1}{2}",
|
||||
hash, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the asset exists in the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>true if it exists, false otherwise.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
|
||||
bool assetExists = false;
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM xassetsmeta WHERE id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", uuid.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
assetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[XASSETS DB]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString(), uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assetExists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of AssetMetadata objects. The list is a subset of
|
||||
/// the entire data set offset by <paramref name="start" /> containing
|
||||
/// <paramref name="count" /> elements.
|
||||
/// </summary>
|
||||
/// <param name="start">The number of results to discard from the total data set.</param>
|
||||
/// <param name="count">The number of rows the returned list should contain.</param>
|
||||
/// <returns>A list of AssetMetadata objects.</returns>
|
||||
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
||||
{
|
||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT name,description,asset_type,temporary,id,asset_flags,creator_id FROM xassetsmeta LIMIT ?start, ?count", dbcon);
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
while (dbReader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["asset_type"];
|
||||
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["creator_id"].ToString();
|
||||
|
||||
// We'll ignore this for now - it appears unused!
|
||||
// metadata.SHA1 = dbReader["hash"]);
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retList;
|
||||
}
|
||||
|
||||
public override bool Delete(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id);
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
|
||||
// keep a reference count (?)
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
# -----------------
|
||||
:VERSION 1
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `xassetsmeta` (
|
||||
`id` char(36) NOT NULL,
|
||||
`hash` binary(32) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`description` varchar(64) NOT NULL,
|
||||
`asset_type` tinyint(4) NOT NULL,
|
||||
`local` tinyint(1) NOT NULL,
|
||||
`temporary` tinyint(1) NOT NULL,
|
||||
`create_time` int(11) NOT NULL,
|
||||
`access_time` int(11) NOT NULL,
|
||||
`asset_flags` int(11) NOT NULL,
|
||||
`creator_id` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
|
||||
|
||||
CREATE TABLE `xassetsdata` (
|
||||
`hash` binary(32) NOT NULL,
|
||||
`data` longblob NOT NULL,
|
||||
PRIMARY KEY (`hash`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
|
||||
|
||||
COMMIT;
|
|
@ -2157,7 +2157,7 @@ namespace OpenSim.Data.SQLite
|
|||
row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
|
||||
row["terrain_lower_limit"] = settings.TerrainLowerLimit;
|
||||
row["use_estate_sun"] = settings.UseEstateSun;
|
||||
row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox
|
||||
row["sandbox"] = settings.Sandbox; // unlike other database modules, sqlite uses a lower case s for sandbox!
|
||||
row["sunvectorx"] = settings.SunVector.X;
|
||||
row["sunvectory"] = settings.SunVector.Y;
|
||||
row["sunvectorz"] = settings.SunVector.Z;
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
@ -40,6 +41,8 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
public class Commands : ICommands
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Encapsulates a command that can be invoked from the console
|
||||
/// </summary>
|
||||
|
@ -76,12 +79,19 @@ namespace OpenSim.Framework.Console
|
|||
public List<CommandDelegate> fn;
|
||||
}
|
||||
|
||||
public const string GeneralHelpText = "For more information, type 'help <item>' where <item> is one of the following categories:";
|
||||
|
||||
/// <value>
|
||||
/// Commands organized by keyword in a tree
|
||||
/// </value>
|
||||
private Dictionary<string, object> tree =
|
||||
new Dictionary<string, object>();
|
||||
|
||||
/// <summary>
|
||||
/// Commands organized by module
|
||||
/// </summary>
|
||||
private Dictionary<string, List<CommandInfo>> m_modulesCommands = new Dictionary<string, List<CommandInfo>>();
|
||||
|
||||
/// <summary>
|
||||
/// Get help for the given help string
|
||||
/// </summary>
|
||||
|
@ -98,8 +108,8 @@ namespace OpenSim.Framework.Console
|
|||
// General help
|
||||
if (helpParts.Count == 0)
|
||||
{
|
||||
help.AddRange(CollectHelp(tree));
|
||||
help.Sort();
|
||||
help.Add(GeneralHelpText);
|
||||
help.AddRange(CollectModulesHelp(tree));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -118,6 +128,13 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
string originalHelpRequest = string.Join(" ", helpParts.ToArray());
|
||||
List<string> help = new List<string>();
|
||||
|
||||
// Check modules first to see if we just need to display a list of those commands
|
||||
if (TryCollectModuleHelp(originalHelpRequest, help))
|
||||
{
|
||||
help.Insert(0, GeneralHelpText);
|
||||
return help;
|
||||
}
|
||||
|
||||
Dictionary<string, object> dict = tree;
|
||||
while (helpParts.Count > 0)
|
||||
|
@ -161,25 +178,61 @@ namespace OpenSim.Framework.Console
|
|||
return help;
|
||||
}
|
||||
|
||||
private List<string> CollectHelp(Dictionary<string, object> dict)
|
||||
/// <summary>
|
||||
/// Try to collect help for the given module if that module exists.
|
||||
/// </summary>
|
||||
/// <param name="moduleName"></param>
|
||||
/// <param name="helpText">/param>
|
||||
/// <returns>true if there was the module existed, false otherwise.</returns>
|
||||
private bool TryCollectModuleHelp(string moduleName, List<string> helpText)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
|
||||
foreach (KeyValuePair<string, object> kvp in dict)
|
||||
lock (m_modulesCommands)
|
||||
{
|
||||
if (kvp.Value is Dictionary<string, Object>)
|
||||
if (m_modulesCommands.ContainsKey(moduleName))
|
||||
{
|
||||
result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value));
|
||||
List<CommandInfo> commands = m_modulesCommands[moduleName];
|
||||
var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
|
||||
ourHelpText.Sort();
|
||||
helpText.AddRange(ourHelpText);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((CommandInfo)kvp.Value).long_help != String.Empty)
|
||||
result.Add(((CommandInfo)kvp.Value).help_text+" - "+
|
||||
((CommandInfo)kvp.Value).long_help);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<string> CollectModulesHelp(Dictionary<string, object> dict)
|
||||
{
|
||||
lock (m_modulesCommands)
|
||||
{
|
||||
List<string> helpText = new List<string>(m_modulesCommands.Keys);
|
||||
helpText.Sort();
|
||||
return helpText;
|
||||
}
|
||||
}
|
||||
|
||||
// private List<string> CollectHelp(Dictionary<string, object> dict)
|
||||
// {
|
||||
// List<string> result = new List<string>();
|
||||
//
|
||||
// foreach (KeyValuePair<string, object> kvp in dict)
|
||||
// {
|
||||
// if (kvp.Value is Dictionary<string, Object>)
|
||||
// {
|
||||
// result.AddRange(CollectHelp((Dictionary<string, Object>)kvp.Value));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (((CommandInfo)kvp.Value).long_help != String.Empty)
|
||||
// result.Add(((CommandInfo)kvp.Value).help_text+" - "+
|
||||
// ((CommandInfo)kvp.Value).long_help);
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Add a command to those which can be invoked from the console.
|
||||
|
@ -212,21 +265,19 @@ namespace OpenSim.Framework.Console
|
|||
|
||||
Dictionary<string, Object> current = tree;
|
||||
|
||||
foreach (string s in parts)
|
||||
foreach (string part in parts)
|
||||
{
|
||||
if (current.ContainsKey(s))
|
||||
if (current.ContainsKey(part))
|
||||
{
|
||||
if (current[s] is Dictionary<string, Object>)
|
||||
{
|
||||
current = (Dictionary<string, Object>)current[s];
|
||||
}
|
||||
if (current[part] is Dictionary<string, Object>)
|
||||
current = (Dictionary<string, Object>)current[part];
|
||||
else
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
current[s] = new Dictionary<string, Object>();
|
||||
current = (Dictionary<string, Object>)current[s];
|
||||
current[part] = new Dictionary<string, Object>();
|
||||
current = (Dictionary<string, Object>)current[part];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,6 +301,24 @@ namespace OpenSim.Framework.Console
|
|||
info.fn = new List<CommandDelegate>();
|
||||
info.fn.Add(fn);
|
||||
current[String.Empty] = info;
|
||||
|
||||
// Now add command to modules dictionary
|
||||
lock (m_modulesCommands)
|
||||
{
|
||||
List<CommandInfo> commands;
|
||||
if (m_modulesCommands.ContainsKey(module))
|
||||
{
|
||||
commands = m_modulesCommands[module];
|
||||
}
|
||||
else
|
||||
{
|
||||
commands = new List<CommandInfo>();
|
||||
m_modulesCommands[module] = commands;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[COMMAND CONSOLE]: Adding to category {0} command {1}", module, command);
|
||||
commands.Add(info);
|
||||
}
|
||||
}
|
||||
|
||||
public string[] FindNextOption(string[] cmd, bool term)
|
||||
|
@ -607,8 +676,9 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
Commands = new Commands();
|
||||
|
||||
Commands.AddCommand("console", false, "help", "help [<command>]",
|
||||
"Get general command list or more detailed help on a specific command", Help);
|
||||
Commands.AddCommand(
|
||||
"Help", false, "help", "help [<item>]",
|
||||
"Display help on a particular command or on a list of commands in a category", Help);
|
||||
}
|
||||
|
||||
private void Help(string module, string[] cmd)
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenSim.Framework.Console
|
||||
{
|
||||
|
@ -37,28 +38,42 @@ namespace OpenSim.Framework.Console
|
|||
/// Don't use this except for Unit Testing or you're in for a world of hurt when the
|
||||
/// sim gets to ReadLine
|
||||
/// </summary>
|
||||
public class MockConsole : CommandConsole
|
||||
public class MockConsole : ICommandConsole
|
||||
{
|
||||
public MockConsole(string defaultPrompt) : base(defaultPrompt)
|
||||
{
|
||||
}
|
||||
public override void Output(string text)
|
||||
{
|
||||
}
|
||||
public override void Output(string text, string level)
|
||||
{
|
||||
}
|
||||
private MockCommands m_commands = new MockCommands();
|
||||
|
||||
public override string ReadLine(string p, bool isCommand, bool e)
|
||||
{
|
||||
//Thread.CurrentThread.Join(1000);
|
||||
return string.Empty;
|
||||
}
|
||||
public override void UnlockOutput()
|
||||
{
|
||||
}
|
||||
public override void LockOutput()
|
||||
{
|
||||
}
|
||||
public ICommands Commands { get { return m_commands; } }
|
||||
|
||||
public void Prompt() {}
|
||||
|
||||
public void RunCommand(string cmd) {}
|
||||
|
||||
public string ReadLine(string p, bool isCommand, bool e) { return ""; }
|
||||
|
||||
public object ConsoleScene { get { return null; } }
|
||||
|
||||
public void Output(string text, string level) {}
|
||||
public void Output(string text) {}
|
||||
public void OutputFormat(string format, params object[] components) {}
|
||||
|
||||
public string CmdPrompt(string p) { return ""; }
|
||||
public string CmdPrompt(string p, string def) { return ""; }
|
||||
public string CmdPrompt(string p, List<char> excludedCharacters) { return ""; }
|
||||
public string CmdPrompt(string p, string def, List<char> excludedCharacters) { return ""; }
|
||||
|
||||
public string CmdPrompt(string prompt, string defaultresponse, List<string> options) { return ""; }
|
||||
|
||||
public string PasswdPrompt(string p) { return ""; }
|
||||
}
|
||||
}
|
||||
|
||||
public class MockCommands : ICommands
|
||||
{
|
||||
public void FromXml(XmlElement root, CommandDelegate fn) {}
|
||||
public List<string> GetHelp(string[] cmd) { return null; }
|
||||
public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {}
|
||||
public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {}
|
||||
public string[] FindNextOption(string[] cmd, bool term) { return null; }
|
||||
public string[] Resolve(string[] cmd) { return null; }
|
||||
public XmlElement GetXml(XmlDocument doc) { return null; }
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Get help for the given help string
|
||||
/// </summary>
|
||||
/// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param>
|
||||
/// <param name="cmd">Parsed parts of the help string. If empty then general help is returned.</param>
|
||||
/// <returns></returns>
|
||||
List<string> GetHelp(string[] cmd);
|
||||
|
||||
|
|
|
@ -161,43 +161,43 @@ namespace OpenSim.Framework.Servers
|
|||
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
||||
}
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "quit",
|
||||
m_console.Commands.AddCommand("General", false, "quit",
|
||||
"quit",
|
||||
"Quit the application", HandleQuit);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "shutdown",
|
||||
m_console.Commands.AddCommand("General", false, "shutdown",
|
||||
"shutdown",
|
||||
"Quit the application", HandleQuit);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "set log level",
|
||||
m_console.Commands.AddCommand("General", false, "set log level",
|
||||
"set log level <level>",
|
||||
"Set the console logging level", HandleLogLevel);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show info",
|
||||
m_console.Commands.AddCommand("General", false, "show info",
|
||||
"show info",
|
||||
"Show general information about the server", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show stats",
|
||||
m_console.Commands.AddCommand("General", false, "show stats",
|
||||
"show stats",
|
||||
"Show statistics", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show threads",
|
||||
m_console.Commands.AddCommand("General", false, "show threads",
|
||||
"show threads",
|
||||
"Show thread status", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show uptime",
|
||||
m_console.Commands.AddCommand("General", false, "show uptime",
|
||||
"show uptime",
|
||||
"Show server uptime", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "show version",
|
||||
m_console.Commands.AddCommand("General", false, "show version",
|
||||
"show version",
|
||||
"Show server version", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "threads abort",
|
||||
m_console.Commands.AddCommand("General", false, "threads abort",
|
||||
"threads abort <thread-id>",
|
||||
"Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "threads show",
|
||||
m_console.Commands.AddCommand("General", false, "threads show",
|
||||
"threads show",
|
||||
"Show thread status. Synonym for \"show threads\"",
|
||||
(string module, string[] args) => Notice(GetThreadsReport()));
|
||||
|
@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
|
|||
string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
|
||||
|
||||
sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
String.Format("PollServiceWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
|
@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
"PollServiceWatcherThread",
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.3CM";
|
||||
private const string VERSION_NUMBER = "0.7.4CM";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
|
||||
public enum Flavour
|
||||
|
|
|
@ -72,6 +72,11 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public bool IsTimedOut { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Will this thread trigger the alarm function if it has timed out?
|
||||
/// </summary>
|
||||
public bool AlarmIfTimeout { get; set; }
|
||||
|
||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
||||
{
|
||||
Thread = thread;
|
||||
|
@ -112,12 +117,13 @@ namespace OpenSim.Framework
|
|||
/// <param name="start">The method that will be executed in a new thread</param>
|
||||
/// <param name="name">A name to give to the new thread</param>
|
||||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
||||
{
|
||||
return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS);
|
||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -128,21 +134,21 @@ namespace OpenSim.Framework
|
|||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="timeout">
|
||||
/// Number of milliseconds to wait until we issue a warning about timeout.
|
||||
/// </para>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout)
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
|
||||
{
|
||||
Thread thread = new Thread(start);
|
||||
thread.Name = name;
|
||||
thread.Priority = priority;
|
||||
thread.IsBackground = isBackground;
|
||||
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout);
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
|
||||
|
||||
m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")");
|
||||
m_log.DebugFormat(
|
||||
"[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||
|
||||
lock (m_threads)
|
||||
m_threads.Add(twi.Thread.ManagedThreadId, twi);
|
||||
|
@ -224,19 +230,39 @@ namespace OpenSim.Framework
|
|||
/// Get currently watched threads for diagnostic purposes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ThreadWatchdogInfo[] GetThreads()
|
||||
public static ThreadWatchdogInfo[] GetThreadsInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
return m_threads.Values.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the current thread's watchdog info.
|
||||
/// </summary>
|
||||
/// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
|
||||
public static ThreadWatchdogInfo GetCurrentThreadInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
{
|
||||
if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
|
||||
return m_threads[Thread.CurrentThread.ManagedThreadId];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check watched threads. Fire alarm if appropriate.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
WatchdogTimeout callback = OnWatchdogTimeout;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
ThreadWatchdogInfo timedOut = null;
|
||||
List<ThreadWatchdogInfo> callbackInfos = null;
|
||||
|
||||
lock (m_threads)
|
||||
{
|
||||
|
@ -246,21 +272,31 @@ namespace OpenSim.Framework
|
|||
{
|
||||
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
||||
{
|
||||
timedOut = threadInfo;
|
||||
RemoveThread(threadInfo.Thread.ManagedThreadId);
|
||||
break;
|
||||
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
|
||||
{
|
||||
threadInfo.IsTimedOut = true;
|
||||
timedOut = threadInfo;
|
||||
break;
|
||||
|
||||
if (threadInfo.AlarmIfTimeout)
|
||||
{
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timedOut != null)
|
||||
callback(timedOut.Thread, timedOut.LastTick);
|
||||
if (callbackInfos != null)
|
||||
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
|
||||
callback(callbackInfo.Thread, callbackInfo.LastTick);
|
||||
}
|
||||
|
||||
m_watchdogTimer.Start();
|
||||
|
|
|
@ -63,77 +63,7 @@ namespace OpenSim.Framework
|
|||
// a "long" call for warning & debugging purposes
|
||||
public const int LongCallTime = 500;
|
||||
|
||||
// /// <summary>
|
||||
// /// Send LLSD to an HTTP client in application/llsd+json form
|
||||
// /// </summary>
|
||||
// /// <param name="response">HTTP response to send the data in</param>
|
||||
// /// <param name="body">LLSD to send to the client</param>
|
||||
// public static void SendJSONResponse(OSHttpResponse response, OSDMap body)
|
||||
// {
|
||||
// byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body));
|
||||
//
|
||||
// response.ContentEncoding = Encoding.UTF8;
|
||||
// response.ContentLength = responseData.Length;
|
||||
// response.ContentType = "application/llsd+json";
|
||||
// response.Body.Write(responseData, 0, responseData.Length);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Send LLSD to an HTTP client in application/llsd+xml form
|
||||
// /// </summary>
|
||||
// /// <param name="response">HTTP response to send the data in</param>
|
||||
// /// <param name="body">LLSD to send to the client</param>
|
||||
// public static void SendXMLResponse(OSHttpResponse response, OSDMap body)
|
||||
// {
|
||||
// byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body);
|
||||
//
|
||||
// response.ContentEncoding = Encoding.UTF8;
|
||||
// response.ContentLength = responseData.Length;
|
||||
// response.ContentType = "application/llsd+xml";
|
||||
// response.Body.Write(responseData, 0, responseData.Length);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Make a GET or GET-like request to a web service that returns LLSD
|
||||
/// or JSON data
|
||||
/// </summary>
|
||||
public static OSDMap ServiceRequest(string url, string httpVerb)
|
||||
{
|
||||
string errorMessage;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
request.Method = httpVerb;
|
||||
|
||||
using (WebResponse response = request.GetResponse())
|
||||
{
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
try
|
||||
{
|
||||
string responseStr = responseStream.GetStreamString();
|
||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||
if (responseOSD.Type == OSDType.Map)
|
||||
return (OSDMap)responseOSD;
|
||||
else
|
||||
errorMessage = "Response format was invalid.";
|
||||
}
|
||||
catch
|
||||
{
|
||||
errorMessage = "Failed to parse the response.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message);
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
||||
return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } };
|
||||
}
|
||||
#region JSONRequest
|
||||
|
||||
/// <summary>
|
||||
/// PUT JSON-encoded data to a web service that returns LLSD or
|
||||
|
@ -304,6 +234,10 @@ namespace OpenSim.Framework
|
|||
return result;
|
||||
}
|
||||
|
||||
#endregion JSONRequest
|
||||
|
||||
#region FormRequest
|
||||
|
||||
/// <summary>
|
||||
/// POST URL-encoded form data to a web service that returns LLSD or
|
||||
/// JSON data
|
||||
|
@ -398,6 +332,8 @@ namespace OpenSim.Framework
|
|||
result["Message"] = OSD.FromString("Service request failed: " + msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion FormRequest
|
||||
|
||||
#region Uri
|
||||
|
||||
|
|
|
@ -225,12 +225,12 @@ namespace OpenSim
|
|||
/// </summary>
|
||||
private void RegisterConsoleCommands()
|
||||
{
|
||||
m_console.Commands.AddCommand("region", false, "force update",
|
||||
m_console.Commands.AddCommand("Regions", false, "force update",
|
||||
"force update",
|
||||
"Force the update of all objects on clients",
|
||||
HandleForceUpdate);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "debug packet",
|
||||
m_console.Commands.AddCommand("Comms", false, "debug packet",
|
||||
"debug packet <level> [<avatar-first-name> <avatar-last-name>]",
|
||||
"Turn on packet debugging",
|
||||
"If level > 255 then all incoming and outgoing packets are logged.\n"
|
||||
|
@ -242,7 +242,7 @@ namespace OpenSim
|
|||
+ "If an avatar name is given then only packets from that avatar are logged",
|
||||
Debug);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "debug http",
|
||||
m_console.Commands.AddCommand("Comms", false, "debug http",
|
||||
"debug http <level>",
|
||||
"Turn on inbound http request debugging for everything except the event queue (see debug eq).",
|
||||
"If level >= 2 then the handler used to service the request is logged.\n"
|
||||
|
@ -250,37 +250,37 @@ namespace OpenSim
|
|||
+ "If level <= 0 then no extra http logging is done.\n",
|
||||
Debug);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
|
||||
m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "debug scene",
|
||||
m_console.Commands.AddCommand("Regions", false, "debug scene",
|
||||
"debug scene <scripting> <collisions> <physics>",
|
||||
"Turn on scene debugging", Debug);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "change region",
|
||||
m_console.Commands.AddCommand("General", false, "change region",
|
||||
"change region <region name>",
|
||||
"Change current console region", ChangeSelectedRegion);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save xml",
|
||||
m_console.Commands.AddCommand("Archiving", false, "save xml",
|
||||
"save xml",
|
||||
"Save a region's data in XML format", SaveXml);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save xml2",
|
||||
m_console.Commands.AddCommand("Archiving", false, "save xml2",
|
||||
"save xml2",
|
||||
"Save a region's data in XML2 format", SaveXml2);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "load xml",
|
||||
m_console.Commands.AddCommand("Archiving", false, "load xml",
|
||||
"load xml [-newIDs [<x> <y> <z>]]",
|
||||
"Load a region's data from XML format", LoadXml);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "load xml2",
|
||||
m_console.Commands.AddCommand("Archiving", false, "load xml2",
|
||||
"load xml2",
|
||||
"Load a region's data from XML2 format", LoadXml2);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save prims xml2",
|
||||
m_console.Commands.AddCommand("Archiving", false, "save prims xml2",
|
||||
"save prims xml2 [<prim name> <file name>]",
|
||||
"Save named prim to XML2", SavePrimsXml2);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "load oar",
|
||||
m_console.Commands.AddCommand("Archiving", false, "load oar",
|
||||
"load oar [--merge] [--skip-assets] [<OAR path>]",
|
||||
"Load a region's data from an OAR archive.",
|
||||
"--merge will merge the OAR with the existing scene." + Environment.NewLine
|
||||
|
@ -289,7 +289,7 @@ namespace OpenSim
|
|||
+ " If this is not given then the command looks for an OAR named region.oar in the current directory.",
|
||||
LoadOar);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "save oar",
|
||||
m_console.Commands.AddCommand("Archiving", false, "save oar",
|
||||
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
|
||||
"Save a region's data to an OAR archive.",
|
||||
|
@ -306,54 +306,54 @@ namespace OpenSim
|
|||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||
SaveOar);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "edit scale",
|
||||
m_console.Commands.AddCommand("Regions", false, "edit scale",
|
||||
"edit scale <name> <x> <y> <z>",
|
||||
"Change the scale of a named prim", HandleEditScale);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "kick user",
|
||||
m_console.Commands.AddCommand("Users", false, "kick user",
|
||||
"kick user <first> <last> [message]",
|
||||
"Kick a user off the simulator", KickUserCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show users",
|
||||
m_console.Commands.AddCommand("Users", false, "show users",
|
||||
"show users [full]",
|
||||
"Show user data for users currently on the region",
|
||||
"Without the 'full' option, only users actually on the region are shown."
|
||||
+ " With the 'full' option child agents of users in neighbouring regions are also shown.",
|
||||
HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show connections",
|
||||
m_console.Commands.AddCommand("Comms", false, "show connections",
|
||||
"show connections",
|
||||
"Show connection data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show circuits",
|
||||
m_console.Commands.AddCommand("Comms", false, "show circuits",
|
||||
"show circuits",
|
||||
"Show agent circuit data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show http-handlers",
|
||||
m_console.Commands.AddCommand("Comms", false, "show http-handlers",
|
||||
"show http-handlers",
|
||||
"Show all registered http handlers", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show pending-objects",
|
||||
m_console.Commands.AddCommand("Comms", false, "show pending-objects",
|
||||
"show pending-objects",
|
||||
"Show # of objects on the pending queues of all scene viewers", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show modules",
|
||||
m_console.Commands.AddCommand("General", false, "show modules",
|
||||
"show modules",
|
||||
"Show module data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show regions",
|
||||
m_console.Commands.AddCommand("Regions", false, "show regions",
|
||||
"show regions",
|
||||
"Show region data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "show ratings",
|
||||
m_console.Commands.AddCommand("Regions", false, "show ratings",
|
||||
"show ratings",
|
||||
"Show rating data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "backup",
|
||||
m_console.Commands.AddCommand("Regions", false, "backup",
|
||||
"backup",
|
||||
"Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "create region",
|
||||
m_console.Commands.AddCommand("Regions", false, "create region",
|
||||
"create region [\"region name\"] <region_file.ini>",
|
||||
"Create a new region.",
|
||||
"The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given."
|
||||
|
@ -362,62 +362,57 @@ namespace OpenSim
|
|||
+ "If <region_file.ini> does not exist, it will be created.",
|
||||
HandleCreateRegion);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "restart",
|
||||
m_console.Commands.AddCommand("Regions", false, "restart",
|
||||
"restart",
|
||||
"Restart all sims in this instance", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config set",
|
||||
m_console.Commands.AddCommand("General", false, "config set",
|
||||
"config set <section> <key> <value>",
|
||||
"Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config get",
|
||||
m_console.Commands.AddCommand("General", false, "config get",
|
||||
"config get [<section>] [<key>]",
|
||||
"Synonym for config show",
|
||||
HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config show",
|
||||
m_console.Commands.AddCommand("General", false, "config show",
|
||||
"config show [<section>] [<key>]",
|
||||
"Show config information",
|
||||
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
||||
+ "If a section is given but not a field, then all fields in that section are printed.",
|
||||
HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config save",
|
||||
m_console.Commands.AddCommand("General", false, "config save",
|
||||
"config save <path>",
|
||||
"Save current configuration to a file at the given path", HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "command-script",
|
||||
m_console.Commands.AddCommand("General", false, "command-script",
|
||||
"command-script <script>",
|
||||
"Run a command script from file", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "remove-region",
|
||||
m_console.Commands.AddCommand("Regions", false, "remove-region",
|
||||
"remove-region <name>",
|
||||
"Remove a region from this simulator", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "delete-region",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete-region",
|
||||
"delete-region <name>",
|
||||
"Delete a region from disk", RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "modules list",
|
||||
m_console.Commands.AddCommand("General", false, "modules list",
|
||||
"modules list",
|
||||
"List modules", HandleModules);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "modules load",
|
||||
m_console.Commands.AddCommand("General", false, "modules load",
|
||||
"modules load <name>",
|
||||
"Load a module", HandleModules);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "modules unload",
|
||||
m_console.Commands.AddCommand("General", false, "modules unload",
|
||||
"modules unload <name>",
|
||||
"Unload a module", HandleModules);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "Add-InventoryHost",
|
||||
"Add-InventoryHost <host>",
|
||||
String.Empty, RunCommand);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "kill uuid",
|
||||
m_console.Commands.AddCommand("Regions", false, "kill uuid",
|
||||
"kill uuid <UUID>",
|
||||
"Kill an object by UUID", KillUUID);
|
||||
|
||||
}
|
||||
|
||||
public override void ShutdownSpecific()
|
||||
|
@ -829,14 +824,6 @@ namespace OpenSim
|
|||
case "restart":
|
||||
m_sceneManager.RestartCurrentScene();
|
||||
break;
|
||||
|
||||
case "Add-InventoryHost":
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
MainConsole.Instance.Output("Not implemented.");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -257,15 +257,17 @@ namespace OpenSim
|
|||
|
||||
foreach (string topic in topics)
|
||||
{
|
||||
m_console.Commands.AddCommand("plugin", false, "help " + topic,
|
||||
"help " + topic,
|
||||
string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
|
||||
|
||||
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
|
||||
"help " + capitalizedTopic,
|
||||
"Get help on plugin command '" + topic + "'",
|
||||
HandleCommanderHelp);
|
||||
|
||||
m_console.Commands.AddCommand("plugin", false, topic,
|
||||
topic,
|
||||
"Execute subcommand for plugin '" + topic + "'",
|
||||
null);
|
||||
//
|
||||
// m_console.Commands.AddCommand("General", false, topic,
|
||||
// topic,
|
||||
// "Execute subcommand for plugin '" + topic + "'",
|
||||
// null);
|
||||
|
||||
ICommander commander = null;
|
||||
|
||||
|
@ -282,7 +284,7 @@ namespace OpenSim
|
|||
|
||||
foreach (string command in commander.Commands.Keys)
|
||||
{
|
||||
m_console.Commands.AddCommand(topic, false,
|
||||
m_console.Commands.AddCommand(capitalizedTopic, false,
|
||||
topic + " " + command,
|
||||
topic + " " + commander.Commands[command].ShortHelp(),
|
||||
String.Empty, HandleCommanderCommand);
|
||||
|
@ -301,7 +303,7 @@ namespace OpenSim
|
|||
// Only safe for the interactive console, since it won't
|
||||
// let us come here unless both scene and commander exist
|
||||
//
|
||||
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]);
|
||||
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1].ToLower());
|
||||
if (moduleCommander != null)
|
||||
m_console.Output(moduleCommander.Help);
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
try
|
||||
{
|
||||
m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName);
|
||||
// m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName);
|
||||
//m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param);
|
||||
|
||||
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"event queue",
|
||||
"Comms",
|
||||
false,
|
||||
"debug eq",
|
||||
"debug eq [0|1]",
|
||||
|
|
|
@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
base.Start(m_recvBufferSize, m_asyncPacketHandling);
|
||||
|
||||
// Start the packet processing threads
|
||||
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(
|
||||
IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
Watchdog.StartThread(
|
||||
OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
|
||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,10 +203,10 @@ namespace Flotsam.RegionModules.AssetCache
|
|||
m_CacheDirectoryTierLen = 4;
|
||||
}
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,12 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
m_scene.RegisterModuleInterface<IDialogModule>(this);
|
||||
|
||||
m_scene.AddCommand(
|
||||
this, "alert", "alert <message>",
|
||||
"Users", this, "alert", "alert <message>",
|
||||
"Send an alert to everyone",
|
||||
HandleAlertConsoleCommand);
|
||||
|
||||
m_scene.AddCommand(
|
||||
this, "alert-user", "alert-user <first> <last> <message>",
|
||||
"Users", this, "alert-user", "alert-user <first> <last> <message>",
|
||||
"Send an alert to a user",
|
||||
HandleAlertConsoleCommand);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
||||
|
||||
scene.AddCommand(
|
||||
this, "load iar",
|
||||
"Archiving", this, "load iar",
|
||||
"load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"Load user inventory archive (IAR).",
|
||||
"-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
|
||||
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
HandleLoadInvConsoleCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "save iar",
|
||||
"Archiving", this, "save iar",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"<first> is the user's first name." + Environment.NewLine
|
||||
|
@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
{
|
||||
try
|
||||
{
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
|
@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
if (options.ContainsKey("home"))
|
||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
|
||||
|
||||
|
|
|
@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
|||
string skillsText = String.Empty;
|
||||
string languages = String.Empty;
|
||||
|
||||
Byte[] charterMember = Utils.StringToBytes("Avatar");
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
|
||||
|
||||
string name = "Avatar";
|
||||
int created = 0;
|
||||
if (account != null)
|
||||
{
|
||||
name = account.FirstName + " " + account.LastName;
|
||||
created = account.Created;
|
||||
}
|
||||
Byte[] charterMember = Utils.StringToBytes(name);
|
||||
|
||||
profileUrl = "No profile data";
|
||||
aboutText = string.Empty;
|
||||
|
@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
|||
partner = UUID.Zero;
|
||||
|
||||
remoteClient.SendAvatarProperties(avatarID, aboutText,
|
||||
Util.ToDateTime(0).ToString(
|
||||
Util.ToDateTime(created).ToString(
|
||||
"M/d/yyyy", CultureInfo.InvariantCulture),
|
||||
charterMember, firstLifeAboutText,
|
||||
(uint)(0 & 0xff),
|
||||
|
|
|
@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework
|
|||
{
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
|
||||
MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps",
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps",
|
||||
"show caps",
|
||||
"Shows all registered capabilities", HandleShowCapsCommand);
|
||||
"Shows all registered capabilities for users", HandleShowCapsCommand);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
|
||||
{
|
||||
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
|
||||
m_assMapper.Post(assetID, avatarID, userAssetServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.AddCommand(this, "monitor report",
|
||||
m_scene.AddCommand("General", this, "monitor report",
|
||||
"monitor report",
|
||||
"Returns a variety of statistics about the current region and/or simulator",
|
||||
DebugMonitors);
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
// }
|
||||
// }
|
||||
//}
|
||||
MainConsole.Instance.Commands.AddCommand("grid", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", true,
|
||||
"show names",
|
||||
"show names",
|
||||
"Show the bindings between user UUIDs and user names",
|
||||
|
|
|
@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
if (homeScene.TryGetScenePresence(avatarId,out avatar))
|
||||
{
|
||||
KillAUser ku = new KillAUser(avatar,mod);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
|
||||
#region IWorldComm Members
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_listenerManager.ListenerCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
private int m_maxhandles;
|
||||
private int m_curlisteners;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_listeners)
|
||||
return m_listeners.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public ListenerManager(int maxlisteners, int maxhandles)
|
||||
{
|
||||
m_maxlisteners = maxlisteners;
|
||||
|
|
|
@ -73,14 +73,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
return;
|
||||
}
|
||||
|
||||
string serviceDll = assetConfig.GetString("LocalServiceModule",
|
||||
String.Empty);
|
||||
string serviceDll = assetConfig.GetString("LocalServiceModule", String.Empty);
|
||||
|
||||
if (serviceDll == String.Empty)
|
||||
{
|
||||
m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Loading asset service at {0}", serviceDll);
|
||||
}
|
||||
|
||||
Object[] args = new Object[] { source };
|
||||
m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args);
|
||||
|
|
|
@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static LocalGridServicesConnector m_MainInstance;
|
||||
|
||||
private IGridService m_GridService;
|
||||
private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
|
||||
|
||||
|
@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
public LocalGridServicesConnector(IConfigSource source)
|
||||
{
|
||||
m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
|
||||
m_MainInstance = this;
|
||||
InitialiseService(source);
|
||||
}
|
||||
|
||||
|
@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
if (name == Name)
|
||||
{
|
||||
InitialiseService(source);
|
||||
m_MainInstance = this;
|
||||
m_Enabled = true;
|
||||
m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
|
||||
}
|
||||
|
@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_MainInstance == this)
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours",
|
||||
"show neighbours",
|
||||
"Shows the local regions' neighbours", NeighboursCommand);
|
||||
}
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
|
||||
"show neighbours",
|
||||
"Shows the local regions' neighbours", NeighboursCommand);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
if (m_Enabled)
|
||||
scene.RegisterModuleInterface<IGridService>(this);
|
||||
|
||||
if (m_MainInstance == this)
|
||||
{
|
||||
if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
|
||||
m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
|
||||
else
|
||||
m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
|
||||
}
|
||||
if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
|
||||
m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
|
||||
else
|
||||
m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (m_MainInstance == this)
|
||||
{
|
||||
m_LocalCache[scene.RegionInfo.RegionID].Clear();
|
||||
m_LocalCache.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
m_LocalCache[scene.RegionInfo.RegionID].Clear();
|
||||
m_LocalCache.Remove(scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
|
||||
MainConsole.Instance.Output(caps.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,21 +47,21 @@ namespace OpenSim.Region.CoreModules.World
|
|||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("access", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", true,
|
||||
"login enable",
|
||||
"login enable",
|
||||
"Enable simulator logins",
|
||||
String.Empty,
|
||||
HandleLoginCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("access", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", true,
|
||||
"login disable",
|
||||
"login disable",
|
||||
"Disable simulator logins",
|
||||
String.Empty,
|
||||
HandleLoginCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("access", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", true,
|
||||
"login status",
|
||||
"login status",
|
||||
"Show login status",
|
||||
|
|
|
@ -62,58 +62,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
{
|
||||
m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
|
||||
|
||||
m_module.Scene.AddCommand(m_module, "set terrain texture",
|
||||
m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
|
||||
"set terrain texture <number> <uuid> [<x>] [<y>]",
|
||||
"Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
|
||||
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
|
||||
" that coordinate.",
|
||||
consoleSetTerrainTexture);
|
||||
|
||||
m_module.Scene.AddCommand(m_module, "set terrain heights",
|
||||
m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
|
||||
"set terrain heights <corner> <min> <max> [<x>] [<y>]",
|
||||
"Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
|
||||
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
|
||||
" that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
|
||||
consoleSetTerrainHeights);
|
||||
|
||||
Command showCommand
|
||||
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
|
||||
consoleSetTerrainHeights);
|
||||
|
||||
m_commander.RegisterCommand("show", showCommand);
|
||||
|
||||
m_module.Scene.RegisterModuleCommander(m_commander);
|
||||
|
||||
m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
||||
m_module.Scene.AddCommand(
|
||||
"Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
|
||||
m_module.Scene.UnregisterModuleCommander(m_commander.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes commandline input. Do not call directly.
|
||||
/// </summary>
|
||||
/// <param name="args">Commandline arguments</param>
|
||||
protected void EventManagerOnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "estate")
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
tmpArgs[i - 2] = args[i];
|
||||
|
||||
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
}
|
||||
}
|
||||
public void Close() {}
|
||||
|
||||
protected void consoleSetTerrainTexture(string module, string[] args)
|
||||
{
|
||||
|
@ -201,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
}
|
||||
}
|
||||
|
||||
protected void ShowEstatesCommand(Object[] args)
|
||||
protected void ShowEstatesCommand(string module, string[] cmd)
|
||||
{
|
||||
StringBuilder report = new StringBuilder();
|
||||
RegionInfo ri = m_module.Scene.RegionInfo;
|
||||
|
|
|
@ -78,45 +78,45 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
|||
m_scene = scene;
|
||||
m_console = MainConsole.Instance;
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "delete object owner",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete object owner",
|
||||
"delete object owner <UUID>",
|
||||
"Delete a scene object by owner", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object creator",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete object creator",
|
||||
"delete object creator <UUID>",
|
||||
"Delete a scene object by creator", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object uuid",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete object uuid",
|
||||
"delete object uuid <UUID>",
|
||||
"Delete a scene object by uuid", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object name",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete object name",
|
||||
"delete object name <name>",
|
||||
"Delete a scene object by name", HandleDeleteObject);
|
||||
m_console.Commands.AddCommand("region", false, "delete object outside",
|
||||
m_console.Commands.AddCommand("Regions", false, "delete object outside",
|
||||
"delete object outside",
|
||||
"Delete all scene objects outside region boundaries", HandleDeleteObject);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
"Regions",
|
||||
false,
|
||||
"show object uuid",
|
||||
"show object uuid <UUID>",
|
||||
"Show details of a scene object with the given UUID", HandleShowObjectByUuid);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
"Regions",
|
||||
false,
|
||||
"show object name",
|
||||
"show object name <name>",
|
||||
"Show details of scene objects with the given name", HandleShowObjectByName);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
"Regions",
|
||||
false,
|
||||
"show part uuid",
|
||||
"show part uuid <UUID>",
|
||||
"Show details of a scene object parts with the given UUID", HandleShowPartByUuid);
|
||||
|
||||
m_console.Commands.AddCommand(
|
||||
"region",
|
||||
"Regions",
|
||||
false,
|
||||
"show part name",
|
||||
"show part name <name>",
|
||||
|
|
|
@ -206,17 +206,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
|
||||
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
|
||||
|
||||
m_scene.AddCommand(this, "bypass permissions",
|
||||
m_scene.AddCommand("Users", this, "bypass permissions",
|
||||
"bypass permissions <true / false>",
|
||||
"Bypass permission checks",
|
||||
HandleBypassPermissions);
|
||||
|
||||
m_scene.AddCommand(this, "force permissions",
|
||||
m_scene.AddCommand("Users", this, "force permissions",
|
||||
"force permissions <true / false>",
|
||||
"Force permissions on or off",
|
||||
HandleForcePermissions);
|
||||
|
||||
m_scene.AddCommand(this, "debug permissions",
|
||||
m_scene.AddCommand("Users", this, "debug permissions",
|
||||
"debug permissions <true / false>",
|
||||
"Turn on permissions debugging",
|
||||
HandleDebugPermissions);
|
||||
|
|
|
@ -78,21 +78,21 @@ namespace OpenSim.Region.CoreModules.World.Region
|
|||
m_Scene = scene;
|
||||
|
||||
scene.RegisterModuleInterface<IRestartModule>(this);
|
||||
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||
MainConsole.Instance.Commands.AddCommand("Regions",
|
||||
false, "region restart bluebox",
|
||||
"region restart bluebox <message> <delta seconds>+",
|
||||
"Schedule a region restart",
|
||||
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.",
|
||||
HandleRegionRestart);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||
MainConsole.Instance.Commands.AddCommand("Regions",
|
||||
false, "region restart notice",
|
||||
"region restart notice <message> <delta seconds>+",
|
||||
"Schedule a region restart",
|
||||
"Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.",
|
||||
HandleRegionRestart);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("RestartModule",
|
||||
MainConsole.Instance.Commands.AddCommand("Regions",
|
||||
false, "region restart abort",
|
||||
"region restart abort [<message>]",
|
||||
"Abort a region restart", HandleRegionRestart);
|
||||
|
|
|
@ -277,18 +277,19 @@ namespace OpenSim.Region.CoreModules
|
|||
m_frame = 0;
|
||||
|
||||
// This one puts an entry in the main help screen
|
||||
m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
|
||||
// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
|
||||
|
||||
// This one enables the ability to type just "sun" without any parameters
|
||||
m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
|
||||
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
|
||||
foreach (KeyValuePair<string, string> kvp in GetParamList())
|
||||
{
|
||||
m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
|
||||
string sunCommand = string.Format("sun {0}", kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
|
||||
}
|
||||
|
||||
TimeZone local = TimeZone.CurrentTimeZone;
|
||||
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
|
||||
m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
|
||||
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
|
||||
|
||||
// Align ticks with Second Life
|
||||
|
||||
|
|
|
@ -117,24 +117,31 @@ namespace OpenSim.Region.CoreModules
|
|||
}
|
||||
|
||||
// This one puts an entry in the main help screen
|
||||
m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
|
||||
// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
|
||||
|
||||
// This one enables the ability to type just the base command without any parameters
|
||||
m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand);
|
||||
// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
|
||||
|
||||
// Get a list of the parameters for each plugin
|
||||
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
|
||||
{
|
||||
m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
|
||||
m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand);
|
||||
// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
|
||||
m_scene.AddCommand(
|
||||
"Regions",
|
||||
this,
|
||||
"wind base wind_update_rate",
|
||||
"wind base wind_update_rate [<value>]",
|
||||
"Get or set the wind update rate.",
|
||||
"",
|
||||
HandleConsoleBaseCommand);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
|
||||
{
|
||||
m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand);
|
||||
string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
|
||||
m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Register event handlers for when Avatars enter the region, and frame ticks
|
||||
m_scene.EventManager.OnFrame += WindUpdate;
|
||||
m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
m_scene.RegisterModuleInterface<IWorldMapModule>(this);
|
||||
|
||||
m_scene.AddCommand(
|
||||
this, "export-map",
|
||||
"Regions", this, "export-map",
|
||||
"export-map [<path>]",
|
||||
"Save an image of the world map", HandleExportWorldMapConsoleCommand);
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
{
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// There is a major hack going on in this method. The viewer doesn't request
|
||||
// map blocks (RequestMapBlocks) above 2048. That means that if we don't hack,
|
||||
// grids above that cell don't have a map at all. So, here's the hack: we wait
|
||||
// for this CAP request to come, and we inject the map blocks at this point.
|
||||
// for this CAP request to come, and we inject the map blocks at this point.
|
||||
// In a normal scenario, this request simply sends back the MapLayer (the blue color).
|
||||
// In the hacked scenario, it also sends the map blocks via UDP.
|
||||
//
|
||||
|
@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
process,
|
||||
string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
|
||||
ThreadPriority.BelowNormal,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
|
@ -750,7 +751,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
{
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionhandle, out x, out y);
|
||||
GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (mreg != null)
|
||||
{
|
||||
|
@ -856,7 +857,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
finally
|
||||
{
|
||||
if (os != null)
|
||||
os.Close();
|
||||
os.Close();
|
||||
}
|
||||
|
||||
string response_mapItems_reply = null;
|
||||
|
@ -959,16 +960,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// on an unloaded square.
|
||||
// But make sure: Look whether the one we requested is in there
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
minX * (int)Constants.RegionSize,
|
||||
maxX * (int)Constants.RegionSize,
|
||||
minY * (int)Constants.RegionSize,
|
||||
minX * (int)Constants.RegionSize,
|
||||
maxX * (int)Constants.RegionSize,
|
||||
minY * (int)Constants.RegionSize,
|
||||
maxY * (int)Constants.RegionSize);
|
||||
|
||||
if (regions != null)
|
||||
{
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
|
||||
if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
|
||||
(r.RegionLocY == minY * (int)Constants.RegionSize))
|
||||
{
|
||||
// found it => add it to response
|
||||
|
@ -1003,7 +1004,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
{
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(minX - 4) * (int)Constants.RegionSize,
|
||||
(minX - 4) * (int)Constants.RegionSize,
|
||||
(maxX + 4) * (int)Constants.RegionSize,
|
||||
(minY - 4) * (int)Constants.RegionSize,
|
||||
(maxY + 4) * (int)Constants.RegionSize);
|
||||
|
@ -1335,7 +1336,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// Cannot create a map for a nonexistant heightmap
|
||||
if (m_scene.Heightmap == null)
|
||||
return;
|
||||
|
||||
|
||||
//create a texture asset of the terrain
|
||||
IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>();
|
||||
if (terrain == null)
|
||||
|
@ -1344,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
byte[] data = terrain.WriteJpeg2000Image();
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
|
||||
byte[] overlay = GenerateOverlay();
|
||||
|
||||
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
|
||||
|
@ -1365,7 +1366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// Store the new one
|
||||
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
|
||||
if (overlay != null)
|
||||
{
|
||||
parcelImageID = UUID.Random();
|
||||
|
@ -1389,7 +1390,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
|
||||
m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID;
|
||||
m_scene.RegionInfo.RegionSettings.Save();
|
||||
|
||||
|
||||
// Delete the old one
|
||||
// m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID);
|
||||
m_scene.AssetService.Delete(lastTerrainImageID.ToString());
|
||||
|
@ -1510,11 +1511,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
if (!landForSale)
|
||||
{
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName);
|
||||
return null;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -49,6 +49,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
public interface IWorldComm
|
||||
{
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
int ListenerCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
|
|
@ -142,8 +142,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a new script is created.
|
||||
/// Fired when a script is run.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs after OnNewScript.
|
||||
/// </remarks>
|
||||
public event NewRezScript OnRezScript;
|
||||
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
|
||||
|
||||
|
@ -191,10 +194,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public event ClientClosed OnClientClosed;
|
||||
|
||||
// Fired when a script is created
|
||||
// The indication that a new script exists in this region.
|
||||
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a script is created.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs before OnRezScript
|
||||
/// </remarks>
|
||||
public event NewScript OnNewScript;
|
||||
|
||||
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||
{
|
||||
NewScript handlerNewScript = OnNewScript;
|
||||
|
@ -216,10 +225,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
|
||||
// An indication that the script has changed.
|
||||
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
|
||||
|
||||
/// <summary>
|
||||
/// An indication that the script has changed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
|
||||
/// </remarks>
|
||||
public event UpdateScript OnUpdateScript;
|
||||
|
||||
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
||||
{
|
||||
UpdateScript handlerUpdateScript = OnUpdateScript;
|
||||
|
|
|
@ -619,7 +619,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#endregion Region Settings
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("region", false, "reload estate",
|
||||
MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
|
||||
"reload estate",
|
||||
"Reload the estate data", HandleReloadEstate);
|
||||
|
||||
|
@ -651,101 +651,104 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Region Config
|
||||
|
||||
// Region config overrides global config
|
||||
//
|
||||
try
|
||||
{
|
||||
// Region config overrides global config
|
||||
//
|
||||
IConfig startupConfig = m_config.Configs["Startup"];
|
||||
|
||||
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
|
||||
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
|
||||
if (!m_useBackup)
|
||||
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
|
||||
|
||||
//Animation states
|
||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
|
||||
|
||||
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
||||
if (RegionInfo.NonphysPrimMax > 0)
|
||||
if (m_config.Configs["Startup"] != null)
|
||||
{
|
||||
m_maxNonphys = RegionInfo.NonphysPrimMax;
|
||||
}
|
||||
IConfig startupConfig = m_config.Configs["Startup"];
|
||||
|
||||
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
|
||||
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
|
||||
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
|
||||
if (!m_useBackup)
|
||||
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
|
||||
|
||||
//Animation states
|
||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||
|
||||
if (RegionInfo.PhysPrimMax > 0)
|
||||
{
|
||||
m_maxPhys = RegionInfo.PhysPrimMax;
|
||||
}
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
|
||||
|
||||
// Here, if clamping is requested in either global or
|
||||
// local config, it will be used
|
||||
//
|
||||
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
|
||||
if (RegionInfo.ClampPrimSize)
|
||||
{
|
||||
m_clampPrimSize = true;
|
||||
}
|
||||
|
||||
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
|
||||
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
|
||||
m_dontPersistBefore =
|
||||
startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
|
||||
m_dontPersistBefore *= 10000000;
|
||||
m_persistAfter =
|
||||
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
||||
m_persistAfter *= 10000000;
|
||||
|
||||
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
||||
m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
|
||||
|
||||
IConfig packetConfig = m_config.Configs["PacketPool"];
|
||||
if (packetConfig != null)
|
||||
{
|
||||
PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
|
||||
PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
|
||||
}
|
||||
|
||||
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
||||
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
|
||||
CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
|
||||
|
||||
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
|
||||
if (m_generateMaptiles)
|
||||
{
|
||||
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
|
||||
if (maptileRefresh != 0)
|
||||
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
||||
if (RegionInfo.NonphysPrimMax > 0)
|
||||
{
|
||||
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
|
||||
m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
|
||||
m_mapGenerationTimer.AutoReset = true;
|
||||
m_mapGenerationTimer.Start();
|
||||
m_maxNonphys = RegionInfo.NonphysPrimMax;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
|
||||
UUID tileID;
|
||||
|
||||
if (UUID.TryParse(tile, out tileID))
|
||||
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
|
||||
|
||||
if (RegionInfo.PhysPrimMax > 0)
|
||||
{
|
||||
RegionInfo.RegionSettings.TerrainImageID = tileID;
|
||||
m_maxPhys = RegionInfo.PhysPrimMax;
|
||||
}
|
||||
}
|
||||
|
||||
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
|
||||
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
|
||||
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
|
||||
m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
|
||||
m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
|
||||
m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
|
||||
m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
|
||||
m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
|
||||
m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
|
||||
m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
|
||||
// Here, if clamping is requested in either global or
|
||||
// local config, it will be used
|
||||
//
|
||||
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
|
||||
if (RegionInfo.ClampPrimSize)
|
||||
{
|
||||
m_clampPrimSize = true;
|
||||
}
|
||||
|
||||
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
|
||||
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
|
||||
m_dontPersistBefore =
|
||||
startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
|
||||
m_dontPersistBefore *= 10000000;
|
||||
m_persistAfter =
|
||||
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
||||
m_persistAfter *= 10000000;
|
||||
|
||||
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
||||
m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
|
||||
|
||||
IConfig packetConfig = m_config.Configs["PacketPool"];
|
||||
if (packetConfig != null)
|
||||
{
|
||||
PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
|
||||
PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
|
||||
}
|
||||
|
||||
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
||||
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
|
||||
CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
|
||||
|
||||
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
|
||||
if (m_generateMaptiles)
|
||||
{
|
||||
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
|
||||
if (maptileRefresh != 0)
|
||||
{
|
||||
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
|
||||
m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
|
||||
m_mapGenerationTimer.AutoReset = true;
|
||||
m_mapGenerationTimer.Start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
|
||||
UUID tileID;
|
||||
|
||||
if (UUID.TryParse(tile, out tileID))
|
||||
{
|
||||
RegionInfo.RegionSettings.TerrainImageID = tileID;
|
||||
}
|
||||
}
|
||||
|
||||
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
|
||||
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
|
||||
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
|
||||
m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
|
||||
m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
|
||||
m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
|
||||
m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
|
||||
m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
|
||||
m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
|
||||
m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -756,37 +759,34 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Interest Management
|
||||
|
||||
if (m_config != null)
|
||||
IConfig interestConfig = m_config.Configs["InterestManagement"];
|
||||
if (interestConfig != null)
|
||||
{
|
||||
IConfig interestConfig = m_config.Configs["InterestManagement"];
|
||||
if (interestConfig != null)
|
||||
string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
|
||||
|
||||
try
|
||||
{
|
||||
string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
|
||||
|
||||
try
|
||||
{
|
||||
m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
|
||||
m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||
}
|
||||
|
||||
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
|
||||
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
|
||||
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
|
||||
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
|
||||
m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
|
||||
m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||
}
|
||||
|
||||
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
|
||||
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
|
||||
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
|
||||
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme);
|
||||
m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme);
|
||||
|
||||
#endregion Interest Management
|
||||
|
||||
StatsReporter = new SimStatsReporter(this);
|
||||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1102,6 +1102,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
||||
|
||||
StatsReporter.Close();
|
||||
|
||||
m_restartTimer.Stop();
|
||||
m_restartTimer.Close();
|
||||
|
||||
|
@ -1181,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
HeartbeatThread
|
||||
= Watchdog.StartThread(
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false);
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1219,6 +1221,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
try
|
||||
{
|
||||
m_eventManager.TriggerOnRegionStarted(this);
|
||||
|
||||
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
|
||||
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
|
||||
// alarms for scenes with many objects.
|
||||
Update();
|
||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||
|
||||
while (!shuttingdown)
|
||||
Update();
|
||||
}
|
||||
|
@ -1244,7 +1253,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
++Frame;
|
||||
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame);
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1406,26 +1415,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
throw;
|
||||
}
|
||||
catch (AccessViolationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
//catch (NullReferenceException e)
|
||||
//{
|
||||
// m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
//}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
"[SCENE]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1460,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
entry.checkAtTargets();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send out simstats data to all clients
|
||||
/// </summary>
|
||||
|
@ -4342,16 +4334,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public bool PipeEventsForScript(uint localID)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
// Changed so that child prims of attachments return ScriptDanger for their parent, so that
|
||||
// their scripts will actually run.
|
||||
// -- Leaf, Tue Aug 12 14:17:05 EDT 2008
|
||||
SceneObjectPart parent = part.ParentGroup.RootPart;
|
||||
if (part.ParentGroup.IsAttachment)
|
||||
return ScriptDanger(parent, parent.GetWorldPosition());
|
||||
else
|
||||
return ScriptDanger(part, part.GetWorldPosition());
|
||||
return ScriptDanger(parent, parent.GetWorldPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -474,6 +474,63 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <summary>
|
||||
/// Call this from a region module to add a command to the OpenSim console.
|
||||
/// </summary>
|
||||
/// <param name="mod">
|
||||
/// The use of IRegionModuleBase is a cheap trick to get a different method signature,
|
||||
/// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
|
||||
/// </param>
|
||||
/// <param name="category">
|
||||
/// Category of the command. This is the section under which it will appear when the user asks for help
|
||||
/// </param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="shorthelp"></param>
|
||||
/// <param name="longhelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(
|
||||
string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
{
|
||||
AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this from a region module to add a command to the OpenSim console.
|
||||
/// </summary>
|
||||
/// <param name="mod"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="shorthelp"></param>
|
||||
/// <param name="longhelp"></param>
|
||||
/// <param name="descriptivehelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
{
|
||||
string moduleName = "";
|
||||
|
||||
if (mod != null)
|
||||
{
|
||||
if (mod is IRegionModule)
|
||||
{
|
||||
IRegionModule module = (IRegionModule)mod;
|
||||
moduleName = module.Name;
|
||||
}
|
||||
else if (mod is IRegionModuleBase)
|
||||
{
|
||||
IRegionModuleBase module = (IRegionModuleBase)mod;
|
||||
moduleName = module.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||
}
|
||||
}
|
||||
|
||||
AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this from a region module to add a command to the OpenSim console.
|
||||
/// </summary>
|
||||
/// <param name="category">
|
||||
/// Category of the command. This is the section under which it will appear when the user asks for help
|
||||
/// </param>
|
||||
/// <param name="mod"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="shorthelp"></param>
|
||||
|
@ -481,12 +538,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="descriptivehelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(
|
||||
object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
string category, object mod, string command,
|
||||
string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
{
|
||||
if (MainConsole.Instance == null)
|
||||
return;
|
||||
|
||||
string modulename = String.Empty;
|
||||
bool shared = false;
|
||||
|
||||
if (mod != null)
|
||||
|
@ -494,20 +551,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (mod is IRegionModule)
|
||||
{
|
||||
IRegionModule module = (IRegionModule)mod;
|
||||
modulename = module.Name;
|
||||
shared = module.IsSharedModule;
|
||||
}
|
||||
else if (mod is IRegionModuleBase)
|
||||
{
|
||||
IRegionModuleBase module = (IRegionModuleBase)mod;
|
||||
modulename = module.Name;
|
||||
shared = mod is ISharedRegionModule;
|
||||
}
|
||||
else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||
else
|
||||
{
|
||||
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||
}
|
||||
}
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
}
|
||||
|
||||
public virtual ISceneObject DeserializeObject(string representation)
|
||||
|
|
|
@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// that the region position is cached or performance will degrade
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
bool v = true;
|
||||
if (! simulatorList.Contains(dest.ServerURI))
|
||||
// bool v = true;
|
||||
if (!simulatorList.Contains(dest.ServerURI))
|
||||
{
|
||||
// we havent seen this simulator before, add it to the list
|
||||
// and send it an update
|
||||
|
|
|
@ -230,27 +230,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (sp.IsChildAgent)
|
||||
continue;
|
||||
|
||||
if (sp.ParentID != 0)
|
||||
{
|
||||
// sitting avatar
|
||||
SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
|
||||
if (sop != null)
|
||||
{
|
||||
coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't find the parent.. ! arg!
|
||||
coarseLocations.Add(sp.AbsolutePosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
coarseLocations.Add(sp.AbsolutePosition);
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
coarseLocations.Add(sp.AbsolutePosition);
|
||||
|
||||
avatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1691,8 +1691,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (userExposed)
|
||||
dupe.UUID = UUID.Random();
|
||||
|
||||
// The PhysActor cannot be valid on a copy because the copy is not in the scene yet.
|
||||
// Null it, the caller has to create a new one once the object is added to a scene
|
||||
dupe.PhysActor = null;
|
||||
|
||||
dupe.OwnerID = AgentID;
|
||||
|
|
|
@ -349,13 +349,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
protected Vector3 m_lastCameraPosition;
|
||||
|
||||
protected Vector3 m_CameraPosition;
|
||||
|
||||
public Vector3 CameraPosition
|
||||
{
|
||||
get { return m_CameraPosition; }
|
||||
private set { m_CameraPosition = value; }
|
||||
}
|
||||
public Vector3 CameraPosition { get; set; }
|
||||
|
||||
public Quaternion CameraRotation
|
||||
{
|
||||
|
@ -365,28 +359,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Use these three vectors to figure out what the agent is looking at
|
||||
// Convert it to a Matrix and/or Quaternion
|
||||
//
|
||||
protected Vector3 m_CameraAtAxis;
|
||||
protected Vector3 m_CameraLeftAxis;
|
||||
protected Vector3 m_CameraUpAxis;
|
||||
|
||||
public Vector3 CameraAtAxis
|
||||
{
|
||||
get { return m_CameraAtAxis; }
|
||||
private set { m_CameraAtAxis = value; }
|
||||
}
|
||||
|
||||
|
||||
public Vector3 CameraLeftAxis
|
||||
{
|
||||
get { return m_CameraLeftAxis; }
|
||||
private set { m_CameraLeftAxis = value; }
|
||||
}
|
||||
|
||||
public Vector3 CameraUpAxis
|
||||
{
|
||||
get { return m_CameraUpAxis; }
|
||||
private set { m_CameraUpAxis = value; }
|
||||
}
|
||||
public Vector3 CameraAtAxis { get; set; }
|
||||
public Vector3 CameraLeftAxis { get; set; }
|
||||
public Vector3 CameraUpAxis { get; set; }
|
||||
|
||||
public Vector3 Lookat
|
||||
{
|
||||
|
@ -402,33 +377,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
#endregion
|
||||
|
||||
public readonly string Firstname;
|
||||
public readonly string Lastname;
|
||||
public string Firstname { get; private set; }
|
||||
public string Lastname { get; private set; }
|
||||
|
||||
private string m_grouptitle;
|
||||
|
||||
public string Grouptitle
|
||||
{
|
||||
get { return m_grouptitle; }
|
||||
set { m_grouptitle = value; }
|
||||
}
|
||||
public string Grouptitle { get; set; }
|
||||
|
||||
// Agent's Draw distance.
|
||||
protected float m_DrawDistance;
|
||||
public float DrawDistance { get; set; }
|
||||
|
||||
public float DrawDistance
|
||||
{
|
||||
get { return m_DrawDistance; }
|
||||
private set { m_DrawDistance = value; }
|
||||
}
|
||||
|
||||
protected bool m_allowMovement = true;
|
||||
|
||||
public bool AllowMovement
|
||||
{
|
||||
get { return m_allowMovement; }
|
||||
set { m_allowMovement = value; }
|
||||
}
|
||||
public bool AllowMovement { get; set; }
|
||||
|
||||
private bool m_setAlwaysRun;
|
||||
|
||||
|
@ -455,13 +412,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
private byte m_state;
|
||||
|
||||
public byte State
|
||||
{
|
||||
get { return m_state; }
|
||||
set { m_state = value; }
|
||||
}
|
||||
public byte State { get; set; }
|
||||
|
||||
private AgentManager.ControlFlags m_AgentControlFlags;
|
||||
|
||||
|
@ -471,29 +422,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set { m_AgentControlFlags = (AgentManager.ControlFlags)value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This works out to be the ClientView object associated with this avatar, or it's client connection manager
|
||||
/// </summary>
|
||||
private IClientAPI m_controllingClient;
|
||||
|
||||
public IClientAPI ControllingClient
|
||||
{
|
||||
get { return m_controllingClient; }
|
||||
private set { m_controllingClient = value; }
|
||||
}
|
||||
public IClientAPI ControllingClient { get; set; }
|
||||
|
||||
public IClientCore ClientView
|
||||
{
|
||||
get { return (IClientCore) m_controllingClient; }
|
||||
get { return (IClientCore)ControllingClient; }
|
||||
}
|
||||
|
||||
protected Vector3 m_parentPosition;
|
||||
|
||||
public Vector3 ParentPosition
|
||||
{
|
||||
get { return m_parentPosition; }
|
||||
set { m_parentPosition = value; }
|
||||
}
|
||||
public Vector3 ParentPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position of this avatar relative to the region the avatar is in
|
||||
|
@ -502,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
get
|
||||
{
|
||||
if (PhysicsActor != null && m_parentID == 0)
|
||||
if (PhysicsActor != null)
|
||||
{
|
||||
m_pos = PhysicsActor.Position;
|
||||
|
||||
|
@ -525,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// in the sim unless the avatar is on a sit target. While
|
||||
// on a sit target, m_pos will contain the desired offset
|
||||
// without the parent rotation applied.
|
||||
if (ParentID != 0)
|
||||
{
|
||||
SceneObjectPart part = ParentPart;
|
||||
return part.AbsolutePosition + (m_pos * part.GetWorldRotation());
|
||||
}
|
||||
SceneObjectPart sitPart = ParentPart;
|
||||
|
||||
if (sitPart != null)
|
||||
return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
|
||||
}
|
||||
|
||||
return m_pos;
|
||||
}
|
||||
set
|
||||
|
@ -547,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
// Don't update while sitting
|
||||
// Don't update while sitting. The PhysicsActor above is null whilst sitting.
|
||||
if (ParentID == 0)
|
||||
{
|
||||
m_pos = value;
|
||||
|
@ -574,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// There is no offset position when not seated
|
||||
if (ParentID == 0)
|
||||
return;
|
||||
|
||||
m_pos = value;
|
||||
}
|
||||
}
|
||||
|
@ -632,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool IsChildAgent { get; set; }
|
||||
|
||||
public uint ParentID
|
||||
{
|
||||
get { return m_parentID; }
|
||||
set { m_parentID = value; }
|
||||
}
|
||||
private uint m_parentID;
|
||||
/// <summary>
|
||||
/// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
|
||||
/// </summary>
|
||||
public uint ParentID { get; set; }
|
||||
|
||||
public UUID ParentUUID
|
||||
{
|
||||
|
@ -646,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
private UUID m_parentUUID = UUID.Zero;
|
||||
|
||||
public SceneObjectPart ParentPart
|
||||
{
|
||||
get { return m_parentPart; }
|
||||
set { m_parentPart = value; }
|
||||
}
|
||||
private SceneObjectPart m_parentPart = null;
|
||||
/// <summary>
|
||||
/// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If you use this property then you must take a reference since another thread could set it to null.
|
||||
/// </remarks>
|
||||
public SceneObjectPart ParentPart { get; set; }
|
||||
|
||||
public float Health
|
||||
{
|
||||
|
@ -760,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
|
||||
{
|
||||
AttachmentsSyncLock = new Object();
|
||||
|
||||
AllowMovement = true;
|
||||
IsChildAgent = true;
|
||||
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
|
||||
Animator = new ScenePresenceAnimator(this);
|
||||
|
@ -839,17 +775,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private Vector3[] GetWalkDirectionVectors()
|
||||
{
|
||||
Vector3[] vector = new Vector3[11];
|
||||
vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
|
||||
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
|
||||
vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
|
||||
vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
|
||||
vector[2] = Vector3.UnitY; //LEFT
|
||||
vector[3] = -Vector3.UnitY; //RIGHT
|
||||
vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
|
||||
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
|
||||
vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
|
||||
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
|
||||
vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
|
||||
vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
|
||||
vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
|
||||
vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
|
||||
vector[8] = Vector3.UnitY; //LEFT_NUDGE
|
||||
vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
|
||||
vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
|
||||
vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -1381,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Convert it to a Matrix and/or Quaternion
|
||||
CameraAtAxis = agentData.CameraAtAxis;
|
||||
CameraLeftAxis = agentData.CameraLeftAxis;
|
||||
m_CameraUpAxis = agentData.CameraUpAxis;
|
||||
CameraUpAxis = agentData.CameraUpAxis;
|
||||
|
||||
// The Agent's Draw distance setting
|
||||
// When we get to the point of re-computing neighbors everytime this
|
||||
|
@ -1393,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Check if Client has camera in 'follow cam' or 'build' mode.
|
||||
Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
|
||||
|
||||
m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f)
|
||||
m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)
|
||||
&& (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
|
||||
|
||||
m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
|
||||
|
@ -2349,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
|
||||
// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
|
||||
}
|
||||
|
||||
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
||||
ParentID = m_requestedSitTargetID;
|
||||
|
||||
Velocity = Vector3.Zero;
|
||||
RemoveFromPhysicalScene();
|
||||
|
||||
Animator.TrySetMovementAnimation(sitAnimation);
|
||||
SendAvatarDataToAllAgents();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
|
||||
if (ParentPart == null)
|
||||
return;
|
||||
|
||||
ParentID = m_requestedSitTargetID;
|
||||
|
||||
Velocity = Vector3.Zero;
|
||||
RemoveFromPhysicalScene();
|
||||
|
||||
Animator.TrySetMovementAnimation(sitAnimation);
|
||||
SendAvatarDataToAllAgents();
|
||||
}
|
||||
|
||||
public void HandleAgentSitOnGround()
|
||||
|
@ -3161,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
cAgent.Center = CameraPosition;
|
||||
cAgent.AtAxis = CameraAtAxis;
|
||||
cAgent.LeftAxis = CameraLeftAxis;
|
||||
cAgent.UpAxis = m_CameraUpAxis;
|
||||
cAgent.UpAxis = CameraUpAxis;
|
||||
|
||||
cAgent.Far = DrawDistance;
|
||||
|
||||
|
@ -3250,7 +3179,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
CameraPosition = cAgent.Center;
|
||||
CameraAtAxis = cAgent.AtAxis;
|
||||
CameraLeftAxis = cAgent.LeftAxis;
|
||||
m_CameraUpAxis = cAgent.UpAxis;
|
||||
CameraUpAxis = cAgent.UpAxis;
|
||||
ParentUUID = cAgent.ParentPart;
|
||||
m_prevSitOffset = cAgent.SitOffset;
|
||||
|
||||
|
|
|
@ -178,13 +178,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
||||
m_report.AutoReset = true;
|
||||
m_report.Interval = statsUpdatesEveryMS;
|
||||
m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
|
||||
m_report.Elapsed += statsHeartBeat;
|
||||
m_report.Enabled = true;
|
||||
|
||||
if (StatsManager.SimExtraStats != null)
|
||||
OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_report.Elapsed -= statsHeartBeat;
|
||||
m_report.Close();
|
||||
}
|
||||
|
||||
public void SetUpdateMS(int ms)
|
||||
{
|
||||
statsUpdatesEveryMS = ms;
|
||||
|
|
|
@ -65,8 +65,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
|
||||
// Create an object embedded inside the first
|
||||
UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
|
||||
TaskInventoryItem taskSceneObjectItem
|
||||
= TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
|
||||
TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
|
||||
|
||||
TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
|
||||
Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
m_client = client;
|
||||
m_scene = scene;
|
||||
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
|
||||
}
|
||||
|
||||
private void SendServerCommand(string command)
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
m_listener.Start(50);
|
||||
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
|
||||
m_baseScene = baseScene;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Agent.TextureSender
|
|||
m_scene = scene;
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"j2k",
|
||||
"Assets",
|
||||
false,
|
||||
"j2k decode",
|
||||
"j2k decode <ID>",
|
||||
|
|
|
@ -82,19 +82,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
|
|||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.AddCommand(
|
||||
this, "image queues clear",
|
||||
"Comms", this, "image queues clear",
|
||||
"image queues clear <first-name> <last-name>",
|
||||
"Clear the image queues (textures downloaded via UDP) for a particular client.",
|
||||
(mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "image queues show",
|
||||
"Comms", this, "image queues show",
|
||||
"image queues show <first-name> <last-name>",
|
||||
"Show the image queues (textures downloaded via UDP) for a particular client.",
|
||||
(mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show pqueues",
|
||||
"Comms", this, "show pqueues",
|
||||
"show pqueues [full]",
|
||||
"Show priority queue data for each client",
|
||||
"Without the 'full' option, only root agents are shown."
|
||||
|
@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
|
|||
(mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show queues",
|
||||
"Comms", this, "show queues",
|
||||
"show queues [full]",
|
||||
"Show queue data for each client",
|
||||
"Without the 'full' option, only root agents are shown."
|
||||
|
@ -110,13 +110,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
|
|||
(mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show image queues",
|
||||
"Comms", this, "show image queues",
|
||||
"show image queues <first-name> <last-name>",
|
||||
"Show the image queues (textures downloaded via UDP) for a particular client.",
|
||||
(mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show throttles",
|
||||
"Comms", this, "show throttles",
|
||||
"show throttles [full]",
|
||||
"Show throttle settings for each client and for the server overall",
|
||||
"Without the 'full' option, only root agents are shown."
|
||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
|
|||
(mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
|
||||
|
||||
scene.AddCommand(
|
||||
this, "emergency-monitoring",
|
||||
"Comms", this, "emergency-monitoring",
|
||||
"emergency-monitoring",
|
||||
"Go on/off emergency monitoring mode",
|
||||
"Go on/off emergency monitoring mode",
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Region.OptionalModules.Asset
|
|||
m_scene = scene;
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"asset",
|
||||
"Assets",
|
||||
false,
|
||||
"show asset",
|
||||
"show asset <ID>",
|
||||
|
@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.Asset
|
|||
HandleShowAsset);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"asset", false, "dump asset",
|
||||
"Assets", false, "dump asset",
|
||||
"dump asset <id>",
|
||||
"Dump an asset",
|
||||
HandleDumpAsset);
|
||||
|
|
|
@ -94,13 +94,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.AddCommand(
|
||||
this, "show appearance",
|
||||
"Users", this, "show appearance",
|
||||
"show appearance [<first-name> <last-name>]",
|
||||
"Synonym for 'appearance show'",
|
||||
HandleShowAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance show",
|
||||
"Users", this, "appearance show",
|
||||
"appearance show [<first-name> <last-name>]",
|
||||
"Show appearance information for each avatar in the simulator.",
|
||||
"This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. "
|
||||
|
@ -110,14 +110,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
HandleShowAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance send",
|
||||
"Users", this, "appearance send",
|
||||
"appearance send [<first-name> <last-name>]",
|
||||
"Send appearance data for each avatar in the simulator to other viewers.",
|
||||
"Optionally, you can specify that only a particular avatar's appearance data is sent.",
|
||||
HandleSendAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance rebake",
|
||||
"Users", this, "appearance rebake",
|
||||
"appearance rebake <first-name> <last-name>",
|
||||
"Send a request to the user's viewer for it to rebake and reupload its appearance textures.",
|
||||
"This is currently done for all baked texture references previously received, whether the simulator can find the asset or not."
|
||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
HandleRebakeAppearanceCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance find",
|
||||
"Users", this, "appearance find",
|
||||
"appearance find <uuid-or-start-of-uuid>",
|
||||
"Find out which avatar uses the given asset as a baked texture, if any.",
|
||||
"You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.",
|
||||
|
|
|
@ -100,22 +100,22 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
|
|||
{
|
||||
if (!m_commandsLoaded)
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("Physics", false, "physics set",
|
||||
"physics set",
|
||||
"Set physics parameter from currently selected region" + Environment.NewLine
|
||||
+ "Invocation: " + setInvocation,
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Regions", false, "physics set",
|
||||
setInvocation,
|
||||
"Set physics parameter from currently selected region",
|
||||
ProcessPhysicsSet);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Physics", false, "physics get",
|
||||
"physics get",
|
||||
"Get physics parameter from currently selected region" + Environment.NewLine
|
||||
+ "Invocation: " + getInvocation,
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Regions", false, "physics get",
|
||||
getInvocation,
|
||||
"Get physics parameter from currently selected region",
|
||||
ProcessPhysicsGet);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Physics", false, "physics list",
|
||||
"physics list",
|
||||
"List settable physics parameters" + Environment.NewLine
|
||||
+ "Invocation: " + listInvocation,
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Regions", false, "physics list",
|
||||
listInvocation,
|
||||
"List settable physics parameters",
|
||||
ProcessPhysicsList);
|
||||
|
||||
m_commandsLoaded = true;
|
||||
|
|
|
@ -88,25 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(agentId);
|
||||
if (sp == null || sp.IsChildAgent)
|
||||
ScenePresence npc = scene.GetScenePresence(agentId);
|
||||
if (npc == null || npc.IsChildAgent)
|
||||
return false;
|
||||
|
||||
lock (m_avatars)
|
||||
if (!m_avatars.ContainsKey(agentId))
|
||||
return false;
|
||||
|
||||
// Delete existing sp attachments
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
|
||||
// Delete existing npc attachments
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
||||
|
||||
AvatarAppearance app = new AvatarAppearance(appearance, true);
|
||||
sp.Appearance = app;
|
||||
|
||||
// Set new sp appearance. Also sends to clients.
|
||||
scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, app);
|
||||
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
|
||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
||||
npc.Appearance = npcAppearance;
|
||||
|
||||
// Rez needed sp attachments
|
||||
scene.AttachmentsModule.RezAttachments(sp);
|
||||
// Rez needed npc attachments
|
||||
scene.AttachmentsModule.RezAttachments(npc);
|
||||
|
||||
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||
module.SendAppearance(npc.UUID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
[TestFixture]
|
||||
public class NPCModuleTests
|
||||
{
|
||||
private TestScene scene;
|
||||
private AvatarFactoryModule afm;
|
||||
private UserManagementModule umm;
|
||||
private AttachmentsModule am;
|
||||
private TestScene m_scene;
|
||||
private AvatarFactoryModule m_afMod;
|
||||
private UserManagementModule m_umMod;
|
||||
private AttachmentsModule m_attMod;
|
||||
private NPCModule m_npcMod;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureInit()
|
||||
|
@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
afm = new AvatarFactoryModule();
|
||||
umm = new UserManagementModule();
|
||||
am = new AttachmentsModule();
|
||||
m_afMod = new AvatarFactoryModule();
|
||||
m_umMod = new UserManagementModule();
|
||||
m_attMod = new AttachmentsModule();
|
||||
m_npcMod = new NPCModule();
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule());
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
// 8 is the index of the first baked texture in AvatarAppearance
|
||||
|
@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
|
||||
// We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
|
||||
// ScenePresence.SendInitialData() to reset our entire appearance.
|
||||
scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
|
||||
m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
|
||||
|
||||
afm.SetAppearance(sp, originalTe, null);
|
||||
m_afMod.SetAppearance(sp, originalTe, null);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
Assert.That(npc, Is.Not.Null);
|
||||
Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
|
||||
Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
|
||||
Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -124,42 +125,83 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
npcModule.DeleteNPC(npcId, scene);
|
||||
m_npcMod.DeleteNPC(npcId, m_scene);
|
||||
|
||||
ScenePresence deletedNpc = scene.GetScenePresence(npcId);
|
||||
ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
Assert.That(deletedNpc, Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAttachments()
|
||||
public void TestCreateWithAttachments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
|
||||
am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(npc.HasAttachments(), Is.True);
|
||||
List<SceneObjectGroup> attachments = npc.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||
SceneObjectGroup attSo = attachments[0];
|
||||
|
||||
// Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
|
||||
// name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
|
||||
// Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||
|
||||
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
|
||||
Assert.That(attSo.IsAttachment);
|
||||
Assert.That(attSo.UsesPhysics, Is.False);
|
||||
Assert.That(attSo.IsTemporary, Is.False);
|
||||
Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadAppearance()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
// Now add the attachment to the original avatar and use that to load a new appearance
|
||||
// TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
|
||||
m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
|
||||
m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);
|
||||
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(npc.HasAttachments(), Is.True);
|
||||
|
@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
|
||||
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
||||
npc.Flying = true;
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
|
||||
Vector3 targetPos = startPos + new Vector3(0, 10, 0);
|
||||
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
|
||||
m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
|
||||
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
//Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f)));
|
||||
Assert.That(
|
||||
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
// We should really check the exact figure.
|
||||
Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
|
||||
|
@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
|
||||
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
|
||||
|
@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
// Try a second movement
|
||||
startPos = npc.AbsolutePosition;
|
||||
targetPos = startPos + new Vector3(10, 0, 0);
|
||||
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
|
||||
m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
|
||||
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
// Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1)));
|
||||
Assert.That(
|
||||
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001));
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
// We should really check the exact figure.
|
||||
Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
|
||||
|
@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
|
||||
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
|
||||
|
@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
part.SitTargetPosition = new Vector3(0, 0, 1);
|
||||
npcModule.Sit(npc.UUID, part.UUID, scene);
|
||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
||||
|
@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
npc.AbsolutePosition,
|
||||
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
|
||||
|
||||
npcModule.Stand(npc.UUID, scene);
|
||||
m_npcMod.Stand(npc.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(0));
|
||||
|
@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
// FIXME: To get this to work for now, we are going to place the npc right next to the target so that
|
||||
// the autopilot doesn't trigger
|
||||
Vector3 startPos = new Vector3(1, 1, 1);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
npcModule.Sit(npc.UUID, part.UUID, scene);
|
||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
||||
|
@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
npc.AbsolutePosition,
|
||||
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
|
||||
|
||||
npcModule.Stand(npc.UUID, scene);
|
||||
m_npcMod.Stand(npc.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(0));
|
||||
|
|
|
@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:");
|
|||
/// </summary>
|
||||
private void changeadd()
|
||||
{
|
||||
// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
|
||||
|
||||
int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
|
||||
IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
|
||||
|
||||
|
|
|
@ -630,33 +630,16 @@ namespace OpenSim.Region.RegionCombinerModule
|
|||
|
||||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
List<UUID> AvatarUUIDs = new List<UUID>();
|
||||
|
||||
connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (sp.UUID != presence.UUID)
|
||||
{
|
||||
if (sp.ParentID != 0)
|
||||
{
|
||||
// sitting avatar
|
||||
SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(sp.ParentID);
|
||||
if (sop != null)
|
||||
{
|
||||
CoarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't find the parent.. ! arg!
|
||||
CoarseLocations.Add(sp.AbsolutePosition);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CoarseLocations.Add(sp.AbsolutePosition);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
CoarseLocations.Add(sp.AbsolutePosition);
|
||||
AvatarUUIDs.Add(sp.UUID);
|
||||
}
|
||||
});
|
||||
|
||||
DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (cmdHandlerThread == null)
|
||||
{
|
||||
// Start the thread that will be doing the work
|
||||
cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
|
||||
cmdHandlerThread
|
||||
= Watchdog.StartThread(
|
||||
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the sensor repeat plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_SensorRepeat.ContainsKey(engine))
|
||||
return m_SensorRepeat[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the dataserver plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Dataserver.ContainsKey(engine))
|
||||
return m_Dataserver[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the timer plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Timer GetTimerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Timer.ContainsKey(engine))
|
||||
return m_Timer[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the listener plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Listener GetListenerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Listener.ContainsKey(engine))
|
||||
return m_Listener[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
|
||||
|
@ -288,7 +341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
data.AddRange(timers);
|
||||
}
|
||||
|
||||
Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
if (sensors.Length > 0)
|
||||
{
|
||||
data.Add("sensor");
|
||||
|
|
|
@ -4213,7 +4213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
List<String> nametable = new List<String>();
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
||||
SceneObjectPart sitPart = presence.ParentPart;
|
||||
if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
|
||||
nametable.Add(presence.ControllingClient.Name);
|
||||
});
|
||||
|
||||
|
@ -4450,7 +4451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
|
||||
Util.Clip((float)color.y, 0.0f, 1.0f),
|
||||
Util.Clip((float)color.z, 0.0f, 1.0f));
|
||||
m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
|
||||
m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
|
||||
//m_host.ParentGroup.HasGroupChanged = true;
|
||||
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
@ -4844,22 +4845,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
// Find pushee position
|
||||
// Pushee Linked?
|
||||
if (pusheeav.ParentID != 0)
|
||||
{
|
||||
SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID);
|
||||
if (parentobj != null)
|
||||
{
|
||||
PusheePos = parentobj.AbsolutePosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
PusheePos = pusheeav.AbsolutePosition;
|
||||
}
|
||||
}
|
||||
SceneObjectPart sitPart = pusheeav.ParentPart;
|
||||
if (sitPart != null)
|
||||
PusheePos = sitPart.AbsolutePosition;
|
||||
else
|
||||
{
|
||||
PusheePos = pusheeav.AbsolutePosition;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pusheeIsAvatar)
|
||||
|
@ -6067,7 +6057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
flags |= ScriptBaseClass.AGENT_IN_AIR;
|
||||
}
|
||||
|
||||
if (agent.ParentID != 0)
|
||||
if (agent.ParentPart != null)
|
||||
{
|
||||
flags |= ScriptBaseClass.AGENT_ON_OBJECT;
|
||||
flags |= ScriptBaseClass.AGENT_SITTING;
|
||||
|
@ -6866,16 +6856,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// LSL quaternions can normalize to 0, normal Quaternions can't.
|
||||
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
|
||||
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
|
||||
|
||||
m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
m_host.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
part.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
SitTarget(m_host, offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
SitTarget(m_host, offset, rot);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
{
|
||||
SitTarget(part, offset, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_String llAvatarOnSitTarget()
|
||||
|
@ -7560,10 +7572,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
shapeBlock.PathScaleX = 100;
|
||||
shapeBlock.PathScaleY = 150;
|
||||
|
||||
if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 &&
|
||||
(type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 &&
|
||||
(type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 &&
|
||||
(type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0)
|
||||
int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
|
||||
|
||||
if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
|
||||
{
|
||||
// default
|
||||
type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
|
||||
|
@ -8851,23 +8865,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return GetPrimMediaParams(m_host, face, rules);
|
||||
}
|
||||
|
||||
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return GetPrimMediaParams(m_host, face, rules);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return GetPrimMediaParams(part, face, rules);
|
||||
}
|
||||
|
||||
return new LSL_List();
|
||||
}
|
||||
|
||||
private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
|
||||
// TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
|
||||
// Assuming silently fail means give back an empty list. Ideally, need to check this.
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return new LSL_List();
|
||||
|
||||
return GetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
private LSL_List GetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return new LSL_List();
|
||||
|
||||
MediaEntry me = module.GetMediaEntry(m_host, face);
|
||||
MediaEntry me = module.GetMediaEntry(part, face);
|
||||
|
||||
// As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
|
||||
if (null == me)
|
||||
|
@ -8949,33 +8980,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
|
||||
res.Add(new LSL_Integer((int)me.ControlPermissions));
|
||||
break;
|
||||
|
||||
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
|
||||
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return SetPrimMediaParams(m_host, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return SetPrimMediaParams(m_host, face, rules);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return SetPrimMediaParams(part, face, rules);
|
||||
}
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
|
||||
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
|
||||
// Don't perform the media check directly
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
|
||||
return SetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
MediaEntry me = module.GetMediaEntry(m_host, face);
|
||||
MediaEntry me = module.GetMediaEntry(part, face);
|
||||
if (null == me)
|
||||
me = new MediaEntry();
|
||||
|
||||
|
@ -9054,10 +9104,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
|
||||
me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
|
||||
break;
|
||||
|
||||
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
module.SetMediaEntry(m_host, face, me);
|
||||
module.SetMediaEntry(part, face, me);
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
}
|
||||
|
@ -9066,18 +9118,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return ClearPrimMedia(m_host, face);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return ClearPrimMedia(m_host, face);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return ClearPrimMedia(part, face);
|
||||
}
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
|
||||
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
|
||||
// FIXME: Don't perform the media check directly
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
module.ClearMediaEntry(m_host, face);
|
||||
module.ClearMediaEntry(part, face);
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
}
|
||||
|
|
|
@ -2169,6 +2169,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return result;
|
||||
}
|
||||
|
||||
public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osReplaceString");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
// Normalize indices (if negative).
|
||||
// After normlaization they may still be
|
||||
// negative, but that is now relative to
|
||||
// the start, rather than the end, of the
|
||||
// sequence.
|
||||
if (start < 0)
|
||||
{
|
||||
start = src.Length + start;
|
||||
}
|
||||
|
||||
if (start < 0 || start >= src.Length)
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
||||
// Find matches beginning at start position
|
||||
Regex matcher = new Regex(pattern);
|
||||
return matcher.Replace(src,replace,count,start);
|
||||
}
|
||||
|
||||
public string osLoadedCreationDate()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate");
|
||||
|
@ -2786,7 +2811,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
|
||||
m_host.AddScriptLPS(1);
|
||||
ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
|
||||
if (avatar != null)
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
}
|
||||
|
||||
public void osKickAvatar(string FirstName,string SurName,string alert)
|
||||
|
|
|
@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int DataserverRequestsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (DataserverRequests)
|
||||
return DataserverRequests.Count;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, DataserverRequest> DataserverRequests =
|
||||
new Dictionary<string, DataserverRequest>();
|
||||
|
||||
|
|
|
@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
private IWorldComm m_commsPlugin;
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get { return m_commsPlugin.ListenerCount; }
|
||||
}
|
||||
|
||||
public Listener(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
}
|
||||
|
||||
public void CheckListeners()
|
||||
{
|
||||
if (m_CmdManager.m_ScriptEngine.World == null)
|
||||
return;
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
if (comms != null)
|
||||
if (m_commsPlugin != null)
|
||||
{
|
||||
while (comms.HasMessages())
|
||||
while (m_commsPlugin.HasMessages())
|
||||
{
|
||||
ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage();
|
||||
ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
|
||||
|
||||
//Deliver data to prim's listen handler
|
||||
object[] resobj = new object[]
|
||||
|
@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public Object[] GetSerializationData(UUID itemID)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
return comms.GetSerializationData(itemID);
|
||||
return m_commsPlugin.GetSerializationData(itemID);
|
||||
}
|
||||
|
||||
public void CreateFromData(uint localID, UUID itemID, UUID hostID,
|
||||
Object[] data)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
comms.CreateFromData(localID, itemID, hostID, data);
|
||||
m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
/// <summary>
|
||||
/// Number of sensors active.
|
||||
/// </summary>
|
||||
public int SensorsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (SenseRepeatListLock)
|
||||
return SenseRepeaters.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SensorRepeat(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
@ -157,12 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public void CheckSenseRepeaterEvents()
|
||||
{
|
||||
// Nothing to do here?
|
||||
if (SenseRepeaters.Count == 0)
|
||||
return;
|
||||
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
// Nothing to do here?
|
||||
if (SenseRepeaters.Count == 0)
|
||||
return;
|
||||
|
||||
// Go through all timers
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
{
|
||||
|
@ -640,7 +652,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
ts.next =
|
||||
DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
||||
|
||||
SenseRepeaters.Add(ts);
|
||||
lock (SenseRepeatListLock)
|
||||
SenseRepeaters.Add(ts);
|
||||
|
||||
idx += 6;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int TimersCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (TimerListLock)
|
||||
return Timers.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public Timer(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
|
||||
LSL_Integer llCeil(double f);
|
||||
void llClearCameraParams();
|
||||
LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
|
||||
LSL_Integer llClearPrimMedia(LSL_Integer face);
|
||||
void llCloseRemoteDataChannel(string channel);
|
||||
LSL_Float llCloud(LSL_Vector offset);
|
||||
|
@ -140,7 +141,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_String llGetLinkName(int linknum);
|
||||
LSL_Integer llGetLinkNumber();
|
||||
LSL_Integer llGetLinkNumberOfSides(int link);
|
||||
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
|
||||
LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
|
||||
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
|
||||
LSL_Integer llGetListEntryType(LSL_List src, int index);
|
||||
LSL_Integer llGetListLength(LSL_List src);
|
||||
LSL_Vector llGetLocalPos();
|
||||
|
@ -220,6 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_String llGetDisplayName(string id);
|
||||
LSL_String llRequestDisplayName(string id);
|
||||
void llLinkParticleSystem(int linknum, LSL_List rules);
|
||||
void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
|
||||
LSL_String llList2CSV(LSL_List src);
|
||||
LSL_Float llList2Float(LSL_List src, int index);
|
||||
LSL_Integer llList2Integer(LSL_List src, int index);
|
||||
|
@ -336,6 +339,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llSetInventoryPermMask(string item, int mask, int value);
|
||||
void llSetLinkAlpha(int linknumber, double alpha, int face);
|
||||
void llSetLinkColor(int linknumber, LSL_Vector color, int face);
|
||||
LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
|
||||
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
|
||||
void llSetLinkTexture(int linknumber, string texture, int face);
|
||||
void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
|
||||
|
@ -347,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
|
||||
void llSetPos(LSL_Vector pos);
|
||||
LSL_Integer llSetRegionPos(LSL_Vector pos);
|
||||
LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
|
||||
LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
|
||||
void llSetPrimitiveParams(LSL_List rules);
|
||||
void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
|
||||
void llSetPrimURL(string url);
|
||||
|
|
|
@ -165,6 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
|
||||
LSL_String osFormatString(string str, LSL_List strings);
|
||||
LSL_List osMatchString(string src, string pattern, int start);
|
||||
LSL_String osReplaceString(string src, string pattern, string replace, int count, int start);
|
||||
|
||||
// Information about data loaded into the region
|
||||
string osLoadedCreationDate();
|
||||
|
|
|
@ -1710,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_LSL_Functions.llSitTarget(offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_LSL_Functions.llLinkSitTarget(link, offset, rot);
|
||||
}
|
||||
|
||||
public void llSleep(double sec)
|
||||
{
|
||||
m_LSL_Functions.llSleep(sec);
|
||||
|
@ -1909,17 +1914,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
{
|
||||
return m_LSL_Functions.llGetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
|
||||
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llGetLinkMedia(link, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llSetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
|
||||
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llSetLinkMedia(link, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearPrimMedia(LSL_Integer face)
|
||||
{
|
||||
return m_LSL_Functions.llClearPrimMedia(face);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
|
||||
{
|
||||
return m_LSL_Functions.llClearLinkMedia(link, face);
|
||||
}
|
||||
|
||||
public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
|
||||
{
|
||||
return m_LSL_Functions.llGetLinkNumberOfSides(link);
|
||||
|
|
|
@ -472,6 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_OSSL_Functions.osMatchString(src, pattern, start);
|
||||
}
|
||||
|
||||
public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start)
|
||||
{
|
||||
return m_OSSL_Functions.osReplaceString(src,pattern,replace,count,start);
|
||||
}
|
||||
|
||||
|
||||
// Information about data loaded into the region
|
||||
public string osLoadedCreationDate()
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
emessage = emessage.Substring(slinfo.Length+2);
|
||||
|
||||
message = String.Format("({0},{1}) {2}",
|
||||
e.slInfo.lineNumber - 2,
|
||||
e.slInfo.lineNumber - 1,
|
||||
e.slInfo.charPosition - 1, emessage);
|
||||
|
||||
throw new Exception(message);
|
||||
|
|
|
@ -29,6 +29,7 @@ using System.Collections.Generic;
|
|||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
{
|
||||
|
@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
[Test]
|
||||
public void TestDefaultState()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
[Test]
|
||||
public void TestCustomState()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -93,6 +98,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestEventWithArguments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
at_rot_target(integer tnum, rotation targetrot, rotation ourrot)
|
||||
|
@ -113,6 +120,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestIntegerDeclaration()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -135,6 +144,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestLoneIdent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// A lone ident should be removed completely as it's an error in C#
|
||||
// (MONO at least).
|
||||
string input = @"default
|
||||
|
@ -161,6 +172,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestAssignments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -187,6 +200,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestAdditionSubtractionOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -215,6 +230,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestStrings()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -242,6 +259,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestBinaryExpression()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -284,6 +303,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestFloatConstants()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -336,6 +357,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests comments
|
||||
default
|
||||
{
|
||||
|
@ -358,6 +381,8 @@ default
|
|||
[Test]
|
||||
public void TestStringsWithEscapedQuotesAndComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests strings, with escaped quotes and comments in strings
|
||||
default
|
||||
{
|
||||
|
@ -397,6 +422,8 @@ default
|
|||
[Test]
|
||||
public void TestCStyleComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"/* this test tests comments
|
||||
of the C variety
|
||||
*/
|
||||
|
@ -426,6 +453,8 @@ default
|
|||
[Test]
|
||||
public void TestGlobalDefinedFunctions()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests custom defined functions
|
||||
|
||||
string onefunc()
|
||||
|
@ -470,6 +499,8 @@ default
|
|||
[Test]
|
||||
public void TestGlobalDeclaredVariables()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests custom defined functions and global variables
|
||||
|
||||
string globalString;
|
||||
|
@ -525,6 +556,8 @@ default
|
|||
[Test]
|
||||
public void TestMoreAssignments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests +=, -=, *=, /=, %=
|
||||
|
||||
string globalString;
|
||||
|
@ -579,6 +612,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorConstantNotation()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -606,6 +641,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorMemberAccess()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -632,6 +669,8 @@ default
|
|||
[Test]
|
||||
public void TestExpressionInParentheses()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -660,6 +699,8 @@ default
|
|||
[Test]
|
||||
public void TestIncrementDecrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// here we'll test the ++ and -- operators
|
||||
|
||||
default
|
||||
|
@ -690,6 +731,8 @@ default
|
|||
[Test]
|
||||
public void TestLists()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// testing lists
|
||||
|
||||
default
|
||||
|
@ -718,6 +761,8 @@ default
|
|||
[Test]
|
||||
public void TestIfStatement()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test if statements
|
||||
|
||||
default
|
||||
|
@ -822,6 +867,8 @@ default
|
|||
[Test]
|
||||
public void TestIfElseStatement()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test complex logical expressions
|
||||
|
||||
default
|
||||
|
@ -928,6 +975,8 @@ default
|
|||
[Test]
|
||||
public void TestWhileLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test while loops
|
||||
|
||||
default
|
||||
|
@ -968,6 +1017,8 @@ default
|
|||
[Test]
|
||||
public void TestDoWhileLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test do-while loops
|
||||
|
||||
default
|
||||
|
@ -1012,6 +1063,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test for loops
|
||||
|
||||
default
|
||||
|
@ -1056,6 +1109,8 @@ default
|
|||
[Test]
|
||||
public void TestFloatsWithTrailingDecimal()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot
|
||||
|
||||
default
|
||||
|
@ -1108,6 +1163,8 @@ default
|
|||
[Test]
|
||||
public void TestUnaryAndBinaryOperators()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test a few more operators
|
||||
|
||||
default
|
||||
|
@ -1144,6 +1201,8 @@ default
|
|||
[Test]
|
||||
public void TestTypecasts()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test typecasts
|
||||
|
||||
default
|
||||
|
@ -1189,6 +1248,8 @@ default
|
|||
[Test]
|
||||
public void TestStates()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test states
|
||||
|
||||
default
|
||||
|
@ -1229,6 +1290,8 @@ state statetwo
|
|||
[Test]
|
||||
public void TestHexIntegerConstants()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test hex integers
|
||||
|
||||
default
|
||||
|
@ -1261,6 +1324,8 @@ default
|
|||
[Test]
|
||||
public void TestJumps()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test jumps
|
||||
|
||||
default
|
||||
|
@ -1291,6 +1356,8 @@ default
|
|||
[Test]
|
||||
public void TestImplicitVariableInitialization()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test implicitly initializing variables
|
||||
|
||||
default
|
||||
|
@ -1334,6 +1401,8 @@ default
|
|||
[Test]
|
||||
public void TestMultipleEqualsExpression()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test x = y = 5 type expressions
|
||||
|
||||
default
|
||||
|
@ -1366,6 +1435,8 @@ default
|
|||
[Test]
|
||||
public void TestUnaryExpressionLastInVectorConstant()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test unary expressions some more
|
||||
|
||||
default
|
||||
|
@ -1390,6 +1461,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorMemberPlusEquals()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test unary expressions some more
|
||||
|
||||
default
|
||||
|
@ -1424,6 +1497,8 @@ default
|
|||
[Test]
|
||||
public void TestWhileLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1447,6 +1522,8 @@ default
|
|||
[Test]
|
||||
public void TestDoWhileLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1472,6 +1549,8 @@ default
|
|||
[Test]
|
||||
public void TestIfWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1495,6 +1574,8 @@ default
|
|||
[Test]
|
||||
public void TestIfElseWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1521,6 +1602,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1544,6 +1627,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithNoAssignment()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1569,6 +1654,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithOnlyIdentInAssignment()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1594,6 +1681,8 @@ default
|
|||
[Test]
|
||||
public void TestAssignmentInIfWhileDoWhile()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1631,6 +1720,8 @@ default
|
|||
[Test]
|
||||
public void TestLSLListHack()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1653,9 +1744,12 @@ default
|
|||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxError()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1671,17 +1765,22 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 6, char 5 (expected ';', found
|
||||
// The syntax error is on line 5, char 4 (expected ';', found
|
||||
// '}').
|
||||
Assert.AreEqual("(4,4) syntax error", e.Message);
|
||||
throw;
|
||||
Assert.AreEqual("(5,4) syntax error", e.Message);
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxErrorDeclaringVariableInForLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1697,11 +1796,13 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 5, char 14 (Syntax error)
|
||||
Assert.AreEqual("(3,13) syntax error", e.Message);
|
||||
// The syntax error is on line 4, char 13 (Syntax error)
|
||||
Assert.AreEqual("(4,13) syntax error", e.Message);
|
||||
|
||||
throw;
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.CSharp;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
{
|
||||
|
@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
//[Test]
|
||||
public void TestUseUndeclaredVariable()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
|
||||
string input = @"default
|
||||
|
@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
//[Test]
|
||||
public void TestCastAndConcatString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
|
||||
string input = @"string s = "" a string"";
|
||||
|
@ -150,4 +155,4 @@ default
|
|||
Assert.AreEqual(0, m_compilerResults.Errors.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[TestFixture, LongRunning]
|
||||
public class LSL_ApiTest
|
||||
{
|
||||
|
||||
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
|
||||
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
|
||||
private const float FLOAT_ACCURACY = 0.00005f;
|
||||
|
@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestllAngleBetween()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1);
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1);
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1);
|
||||
|
@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// llRot2Euler test.
|
||||
public void TestllRot2Euler()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// 180, 90 and zero degree rotations.
|
||||
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f));
|
||||
|
@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// llSetPrimitiveParams and llGetPrimitiveParams test.
|
||||
public void TestllSetPrimitiveParams()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Create Prim1.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
string obj1Name = "Prim1";
|
||||
|
@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
}
|
||||
|
||||
[Test]
|
||||
// llVecNorm test.
|
||||
public void TestllVecNorm()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Check special case for normalizing zero vector.
|
||||
CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
|
||||
// Check various vectors.
|
||||
|
|
|
@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromInt()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<int, double> number in m_intDoubleSet)
|
||||
|
@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToInt()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
int testNumber;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleIntSet)
|
||||
|
@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToUint()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
uint testNumber;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleUintSet)
|
||||
|
@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToBooleanTrue()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
bool testBool;
|
||||
|
||||
|
@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToBooleanFalse()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0);
|
||||
bool testBool = testFloat;
|
||||
|
||||
|
@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastIntToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLIntegerToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLIntegerToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastStringToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
|
||||
|
@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
|
||||
|
@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastDoubleToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
double testNumber;
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
|
@ -411,26 +437,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToFloat()
|
||||
{
|
||||
float testFloat;
|
||||
float numberAsFloat;
|
||||
LSL_Types.LSLFloat testLSLFloat;
|
||||
foreach (double number in m_doubleList)
|
||||
{
|
||||
testLSLFloat = new LSL_Types.LSLFloat(number);
|
||||
numberAsFloat = (float)number;
|
||||
testFloat = (float)testLSLFloat;
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
|
||||
}
|
||||
float testFloat;
|
||||
float numberAsFloat;
|
||||
LSL_Types.LSLFloat testLSLFloat;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
{
|
||||
testLSLFloat = new LSL_Types.LSLFloat(number);
|
||||
numberAsFloat = (float)number;
|
||||
testFloat = (float)testLSLFloat;
|
||||
|
||||
Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tests the equality (==) operator.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestEqualsOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloatA, testFloatB;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestNotEqualOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloatA, testFloatB;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestIncrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
double testNumber;
|
||||
|
||||
|
@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestDecrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
double testNumber;
|
||||
|
||||
|
@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestToString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestAddTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestSubtractTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestMultiplyTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestDivideTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
testFloat = (1 == 0);
|
||||
|
@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleIntSet)
|
||||
|
@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastStringToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<string, int> number in m_stringIntSet)
|
||||
|
@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<string, int> number in m_stringIntSet)
|
||||
|
@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
testInteger = (1 == 0);
|
||||
|
|
|
@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToLSLString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToQuaternion()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>";
|
||||
LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString);
|
||||
|
||||
|
@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
testString = (LSL_Types.LSLString) (1 == 0);
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLString("addition");
|
||||
|
||||
|
@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLInteger(20);
|
||||
|
||||
|
@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLFloat(2.0f);
|
||||
|
||||
|
@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLIntegerItemToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLFloatItemToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLStringItemToLSLString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastVector3ItemToVector3()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastQuaternionItemToQuaternion()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLIntegerItemForLSLIntegerItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLFloatItemForLSLFloatItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLFloatItemForLSLIntegerItem()
|
||||
{
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
|
||||
LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0));
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
|
||||
LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLStringItemForLSLStringItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLStringItemForKeyItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.key testValue
|
||||
= new LSL_Types.key("98000000-0000-2222-3333-100000001000");
|
||||
LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue);
|
||||
|
@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetVector3ItemForVector3Item()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetQuaternionItemForQuaternionItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetKeyItemForKeyItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.key testValue
|
||||
= new LSL_Types.key("00000000-0000-2222-3333-100000001012");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
Assert.AreEqual(testValue, testList.GetKeyItem(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared;
|
|||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for Vector3
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class LSL_TypesTestVector3
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for Vector3
|
||||
/// </summary>
|
||||
[Test]
|
||||
|
||||
public void TestDotProduct()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// The numbers we test for.
|
||||
Dictionary<string, double> expectsSet = new Dictionary<string, double>();
|
||||
expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0);
|
||||
|
|
|
@ -50,7 +50,10 @@ using OpenSim.Region.ScriptEngine.Shared;
|
|||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Instance;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
|
||||
|
||||
using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
|
||||
|
||||
|
@ -342,22 +345,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "xengine status", "xengine status", "Show status information",
|
||||
"Scripts", false, "xengine status", "xengine status", "Show status information",
|
||||
"Show status information on the script engine.",
|
||||
HandleShowStatus);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
|
||||
"Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
|
||||
"Show information on all scripts known to the script engine."
|
||||
+ "If a <script-item-uuid> is given then only information on that script will be shown.",
|
||||
HandleShowScripts);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
|
||||
"Scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
|
||||
"Synonym for scripts show command", HandleShowScripts);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts",
|
||||
"Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts",
|
||||
"Suspends all currently running scripts. This only suspends event delivery, it will not suspend a"
|
||||
+ " script that is currently processing an event.\n"
|
||||
+ "Suspended scripts will continue to accumulate events but won't process them.\n"
|
||||
|
@ -365,20 +368,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
|
||||
"Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
|
||||
"Resumes all currently suspended scripts.\n"
|
||||
+ "Resumed scripts will process all events accumulated whilst suspended."
|
||||
+ "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
|
||||
"Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
|
||||
"Stops all running scripts."
|
||||
+ "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
|
||||
"Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
|
||||
"Starts all stopped scripts."
|
||||
+ "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
|
||||
|
@ -454,6 +457,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
|
||||
// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
|
||||
|
||||
SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
|
||||
sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount);
|
||||
|
||||
Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this);
|
||||
sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount);
|
||||
|
||||
Timer t = AsyncCommandManager.GetTimerPlugin(this);
|
||||
sb.AppendFormat("Timers : {0}\n", t.TimersCount);
|
||||
|
||||
Listener l = AsyncCommandManager.GetListenerPlugin(this);
|
||||
sb.AppendFormat("Listeners : {0}\n", l.ListenerCount);
|
||||
|
||||
MainConsole.Instance.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics
|
|||
{
|
||||
if (m_scenes.Count == 0)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
//IConfig startupConfig = config.Configs["Startup"];
|
||||
|
||||
dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
|
||||
|
@ -221,13 +224,11 @@ namespace OpenSim.Region.UserStatistics
|
|||
concurrencyCounter--;
|
||||
|
||||
response_code = 200;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
strOut = MainServer.Instance.GetHTTP404("");
|
||||
}
|
||||
|
||||
|
||||
responsedata["int_response_code"] = response_code;
|
||||
responsedata["content_type"] = contenttype;
|
||||
|
@ -244,43 +245,44 @@ namespace OpenSim.Region.UserStatistics
|
|||
// TODO: FIXME: implement stats migrations
|
||||
const string SQL = @"SELECT * FROM migrations LIMIT 1";
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand(SQL, db);
|
||||
|
||||
try
|
||||
using (SqliteCommand cmd = new SqliteCommand(SQL, db))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
CreateTables(db);
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
CreateTables(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateTables(SqliteConnection db)
|
||||
{
|
||||
SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db);
|
||||
createcmd.ExecuteNonQuery();
|
||||
using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db))
|
||||
{
|
||||
createcmd.ExecuteNonQuery();
|
||||
|
||||
createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
|
||||
createcmd.ExecuteNonQuery();
|
||||
createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
|
||||
createcmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PostInitialise()
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddHandlers();
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dbConn.Close();
|
||||
dbConn.Dispose();
|
||||
m_sessions.Clear();
|
||||
|
@ -301,7 +303,8 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
|
||||
string capsPath = "/CAPS/VS/" + UUID.Random();
|
||||
caps.RegisterHandler("ViewerStats",
|
||||
new RestStreamHandler("POST", capsPath,
|
||||
|
@ -315,7 +318,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnDeRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void AddHandlers()
|
||||
|
@ -365,7 +367,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnMakeChildAgent(ScenePresence agent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnClientClosed(UUID agentID, Scene scene)
|
||||
|
@ -427,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
|
|||
return scene.RegionInfo.RegionID;
|
||||
}
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
|
@ -455,14 +457,14 @@ namespace OpenSim.Region.UserStatistics
|
|||
UserSessionData usd;
|
||||
OSD message = OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap mmap;
|
||||
|
||||
lock (m_sessions)
|
||||
{
|
||||
if (agentID != UUID.Zero)
|
||||
{
|
||||
|
||||
if (!m_sessions.ContainsKey(agentID))
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure");
|
||||
m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
|
||||
return new UserSessionID();
|
||||
}
|
||||
uid = m_sessions[agentID];
|
||||
|
@ -582,8 +584,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
usd.n_out_kb = (float)net_out["kbytes"].AsReal();
|
||||
usd.n_out_pk = net_out["packets"].AsInteger();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,83 +599,85 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
lock (db)
|
||||
{
|
||||
SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db);
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
|
||||
(int) uid.session_data.min_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
|
||||
(int) uid.session_data.max_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
|
||||
(int) uid.session_data.mode_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
|
||||
// m_log.Debug("UPDATE");
|
||||
|
||||
int result = updatecmd.ExecuteNonQuery();
|
||||
|
||||
if (result == 0)
|
||||
using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db))
|
||||
{
|
||||
// m_log.Debug("INSERT");
|
||||
updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
|
||||
try
|
||||
{
|
||||
updatecmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteExecutionException)
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception");
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
|
||||
}
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
|
||||
(int) uid.session_data.min_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
|
||||
(int) uid.session_data.max_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
|
||||
(int) uid.session_data.mode_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
|
||||
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
|
||||
|
||||
int result = updatecmd.ExecuteNonQuery();
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
|
||||
|
||||
updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
|
||||
|
||||
try
|
||||
{
|
||||
updatecmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
|
||||
uid.session_data.agent_id, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,16 +236,16 @@ namespace OpenSim.Server.Base
|
|||
|
||||
// Register the quit command
|
||||
//
|
||||
MainConsole.Instance.Commands.AddCommand("base", false, "quit",
|
||||
MainConsole.Instance.Commands.AddCommand("General", false, "quit",
|
||||
"quit",
|
||||
"Quit the application", HandleQuit);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("base", false, "shutdown",
|
||||
MainConsole.Instance.Commands.AddCommand("General", false, "shutdown",
|
||||
"shutdown",
|
||||
"Quit the application", HandleQuit);
|
||||
|
||||
|
||||
// Register a command to read other commands from a file
|
||||
MainConsole.Instance.Commands.AddCommand("base", false, "command-script",
|
||||
MainConsole.Instance.Commands.AddCommand("General", false, "command-script",
|
||||
"command-script <script>",
|
||||
"Run a command script from file", HandleScript);
|
||||
|
||||
|
|
|
@ -72,19 +72,19 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
|
||||
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", false,
|
||||
"show asset",
|
||||
"show asset <ID>",
|
||||
"Show asset information",
|
||||
HandleShowAsset);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", false,
|
||||
"delete asset",
|
||||
"delete asset <ID>",
|
||||
"Delete asset from database",
|
||||
HandleDeleteAsset);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("kfs", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", false,
|
||||
"dump asset",
|
||||
"dump asset <ID>",
|
||||
"Dump asset to a file",
|
||||
|
|
|
@ -248,7 +248,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
|
|||
if (passwordValues != null && passwordValues.Length == 1)
|
||||
{
|
||||
if (account != null &&
|
||||
(m_authenticationService.Authenticate(account.PrincipalID, passwordValues[0], 30) != string.Empty))
|
||||
(m_authenticationService.Authenticate(account.PrincipalID,Util.Md5Hash(passwordValues[0]), 30) != string.Empty))
|
||||
authRequest.IsAuthenticated = true;
|
||||
else
|
||||
authRequest.IsAuthenticated = false;
|
||||
|
|
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Services.AssetService
|
||||
{
|
||||
/// <summary>
|
||||
/// This will be developed into a de-duplicating asset service.
|
||||
/// XXX: Currently it's a just a copy of the existing AssetService. so please don't attempt to use it.
|
||||
/// </summary>
|
||||
public class XAssetService : AssetServiceBase, IAssetService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected static XAssetService m_RootInstance;
|
||||
|
||||
public XAssetService(IConfigSource config) : base(config)
|
||||
{
|
||||
if (m_RootInstance == null)
|
||||
{
|
||||
m_RootInstance = this;
|
||||
|
||||
if (m_AssetLoader != null)
|
||||
{
|
||||
IConfig assetConfig = config.Configs["AssetService"];
|
||||
if (assetConfig == null)
|
||||
throw new Exception("No AssetService configuration");
|
||||
|
||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
|
||||
String.Empty);
|
||||
|
||||
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
|
||||
|
||||
if (assetLoaderEnabled)
|
||||
{
|
||||
m_log.DebugFormat("[XASSET SERVICE]: Loading default asset set from {0}", loaderArgs);
|
||||
|
||||
m_AssetLoader.ForEachDefaultXmlAsset(
|
||||
loaderArgs,
|
||||
delegate(AssetBase a)
|
||||
{
|
||||
AssetBase existingAsset = Get(a.ID);
|
||||
// AssetMetadata existingMetadata = GetMetadata(a.ID);
|
||||
|
||||
if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data))
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID);
|
||||
Store(a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m_log.Debug("[XASSET SERVICE]: Local asset service enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual AssetBase Get(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
{
|
||||
m_log.WarnFormat("[XASSET SERVICE]: Could not parse requested asset id {0}", id);
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return m_Database.GetAsset(assetID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[XASSET SERVICE]: Exception getting asset {0} {1}", assetID, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual AssetBase GetCached(string id)
|
||||
{
|
||||
return Get(id);
|
||||
}
|
||||
|
||||
public virtual AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
return null;
|
||||
|
||||
AssetBase asset = m_Database.GetAsset(assetID);
|
||||
if (asset != null)
|
||||
return asset.Metadata;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual byte[] GetData(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
return null;
|
||||
|
||||
AssetBase asset = m_Database.GetAsset(assetID);
|
||||
return asset.Data;
|
||||
}
|
||||
|
||||
public virtual bool Get(string id, Object sender, AssetRetrieved handler)
|
||||
{
|
||||
//m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
return false;
|
||||
|
||||
AssetBase asset = m_Database.GetAsset(assetID);
|
||||
|
||||
//m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset);
|
||||
|
||||
handler(id, sender, asset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual string Store(AssetBase asset)
|
||||
{
|
||||
if (!m_Database.ExistsAsset(asset.FullID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
||||
m_Database.StoreAsset(asset);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET SERVICE]: Not storing asset {0} {1}, bytes {2} as it already exists", asset.Name, asset.FullID, asset.Data.Length);
|
||||
// }
|
||||
|
||||
return asset.ID;
|
||||
}
|
||||
|
||||
public bool UpdateContent(string id, byte[] data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool Delete(string id)
|
||||
{
|
||||
m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id);
|
||||
UUID assetID;
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
return false;
|
||||
|
||||
AssetBase asset = m_Database.GetAsset(assetID);
|
||||
if (asset == null)
|
||||
return false;
|
||||
|
||||
if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
|
||||
{
|
||||
return m_Database.Delete(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[XASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,24 @@ namespace OpenSim.Services.Connectors
|
|||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Dictionary<IAssetService, object> m_endpointSerializer = new Dictionary<IAssetService, object>();
|
||||
private object EndPointLock(IAssetService connector)
|
||||
{
|
||||
lock (m_endpointSerializer)
|
||||
{
|
||||
object eplock = null;
|
||||
|
||||
if (! m_endpointSerializer.TryGetValue(connector, out eplock))
|
||||
{
|
||||
eplock = new object();
|
||||
m_endpointSerializer.Add(connector, eplock);
|
||||
// m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
|
||||
}
|
||||
|
||||
return eplock;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
|
||||
|
||||
public HGAssetServiceConnector(IConfigSource source)
|
||||
|
@ -197,7 +215,8 @@ namespace OpenSim.Services.Connectors
|
|||
IAssetService connector = GetConnector(url);
|
||||
// Restore the assetID to a simple UUID
|
||||
asset.ID = assetID;
|
||||
return connector.Store(asset);
|
||||
lock (EndPointLock(connector))
|
||||
return connector.Store(asset);
|
||||
}
|
||||
|
||||
return String.Empty;
|
||||
|
|
|
@ -84,14 +84,14 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
if (MainConsole.Instance != null)
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand("grid", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"show region",
|
||||
"show region <Region name>",
|
||||
"Show details on a region",
|
||||
String.Empty,
|
||||
HandleShowRegion);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("grid", true,
|
||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||
"set region flags",
|
||||
"set region flags <Region name> <flags>",
|
||||
"Set database flags for region",
|
||||
|
|
|
@ -296,9 +296,10 @@ namespace OpenSim.Services.HypergridService
|
|||
aCircuit.firstname = account.FirstName;
|
||||
aCircuit.lastname = account.LastName;
|
||||
}
|
||||
if (account == null && !aCircuit.lastname.StartsWith("@"))
|
||||
if (account == null)
|
||||
{
|
||||
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
|
||||
if (!aCircuit.lastname.StartsWith("@"))
|
||||
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString());
|
||||
|
|
|
@ -173,6 +173,12 @@ namespace OpenSim.Services.LLLoginService
|
|||
// Web map
|
||||
private string mapTileURL;
|
||||
|
||||
// Web Profiles
|
||||
private string profileURL;
|
||||
|
||||
// OpenID
|
||||
private string openIDURL;
|
||||
|
||||
private string searchURL;
|
||||
|
||||
// Error Flags
|
||||
|
@ -225,7 +231,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
|
||||
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
|
||||
string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
|
||||
GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency)
|
||||
GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency)
|
||||
: this()
|
||||
{
|
||||
FillOutInventoryData(invSkel, libService);
|
||||
|
@ -242,6 +248,9 @@ namespace OpenSim.Services.LLLoginService
|
|||
BuddList = ConvertFriendListItem(friendsList);
|
||||
StartLocation = where;
|
||||
MapTileURL = mapTileURL;
|
||||
ProfileURL = profileURL;
|
||||
OpenIDURL = openIDURL;
|
||||
|
||||
SearchURL = searchURL;
|
||||
Currency = currency;
|
||||
|
||||
|
@ -390,6 +399,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
InitialOutfitHash["gender"] = "female";
|
||||
initialOutfit.Add(InitialOutfitHash);
|
||||
mapTileURL = String.Empty;
|
||||
profileURL = String.Empty;
|
||||
openIDURL = String.Empty;
|
||||
searchURL = String.Empty;
|
||||
|
||||
currency = String.Empty;
|
||||
|
@ -462,6 +473,13 @@ namespace OpenSim.Services.LLLoginService
|
|||
if (mapTileURL != String.Empty)
|
||||
responseData["map-server-url"] = mapTileURL;
|
||||
|
||||
if (profileURL != String.Empty)
|
||||
responseData["profile-server-url"] = profileURL;
|
||||
|
||||
// We need to send an openid_token back in the response too
|
||||
if (openIDURL != String.Empty)
|
||||
responseData["openid_url"] = openIDURL;
|
||||
|
||||
if (m_buddyList != null)
|
||||
{
|
||||
responseData["buddy-list"] = m_buddyList.ToArray();
|
||||
|
@ -567,6 +585,12 @@ namespace OpenSim.Services.LLLoginService
|
|||
if (mapTileURL != String.Empty)
|
||||
map["map-server-url"] = OSD.FromString(mapTileURL);
|
||||
|
||||
if (profileURL != String.Empty)
|
||||
map["profile-server-url"] = OSD.FromString(profileURL);
|
||||
|
||||
if (openIDURL != String.Empty)
|
||||
map["openid_url"] = OSD.FromString(openIDURL);
|
||||
|
||||
if (searchURL != String.Empty)
|
||||
map["search"] = OSD.FromString(searchURL);
|
||||
|
||||
|
@ -939,6 +963,18 @@ namespace OpenSim.Services.LLLoginService
|
|||
set { mapTileURL = value; }
|
||||
}
|
||||
|
||||
public string ProfileURL
|
||||
{
|
||||
get { return profileURL; }
|
||||
set { profileURL = value; }
|
||||
}
|
||||
|
||||
public string OpenIDURL
|
||||
{
|
||||
get { return openIDURL; }
|
||||
set { openIDURL = value; }
|
||||
}
|
||||
|
||||
public string SearchURL
|
||||
{
|
||||
get { return searchURL; }
|
||||
|
|
|
@ -74,6 +74,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
protected string m_GatekeeperURL;
|
||||
protected bool m_AllowRemoteSetLoginLevel;
|
||||
protected string m_MapTileURL;
|
||||
protected string m_ProfileURL;
|
||||
protected string m_OpenIDURL;
|
||||
protected string m_SearchURL;
|
||||
protected string m_Currency;
|
||||
|
||||
|
@ -108,6 +110,8 @@ namespace OpenSim.Services.LLLoginService
|
|||
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
|
||||
m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
|
||||
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
|
||||
m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
|
||||
m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
|
||||
m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
|
||||
m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
|
||||
|
||||
|
@ -420,7 +424,7 @@ namespace OpenSim.Services.LLLoginService
|
|||
// Finally, fill out the response and return it
|
||||
//
|
||||
LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency);
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency);
|
||||
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
||||
return response;
|
||||
|
@ -896,16 +900,16 @@ namespace OpenSim.Services.LLLoginService
|
|||
private void RegisterCommands()
|
||||
{
|
||||
//MainConsole.Instance.Commands.AddCommand
|
||||
MainConsole.Instance.Commands.AddCommand("loginservice", false, "login level",
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false, "login level",
|
||||
"login level <level>",
|
||||
"Set the minimum user level to log in", HandleLoginCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("loginservice", false, "login reset",
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false, "login reset",
|
||||
"login reset",
|
||||
"Reset the login level to allow all users",
|
||||
HandleLoginCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("loginservice", false, "login text",
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false, "login text",
|
||||
"login text <text>",
|
||||
"Set the text users will see on login", HandleLoginCommand);
|
||||
|
||||
|
|
|
@ -89,17 +89,17 @@ namespace OpenSim.Services.UserAccountService
|
|||
if (m_RootInstance == null && MainConsole.Instance != null)
|
||||
{
|
||||
m_RootInstance = this;
|
||||
MainConsole.Instance.Commands.AddCommand("UserService", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||
"create user",
|
||||
"create user [<first> [<last> [<pass> [<email> [<user id>]]]]]",
|
||||
"Create a new user", HandleCreateUser);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("UserService", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||
"reset user password",
|
||||
"reset user password [<first> [<last> [<password>]]]",
|
||||
"Reset a user password", HandleResetUserPassword);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("UserService", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||
"set user level",
|
||||
"set user level [<first> [<last> [<level>]]]",
|
||||
"Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, "
|
||||
|
@ -107,7 +107,7 @@ namespace OpenSim.Services.UserAccountService
|
|||
+ "It will also affect the 'login level' command. ",
|
||||
HandleSetUserLevel);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("UserService", false,
|
||||
MainConsole.Instance.Commands.AddCommand("Users", false,
|
||||
"show account",
|
||||
"show account <first> <last>",
|
||||
"Show account details for the given user", HandleShowAccount);
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace OpenSim.Tests.Common
|
|||
Console.WriteLine("Setting up test scene {0}", name);
|
||||
|
||||
// We must set up a console otherwise setup of some modules may fail
|
||||
MainConsole.Instance = new MockConsole("TEST PROMPT");
|
||||
MainConsole.Instance = new MockConsole();
|
||||
|
||||
RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
|
||||
regInfo.RegionName = name;
|
||||
|
@ -136,7 +136,7 @@ namespace OpenSim.Tests.Common
|
|||
StartAuthenticationService(testScene);
|
||||
LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);
|
||||
StartGridService(testScene);
|
||||
LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
|
||||
LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
|
||||
LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
|
||||
|
||||
inventoryService.PostInitialise();
|
||||
|
|
|
@ -177,9 +177,9 @@ namespace OpenSim.Data.Null
|
|||
// Therefore, we need to store parts rather than groups.
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
|
||||
prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
|
||||
// m_log.DebugFormat(
|
||||
// "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
|
||||
// prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
|
||||
|
||||
m_sceneObjectParts[prim.UUID] = prim;
|
||||
}
|
||||
|
@ -193,9 +193,9 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
if (part.ParentGroup.UUID == obj)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
|
||||
part.Name, part.UUID, obj, regionUUID);
|
||||
// m_log.DebugFormat(
|
||||
// "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
|
||||
// part.Name, part.UUID, obj, regionUUID);
|
||||
m_sceneObjectParts.Remove(part.UUID);
|
||||
}
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
if (prim.IsRoot)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
|
||||
// m_log.DebugFormat(
|
||||
// "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
|
||||
objects[prim.UUID] = new SceneObjectGroup(prim);
|
||||
}
|
||||
}
|
||||
|
@ -240,9 +240,9 @@ namespace OpenSim.Data.Null
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
|
||||
prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
|
||||
// m_log.WarnFormat(
|
||||
// "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
|
||||
// prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,11 @@ namespace OpenSim.Tests.Torture
|
|||
[TestFixtureTearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
scene.Close();
|
||||
scene = null;
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
|
||||
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
|
||||
// threads. Possibly, later tests should be rewritten not to worry about such things.
|
||||
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
||||
|
@ -98,7 +103,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemove100NPCs()
|
||||
public void Test_0001_AddRemove100NPCs()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -107,7 +112,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemove1000NPCs()
|
||||
public void Test_0002_AddRemove1000NPCs()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -116,7 +121,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRemove2000NPCs()
|
||||
public void Test_0003_AddRemove2000NPCs()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Tests.Torture
|
|||
// }
|
||||
|
||||
[Test]
|
||||
public void Test0001_10K_1PrimObjects()
|
||||
public void Test_0001_10K_1PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -75,7 +75,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void Test0002_100K_1PrimObjects()
|
||||
public void Test_0002_100K_1PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -84,7 +84,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void Test0003_200K_1PrimObjects()
|
||||
public void Test_0003_200K_1PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -93,7 +93,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void Test0011_100_100PrimObjects()
|
||||
public void Test_0011_100_100PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -102,7 +102,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void Test0012_1K_100PrimObjects()
|
||||
public void Test_0012_1K_100PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -111,7 +111,7 @@ namespace OpenSim.Tests.Torture
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void Test0013_2K_100PrimObjects()
|
||||
public void Test_0013_2K_100PrimObjects()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -123,6 +123,9 @@ namespace OpenSim.Tests.Torture
|
|||
{
|
||||
UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");
|
||||
|
||||
// Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage
|
||||
// collected when we teardown this test. If it's done in a member variable, even if that is subsequently
|
||||
// nulled out, the garbage collect can be delayed.
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
|
||||
// Process process = Process.GetCurrentProcess();
|
||||
|
@ -156,11 +159,6 @@ namespace OpenSim.Tests.Torture
|
|||
// objects will be clean up by the garbage collector before the next stress test is run.
|
||||
scene.Update();
|
||||
|
||||
// Currently, we need to do this in order to garbage collect the scene objects ready for the next test run.
|
||||
// However, what we really need to do is find out why the entire scene is not garbage collected in
|
||||
// teardown.
|
||||
scene.DeleteAllSceneObjects();
|
||||
|
||||
Console.WriteLine(
|
||||
"Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",
|
||||
Math.Round(elapsed.TotalMilliseconds),
|
||||
|
@ -170,7 +168,8 @@ namespace OpenSim.Tests.Torture
|
|||
objectsToAdd,
|
||||
primsInEachObject);
|
||||
|
||||
scene = null;
|
||||
scene.Close();
|
||||
// scene = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -91,6 +91,15 @@ namespace OpenSim.Tests.Torture
|
|||
m_scene.StartScripts();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
m_scene.Close();
|
||||
m_scene = null;
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompileAndStart100Scripts()
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue