diff --git a/Source/OpenSim.ApplicationPlugins.LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj b/Source/OpenSim.ApplicationPlugins.LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj index 1cfea52ecde..fb895db4721 100644 --- a/Source/OpenSim.ApplicationPlugins.LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj +++ b/Source/OpenSim.ApplicationPlugins.LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.csproj @@ -11,7 +11,7 @@ - + diff --git a/Source/OpenSim.ApplicationPlugins.RegionModulesController/OpenSim.ApplicationPlugins.RegionModulesController.csproj b/Source/OpenSim.ApplicationPlugins.RegionModulesController/OpenSim.ApplicationPlugins.RegionModulesController.csproj index 8df2ee77b83..0c333ea9e0e 100644 --- a/Source/OpenSim.ApplicationPlugins.RegionModulesController/OpenSim.ApplicationPlugins.RegionModulesController.csproj +++ b/Source/OpenSim.ApplicationPlugins.RegionModulesController/OpenSim.ApplicationPlugins.RegionModulesController.csproj @@ -12,7 +12,7 @@ - + diff --git a/Source/OpenSim.ApplicationPlugins.RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj b/Source/OpenSim.ApplicationPlugins.RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj index e432ff8bd4e..770eacf7a43 100644 --- a/Source/OpenSim.ApplicationPlugins.RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj +++ b/Source/OpenSim.ApplicationPlugins.RemoteController/OpenSim.ApplicationPlugins.RemoteController.csproj @@ -11,7 +11,7 @@ - + diff --git a/Source/OpenSim.Capabilities/Caps.cs b/Source/OpenSim.Capabilities/Caps.cs index 7d5182db799..b38c53a2e09 100644 --- a/Source/OpenSim.Capabilities/Caps.cs +++ b/Source/OpenSim.Capabilities/Caps.cs @@ -25,13 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; using System.Collections.Concurrent; -using System.Reflection; -using System.Threading; -using log4net; +using Microsoft.Extensions.Logging; using OpenMetaverse; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -49,26 +45,29 @@ namespace OpenSim.Framework.Capabilities public class Caps : IDisposable { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILogger _logger; - private readonly string m_httpListenerHostName; - private readonly uint m_httpListenPort; + private string m_httpListenerHostName; + private uint m_httpListenPort; /// /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester. /// - private readonly string m_capsObjectPath; - public string CapsObjectPath { get { return m_capsObjectPath; } } + private string m_capsObjectPath; - private readonly CapsHandlers m_capsHandlers; - private readonly ConcurrentDictionary m_pollServiceHandlers = new (); - private readonly Dictionary m_externalCapsHandlers = new (); + private CapsHandlers m_capsHandlers; + + private ConcurrentDictionary m_pollServiceHandlers = new(); + private Dictionary m_externalCapsHandlers = new(); - private readonly IHttpServer m_httpListener; - private readonly UUID m_agentID; - private readonly string m_regionName; + private IHttpServer m_httpListener; + private UUID m_agentID; + private string m_regionName; private ManualResetEvent m_capsActive = new(false); + public string CapsObjectPath { get { return m_capsObjectPath; } } + + public UUID AgentID { get { return m_agentID; } @@ -127,8 +126,19 @@ public enum CapsFlags:uint public CapsFlags Flags { get; set;} - public Caps(IHttpServer httpServer, string httpListen, uint httpPort, string capsPath, - UUID agent, string regionName) + // Construct using DI or Resolve on container + public Caps(ILogger logger) + { + _logger = logger; + } + + public void Initialize( + IHttpServer httpServer, + string httpListen, + uint httpPort, + string capsPath, + UUID agent, + string regionName) { m_capsObjectPath = capsPath; m_httpListener = httpServer; @@ -195,11 +205,12 @@ public void RegisterPollHandler(string capName, PollServiceEventArgs pollService // "[CAPS]: Registering handler with name {0}, url {1} for {2}", // capName, pollServiceHandler.Url, m_agentID, m_regionName); - if(!m_pollServiceHandlers.TryAdd(capName, pollServiceHandler)) + if (m_pollServiceHandlers.TryAdd(capName, pollServiceHandler) is false) { - m_log.ErrorFormat( - "[CAPS]: Handler with name {0} already registered (ulr {1}, agent {2}, region {3}", - capName, pollServiceHandler.Url, m_agentID, m_regionName); + _logger.LogError( + $"[CAPS]: Handler with name {capName} already registered " + + $"(ulr {pollServiceHandler.Url}, agent {m_agentID}, region {m_regionName}"); + return; } diff --git a/Source/OpenSim.Capabilities/OpenSim.Capabilities.csproj b/Source/OpenSim.Capabilities/OpenSim.Capabilities.csproj index 4ff34f99f62..dc493c8b614 100644 --- a/Source/OpenSim.Capabilities/OpenSim.Capabilities.csproj +++ b/Source/OpenSim.Capabilities/OpenSim.Capabilities.csproj @@ -25,7 +25,5 @@ - - diff --git a/Source/OpenSim.Data.Model/OpenSim.Data.Model.csproj b/Source/OpenSim.Data.Model/OpenSim.Data.Model.csproj index e362cf2c6c8..d874ada36cb 100644 --- a/Source/OpenSim.Data.Model/OpenSim.Data.Model.csproj +++ b/Source/OpenSim.Data.Model/OpenSim.Data.Model.csproj @@ -8,20 +8,20 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/Source/OpenSim.Data.MySQL.MoneyData/OpenSim.Data.MySQL.MoneyData.csproj b/Source/OpenSim.Data.MySQL.MoneyData/OpenSim.Data.MySQL.MoneyData.csproj deleted file mode 100644 index 68365bb14e5..00000000000 --- a/Source/OpenSim.Data.MySQL.MoneyData/OpenSim.Data.MySQL.MoneyData.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - Local - net8.0 - OpenSim.Data.MySQL.MoneyData - OpenSim - OpenSim.Data.MySQL.MoneyData - - - - - - - - ..\..\bin\OpenMetaverse.dll - False - - - ..\..\bin\OpenMetaverseTypes.dll - False - - - ..\..\bin\XMLRPC.dll - False - - - - - - - - - - - - - diff --git a/Source/OpenSim.Data.MySQL.MoneyData/MySQLMoneyManager.cs b/Source/OpenSim.Data.MySQL/MySQLMoneyManager.cs similarity index 99% rename from Source/OpenSim.Data.MySQL.MoneyData/MySQLMoneyManager.cs rename to Source/OpenSim.Data.MySQL/MySQLMoneyManager.cs index bf9d252826c..74ff3d6fa5e 100644 --- a/Source/OpenSim.Data.MySQL.MoneyData/MySQLMoneyManager.cs +++ b/Source/OpenSim.Data.MySQL/MySQLMoneyManager.cs @@ -33,7 +33,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -namespace OpenSim.Data.MySQL.MoneyData +namespace OpenSim.Data.MySQL { public class MySQLMoneyManager : IMoneyManager { @@ -1345,7 +1345,7 @@ public bool setTotalSale(string userUUID, string objectUUID, int type, int count // // transactions // - public bool addTransaction(TransactionData transaction) + public bool addTransaction(MoneyTransactionData transaction) { bool bRet = false; string sql = string.Empty; @@ -1462,9 +1462,9 @@ public bool ValidateTransfer(string secureCode, UUID transactionID) } - public TransactionData FetchTransaction(UUID transactionID) + public MoneyTransactionData FetchTransaction(UUID transactionID) { - TransactionData transactionData = new TransactionData(); + MoneyTransactionData transactionData = new MoneyTransactionData(); transactionData.TransUUID = transactionID; string sql = string.Empty; @@ -1514,9 +1514,9 @@ public TransactionData FetchTransaction(UUID transactionID) } - public TransactionData[] FetchTransaction(string userID, int startTime, int endTime, uint index, uint retNum) + public MoneyTransactionData[] FetchTransaction(string userID, int startTime, int endTime, uint index, uint retNum) { - List rows = new List(); + List rows = new List(); string sql = string.Empty; sql = "SELECT * FROM " + Table_of_Transactions + " WHERE time>=?start AND time<=?end "; @@ -1537,7 +1537,7 @@ public TransactionData[] FetchTransaction(string userID, int startTime, int endT { try { - TransactionData transactionData = new TransactionData(); + MoneyTransactionData transactionData = new MoneyTransactionData(); string uuid = (string)r["UUID"]; UUID transUUID; UUID.TryParse(uuid, out transUUID); diff --git a/Source/OpenSim.Data.MySQL.MoneyData/MySQLSuperManager.cs b/Source/OpenSim.Data.MySQL/MySQLSuperManager.cs similarity index 98% rename from Source/OpenSim.Data.MySQL.MoneyData/MySQLSuperManager.cs rename to Source/OpenSim.Data.MySQL/MySQLSuperManager.cs index 7bcf6fdf6a6..8fb053bcfe5 100644 --- a/Source/OpenSim.Data.MySQL.MoneyData/MySQLSuperManager.cs +++ b/Source/OpenSim.Data.MySQL/MySQLSuperManager.cs @@ -26,7 +26,7 @@ */ using System.Threading; -namespace OpenSim.Data.MySQL.MoneyData +namespace OpenSim.Data.MySQL { // This bit of code is from OpenSim.Data.MySQLSuperManager public class MySQLSuperManager diff --git a/Source/OpenSim.Data.MySQL.MoneyData/IMoneyManager.cs b/Source/OpenSim.Data/IMoneyManager.cs similarity index 90% rename from Source/OpenSim.Data.MySQL.MoneyData/IMoneyManager.cs rename to Source/OpenSim.Data/IMoneyManager.cs index d66a3e7c569..fcc98661702 100644 --- a/Source/OpenSim.Data.MySQL.MoneyData/IMoneyManager.cs +++ b/Source/OpenSim.Data/IMoneyManager.cs @@ -27,7 +27,7 @@ using OpenMetaverse; -namespace OpenSim.Data.MySQL.MoneyData +namespace OpenSim.Data { public interface IMoneyManager { @@ -43,13 +43,13 @@ public interface IMoneyManager bool giveMoney(UUID transactionID, string receiverID, int amount); - bool addTransaction(TransactionData transaction); + bool addTransaction(MoneyTransactionData transaction); bool updateTransactionStatus(UUID transactionID, int status, string description); - TransactionData FetchTransaction(UUID transactionID); + MoneyTransactionData FetchTransaction(UUID transactionID); - TransactionData[] FetchTransaction(string userID, int startTime, int endTime, uint index, uint retNum); + MoneyTransactionData[] FetchTransaction(string userID, int startTime, int endTime, uint index, uint retNum); int getTransactionNum(string userID, int startTime, int endTime); diff --git a/Source/OpenSim.Data/Migration.cs b/Source/OpenSim.Data/Migration.cs index e54bf55a7b7..0537e886182 100644 --- a/Source/OpenSim.Data/Migration.cs +++ b/Source/OpenSim.Data/Migration.cs @@ -25,14 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Data; +using Microsoft.Extensions.Logging; using System.Data.Common; -using System.IO; using System.Reflection; using System.Text.RegularExpressions; -using log4net; + namespace OpenSim.Data { @@ -69,8 +66,6 @@ namespace OpenSim.Data /// public class Migration { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected string _type; protected DbConnection _conn; protected Assembly _assem; @@ -78,21 +73,28 @@ public class Migration private Regex _match_old; private Regex _match_new; + protected readonly ILogger _logger; + /// Have the parameterless constructor just so we can specify it as a generic parameter with the new() constraint. /// Currently this is only used in the tests. A Migration instance created this way must be then /// initialized with Initialize(). Regular creation should be through the parameterized constructors. /// - public Migration() + public Migration(ILogger logger) { + _logger = logger; } - public Migration(DbConnection conn, Assembly assem, string subtype, string type) + public Migration(ILogger logger, DbConnection conn, Assembly assem, string subtype, string type) { + _logger = logger; + Initialize(conn, assem, type, subtype); } - public Migration(DbConnection conn, Assembly assem, string type) + public Migration(ILogger logger, DbConnection conn, Assembly assem, string type) { + _logger = logger; + Initialize(conn, assem, type, ""); } @@ -183,8 +185,8 @@ public void Update() return; // to prevent people from killing long migrations. - m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); - m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!"); + _logger.LogInformation($"[MIGRATIONS]: Upgrading {_type} to latest revision {migrations.Keys[migrations.Count - 1]}"); + _logger.LogInformation($"[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!"); foreach (KeyValuePair kvp in migrations) { @@ -203,8 +205,8 @@ public void Update() } catch (Exception e) { - m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " ")); - m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. If you're running OpenSim for the first time then you can probably safely ignore this, since certain migration commands attempt to fetch data out of old tables. However, if you're using an existing database and you see database related errors while running OpenSim then you will need to fix these problems manually. Continuing."); + _logger.LogDebug($"[MIGRATIONS]: Cmd was {e.Message.Replace("\n", " ")}"); + _logger.LogDebug("[MIGRATIONS]: An error has occurred in the migration. If you're running OpenSim for the first time then you can probably safely ignore this, since certain migration commands attempt to fetch data out of old tables. However, if you're using an existing database and you see database related errors while running OpenSim then you will need to fix these problems manually. Continuing."); ExecuteScript("ROLLBACK;"); } @@ -263,14 +265,14 @@ protected virtual int FindVersion(DbConnection conn, string type) private void InsertVersion(string type, int version) { - m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); - ExecuteScript("insert into migrations(name, version) values('" + type + "', " + version + ")"); + _logger.LogInformation($"[MIGRATIONS]: Creating {type} at version {version}"); + ExecuteScript($"insert into migrations(name, version) values('{type}', {version})"); } private void UpdateVersion(string type, int version) { - m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); - ExecuteScript("update migrations set version=" + version + " where name='" + type + "'"); + _logger.LogInformation($"[MIGRATIONS]: Updating {type} to version {version}"); + ExecuteScript($"update migrations set version={version} where name='{type}'"); } private delegate void FlushProc(); @@ -367,7 +369,7 @@ private SortedList GetMigrationsAfter(int after) if (!int.TryParse(sLine.Substring(9).Trim(), out nVersion)) { - m_log.ErrorFormat("[MIGRATIONS]: invalid version marker at {0}: line {1}. Migration failed!", sFile, nLineNo); + _logger.LogError($"[MIGRATIONS]: invalid version marker at {sFile}: line {nLineNo}. Migration failed!"); break; } } @@ -407,7 +409,9 @@ private SortedList GetMigrationsAfter(int after) } if (migrations.Count < 1) - m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after); + { + _logger.LogDebug($"[MIGRATIONS]: {_type} data tables already up to date at revision {after}"); + } return migrations; } diff --git a/Source/OpenSim.Data.MySQL.MoneyData/TransactionData.cs b/Source/OpenSim.Data/MoneyTransactionData.cs similarity index 97% rename from Source/OpenSim.Data.MySQL.MoneyData/TransactionData.cs rename to Source/OpenSim.Data/MoneyTransactionData.cs index 4a37d217be4..1bf64d900a9 100644 --- a/Source/OpenSim.Data.MySQL.MoneyData/TransactionData.cs +++ b/Source/OpenSim.Data/MoneyTransactionData.cs @@ -27,9 +27,9 @@ using OpenMetaverse; -namespace OpenSim.Data.MySQL.MoneyData +namespace OpenSim.Data { - public class TransactionData + public class MoneyTransactionData { UUID m_uuid; string m_sender = string.Empty; @@ -50,7 +50,7 @@ public class TransactionData string m_description = string.Empty; /* - public TransactionData(string uuid, string sender, string receiver, + public MoneyTransactionData(string uuid, string sender, string receiver, int amount, int time, int status, string description) { this.m_uuid = uuid; diff --git a/Source/OpenSim.Data/OpenSim.Data.csproj b/Source/OpenSim.Data/OpenSim.Data.csproj index eb4bdda92f4..ba7813b2bb6 100644 --- a/Source/OpenSim.Data/OpenSim.Data.csproj +++ b/Source/OpenSim.Data/OpenSim.Data.csproj @@ -32,9 +32,7 @@ - - diff --git a/Source/OpenSim.Framework.AssetLoader.Filesystem/AssetLoaderFileSystem.cs b/Source/OpenSim.Framework.AssetLoader.Filesystem/AssetLoaderFileSystem.cs index 317ca8866b8..6fbd09d5fdf 100644 --- a/Source/OpenSim.Framework.AssetLoader.Filesystem/AssetLoaderFileSystem.cs +++ b/Source/OpenSim.Framework.AssetLoader.Filesystem/AssetLoaderFileSystem.cs @@ -25,15 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; using System.Xml; -using log4net; -using Nini.Config; + using OpenMetaverse; +using Microsoft.Extensions.Logging; + + /// /// Loads assets from the filesystem location. Not yet a plugin, though it should be. /// @@ -43,10 +41,14 @@ public class AssetLoaderFileSystem : IAssetLoader { private static readonly UUID LIBRARY_OWNER_ID = new UUID("11111111-1111-0000-0000-000100bba000"); private static readonly string LIBRARY_OWNER_IDstr = "11111111-1111-0000-0000-000100bba000"; + private readonly ILogger _logger; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public AssetLoaderFileSystem(ILogger logger) + { + _logger = logger; + } - protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) + protected AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) { AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_IDstr); @@ -59,13 +61,13 @@ protected static AssetBase CreateAsset(string assetIdStr, string name, string pa else { asset.Data = Array.Empty(); - m_log.InfoFormat("[ASSETS]: Instantiated: [{0}]", name); + _logger.LogInformation($"[ASSETS]: Instantiated: [{name}"); } return asset; } - protected static void LoadAsset(AssetBase info, string path) + protected void LoadAsset(AssetBase info, string path) { // bool image = // (info.Type == (sbyte)AssetType.Texture || @@ -75,7 +77,8 @@ protected static void LoadAsset(AssetBase info, string path) FileInfo fInfo = new FileInfo(path); long numBytes = fInfo.Length; - if (fInfo.Exists) + + if (fInfo.Exists) { FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read); byte[] idata = new byte[numBytes]; @@ -87,39 +90,40 @@ protected static void LoadAsset(AssetBase info, string path) //info.loaded=true; } else - { - m_log.ErrorFormat("[ASSETS]: file: [{0}] not found !", path); + { + _logger.LogError($"[ASSETS]: file: [{path}] not found !"); } } public void ForEachDefaultXmlAsset(string assetSetFilename, Action action) { List assets = new List(); + if (File.Exists(assetSetFilename)) { string assetSetPath = "ERROR"; string assetRootPath = ""; try { - XmlConfigSource source = new XmlConfigSource(assetSetFilename); - assetRootPath = Path.GetFullPath(source.SavePath); - assetRootPath = Path.GetDirectoryName(assetRootPath); + //XmlConfigSource source = new XmlConfigSource(assetSetFilename); + //assetRootPath = Path.GetFullPath(source.SavePath); + //assetRootPath = Path.GetDirectoryName(assetRootPath); - for (int i = 0; i < source.Configs.Count; i++) - { - assetSetPath = source.Configs[i].GetString("file", String.Empty); + //for (int i = 0; i < source.Configs.Count; i++) + //{ + // assetSetPath = source.Configs[i].GetString("file", String.Empty); - LoadXmlAssetSet(Path.Combine(assetRootPath, assetSetPath), assets); - } + // LoadXmlAssetSet(Path.Combine(assetRootPath, assetSetPath), assets); + //} } catch (XmlException e) { - m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e.Message); + _logger.LogError(e, $"[ASSETS]: Error loading {assetSetPath}"); } } else { - m_log.ErrorFormat("[ASSETS]: Asset set control file {0} does not exist! No assets loaded.", assetSetFilename); + _logger.LogError($"[ASSETS]: Asset set control file {assetSetFilename} does not exist! No assets loaded."); } assets.ForEach(action); @@ -130,7 +134,7 @@ public void ForEachDefaultXmlAsset(string assetSetFilename, Action ac /// /// /// - protected static void LoadXmlAssetSet(string assetSetPath, List assets) + protected void LoadXmlAssetSet(string assetSetPath, List assets) { //m_log.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath); @@ -138,34 +142,34 @@ protected static void LoadXmlAssetSet(string assetSetPath, List asset { try { - XmlConfigSource source = new XmlConfigSource(assetSetPath); - String dir = Path.GetDirectoryName(assetSetPath); - - for (int i = 0; i < source.Configs.Count; i++) - { - string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); - string name = source.Configs[i].GetString("name", String.Empty); - sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); - - string assetPath = source.Configs[i].GetString("fileName", String.Empty); - AssetBase newAsset; - if (string.IsNullOrEmpty(assetPath)) - newAsset = CreateAsset(assetIdStr, name, null, type); - else - newAsset = CreateAsset(assetIdStr, name, Path.Combine(dir, assetPath), type); - - newAsset.Type = type; - assets.Add(newAsset); - } + //XmlConfigSource source = new XmlConfigSource(assetSetPath); + //String dir = Path.GetDirectoryName(assetSetPath); + + //for (int i = 0; i < source.Configs.Count; i++) + //{ + // string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); + // string name = source.Configs[i].GetString("name", String.Empty); + // sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); + + // string assetPath = source.Configs[i].GetString("fileName", String.Empty); + // AssetBase newAsset; + // if (string.IsNullOrEmpty(assetPath)) + // newAsset = CreateAsset(assetIdStr, name, null, type); + // else + // newAsset = CreateAsset(assetIdStr, name, Path.Combine(dir, assetPath), type); + + // newAsset.Type = type; + // assets.Add(newAsset); + //} } catch (XmlException e) { - m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e.Message); + _logger.LogError(e, $"[ASSETS]: Error loading {assetSetPath}"); } } else { - m_log.ErrorFormat("[ASSETS]: Asset set file {0} does not exist!", assetSetPath); + _logger.LogError($"[ASSETS]: Asset set file {assetSetPath} does not exist!"); } } } diff --git a/Source/OpenSim.Framework.AssetLoader.Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj b/Source/OpenSim.Framework.AssetLoader.Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj index 2cef38dda3e..efabec5729e 100644 --- a/Source/OpenSim.Framework.AssetLoader.Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj +++ b/Source/OpenSim.Framework.AssetLoader.Filesystem/OpenSim.Framework.AssetLoader.Filesystem.csproj @@ -21,7 +21,5 @@ - - \ No newline at end of file diff --git a/Source/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj b/Source/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj index 596b39b64f4..e893af3bcef 100644 --- a/Source/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj +++ b/Source/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj @@ -8,7 +8,7 @@ - + diff --git a/Source/OpenSim.Framework.Console/OpenSimAppender.cs b/Source/OpenSim.Framework.Console/OpenSimAppender.cs deleted file mode 100644 index c2e650cab53..00000000000 --- a/Source/OpenSim.Framework.Console/OpenSimAppender.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 log4net.Appender; -using log4net.Core; - -namespace OpenSim.Framework.Console -{ - /// - /// Writes log information out onto the console - /// - public class OpenSimAppender : AnsiColorTerminalAppender - { - private ConsoleBase m_console = null; - - public ConsoleBase Console - { - get { return m_console; } - set { m_console = value; } - } - - override protected void Append(LoggingEvent le) - { - //if (m_console != null) - // m_console.LockOutput(); - - string loggingMessage = RenderLoggingEvent(le); - - try - { - if (m_console != null) - { - ConsoleLevel level; - - if (le.Level == Level.Error) - level = "error"; - else if (le.Level == Level.Warn) - level = "warn"; - else - level = "normal"; - - m_console.Output(loggingMessage, level); - } - else - { - if (!loggingMessage.EndsWith("\n")) - System.Console.WriteLine(loggingMessage); - else - System.Console.Write(loggingMessage); - } - } - catch (Exception e) - { - System.Console.WriteLine("Couldn't write out log message: {0}", e.ToString()); - } - /* - finally - { - if (m_console != null) - m_console.UnlockOutput(); - } - */ - } - } -} diff --git a/Source/OpenSim.Framework.Monitoring/ChecksManager.cs b/Source/OpenSim.Framework.Monitoring/ChecksManager.cs index f7190998a0c..5b0dcf26398 100755 --- a/Source/OpenSim.Framework.Monitoring/ChecksManager.cs +++ b/Source/OpenSim.Framework.Monitoring/ChecksManager.cs @@ -25,12 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using log4net; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework.Monitoring { @@ -39,8 +34,6 @@ namespace OpenSim.Framework.Monitoring /// public static class ChecksManager { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // Subcommand used to list other stats. public const string ListSubCommand = "list"; @@ -223,8 +216,9 @@ public static void CheckChecks() foreach (Check check in container.Values) { if (!check.CheckIt()) - m_log.WarnFormat( - "[CHECKS MANAGER]: Check {0}.{1}.{2} failed with message {3}", check.Category, check.Container, check.ShortName, check.LastFailureMessage); + { +// logger.LogWarning($"[CHECKS MANAGER]: Check {check.Category}.{check.Container}.{check.ShortName} failed with message {check.LastFailureMessage}"); + } } } } diff --git a/Source/OpenSim.Framework.Monitoring/JobEngine.cs b/Source/OpenSim.Framework.Monitoring/JobEngine.cs index 3f71811d36a..9c703b80f98 100644 --- a/Source/OpenSim.Framework.Monitoring/JobEngine.cs +++ b/Source/OpenSim.Framework.Monitoring/JobEngine.cs @@ -25,19 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; +using Microsoft.Extensions.Logging; using System.Collections.Concurrent; using System.Reflection; -using System.Threading; -using log4net; -using OpenSim.Framework; namespace OpenSim.Framework.Monitoring { public class JobEngine { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public int LogLevel { get; set; } private object JobLock = new object(); @@ -71,11 +66,14 @@ public class JobEngine private int m_timeout = -1; private int m_concurrency = 1; - private int m_numberThreads = 0; +// private readonly ILogger m_logger; + public JobEngine(string name, string loggingName, int timeout = -1, int concurrency = 1) { +// m_logger = logger; + Name = name; LoggingName = loggingName; m_timeout = timeout; @@ -104,7 +102,7 @@ public void Stop() if (!IsRunning) return; - m_log.DebugFormat("[JobEngine] Stopping {0}", Name); +// m_logger.LogDebug($"[JobEngine] Stopping {Name}"); IsRunning = false; if(m_numberThreads > 0) @@ -207,10 +205,7 @@ public bool QueueJob(Job job) { if (m_warnOverMaxQueue) { - m_log.WarnFormat( - "[{0}]: Job queue at maximum capacity, not recording job from {1} in {2}", - LoggingName, job.Name, Name); - +// m_logger.LogWarning($"[{LoggingName}]: Job queue at maximum capacity, not recording job from {job.Name} in {Name}"); m_warnOverMaxQueue = false; } return false; @@ -240,8 +235,10 @@ private void ProcessRequests(object o) break; } - if(LogLevel >= 1) - m_log.DebugFormat("[{0}]: Processing job {1}",LoggingName,currentJob.Name); + if (LogLevel >= 1) + { +// m_logger.LogDebug($"[{LoggingName}]: Processing job {currentJob.Name}"); + } try { @@ -249,18 +246,22 @@ private void ProcessRequests(object o) } catch(Exception e) { - m_log.ErrorFormat( - "[{0}]: Job {1} failed, continuing. Exception {2}",LoggingName, currentJob.Name, e); +// m_logger.LogError(e, $"[{LoggingName}]: Job {currentJob.Name} failed, continuing."); } - if(LogLevel >= 1) - m_log.DebugFormat("[{0}]: Processed job {1}",LoggingName,currentJob.Name); + if (LogLevel >= 1) + { +// m_logger.LogDebug($"[{LoggingName}]: Processed job {currentJob.Name}"); + } currentJob.Action = null; currentJob = null; } + lock (JobLock) + { --m_numberThreads; + } } public class Job diff --git a/Source/OpenSim.Framework.Monitoring/MemoryWatchdog.cs b/Source/OpenSim.Framework.Monitoring/MemoryWatchdog.cs index f2e47f8b44c..56caec9fbf7 100644 --- a/Source/OpenSim.Framework.Monitoring/MemoryWatchdog.cs +++ b/Source/OpenSim.Framework.Monitoring/MemoryWatchdog.cs @@ -25,13 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading; -using log4net; - namespace OpenSim.Framework.Monitoring { /// @@ -39,8 +32,6 @@ namespace OpenSim.Framework.Monitoring /// public static class MemoryWatchdog { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Is this watchdog active? /// diff --git a/Source/OpenSim.Framework.Monitoring/OpenSim.Framework.Monitoring.csproj b/Source/OpenSim.Framework.Monitoring/OpenSim.Framework.Monitoring.csproj index 117e6305c6e..20bec9ca040 100644 --- a/Source/OpenSim.Framework.Monitoring/OpenSim.Framework.Monitoring.csproj +++ b/Source/OpenSim.Framework.Monitoring/OpenSim.Framework.Monitoring.csproj @@ -28,9 +28,7 @@ - - diff --git a/Source/OpenSim.Framework.Monitoring/StatsLogger.cs b/Source/OpenSim.Framework.Monitoring/StatsLogger.cs index cfd6536030e..d6c9431f3c7 100755 --- a/Source/OpenSim.Framework.Monitoring/StatsLogger.cs +++ b/Source/OpenSim.Framework.Monitoring/StatsLogger.cs @@ -25,13 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; +using Microsoft.Extensions.Logging; using System.Timers; -using log4net; namespace OpenSim.Framework.Monitoring { @@ -40,11 +35,11 @@ namespace OpenSim.Framework.Monitoring /// public static class StatsLogger { - private static readonly ILog m_statsLog = LogManager.GetLogger("special.StatsLogger"); + private const string loggerCategory = "special.StatsLogger"; private static System.Timers.Timer m_loggingTimer; private static int m_statsLogIntervalMs = 5000; - + public static void RegisterConsoleCommands(ICommandConsole console) { console.Commands.AddCommand( @@ -130,8 +125,8 @@ public static void Stop() private static void Log(object sender, ElapsedEventArgs e) { - foreach (string line in GetReport()) - m_statsLog.Info(line); + foreach (string line in GetReport()) ; + //m_logger?.LogInformation(line); m_loggingTimer.Start(); } diff --git a/Source/OpenSim.Framework.Monitoring/Watchdog.cs b/Source/OpenSim.Framework.Monitoring/Watchdog.cs index 7b9b92214bb..67512b4fca2 100644 --- a/Source/OpenSim.Framework.Monitoring/Watchdog.cs +++ b/Source/OpenSim.Framework.Monitoring/Watchdog.cs @@ -25,12 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using log4net; - namespace OpenSim.Framework.Monitoring { /// @@ -38,8 +32,6 @@ namespace OpenSim.Framework.Monitoring /// public static class Watchdog { - private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - /// Timer interval in milliseconds for the watchdog timer public const int WATCHDOG_INTERVAL_MS = 2500; @@ -143,8 +135,6 @@ public static bool Enabled get { return m_enabled; } set { - // m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value); - if (value == m_enabled) return; @@ -209,13 +199,8 @@ public static void Stop() /// /// Information about the thread. /// Name of the thread. - /// If true then creation of thread is logged. - public static void AddThread(ThreadWatchdogInfo info, string name, bool log = true) + public static void AddThread(ThreadWatchdogInfo info, string name) { - if (log) - m_log.DebugFormat( - "[WATCHDOG]: Started tracking thread {0}, ID {1}", name, info.Thread.ManagedThreadId); - lock (m_threads) m_threads.Add(info.Thread.ManagedThreadId, info); } @@ -231,35 +216,28 @@ public static void UpdateThread() /// /// Stops watchdog tracking on the current thread /// - /// If true then normal events in thread removal are not logged. /// /// True if the thread was removed from the list of tracked /// threads, otherwise false /// - public static bool RemoveThread(bool log = true) + public static bool RemoveThread( ) { - return RemoveThread(Thread.CurrentThread.ManagedThreadId, log); + return RemoveThread(Thread.CurrentThread.ManagedThreadId); } - private static bool RemoveThread(int threadID, bool log = true) + private static bool RemoveThread(int threadID) { lock (m_threads) { ThreadWatchdogInfo twi; if (m_threads.TryGetValue(threadID, out twi)) { - if (log) - m_log.DebugFormat( - "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); - twi.Cleanup(); m_threads.Remove(threadID); return true; } else { - m_log.WarnFormat( - "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID); return false; } } @@ -299,10 +277,6 @@ private static void UpdateThread(int threadID) threadInfo.LastTick = Environment.TickCount & Int32.MaxValue; threadInfo.IsTimedOut = false; } - else - { - m_log.WarnFormat("[WATCHDOG]: Asked to update thread {0} which is not being monitored", threadID); - } } catch { } } @@ -344,11 +318,6 @@ private static void WatchdogTimerElapsed(object sender) int now = Environment.TickCount & Int32.MaxValue; int msElapsed = now - LastWatchdogThreadTick; - if (msElapsed > WATCHDOG_INTERVAL_MS * 2) - m_log.WarnFormat( - "[WATCHDOG]: {0} ms since Watchdog last ran. Interval should be approximately {1} ms", - msElapsed, WATCHDOG_INTERVAL_MS); - LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue; Action callback = OnWatchdogTimeout; diff --git a/Source/OpenSim.Framework.Monitoring/WorkManager.cs b/Source/OpenSim.Framework.Monitoring/WorkManager.cs index c7198bf8562..598509e8ac8 100755 --- a/Source/OpenSim.Framework.Monitoring/WorkManager.cs +++ b/Source/OpenSim.Framework.Monitoring/WorkManager.cs @@ -25,10 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Runtime.CompilerServices; -using System.Threading; -using log4net; namespace OpenSim.Framework.Monitoring { @@ -49,8 +46,6 @@ namespace OpenSim.Framework.Monitoring /// public static class WorkManager { - private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public static JobEngine JobEngine { get; private set; } static WorkManager() @@ -152,7 +147,7 @@ public static Thread StartThread( AlarmMethod = alarmMethod }; - Watchdog.AddThread(twi, name, log); + Watchdog.AddThread(twi, name); thread.Start(); @@ -191,7 +186,7 @@ public static Thread StartThread( AlarmMethod = null }; - Watchdog.AddThread(twi, name, false); + Watchdog.AddThread(twi, name); thread.Start(); @@ -205,7 +200,7 @@ public static Thread StartThread( /// Code for the thread to execute. /// Object to pass to the thread. /// Name of the thread - public static void RunInThread(WaitCallback callback, object obj, string name, bool log = false) + public static void RunInThread(WaitCallback callback, object obj, string name) { if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) { @@ -221,21 +216,20 @@ public static void RunInThread(WaitCallback callback, object obj, string name, b Culture.SetCurrentCulture(); callback(obj); } - catch (Exception e) + catch (Exception) { - m_log.Error(string.Format("[WATCHDOG]: Exception in thread {0}.", name), e); } finally { try { - Watchdog.RemoveThread(log: false); + Watchdog.RemoveThread( ); } catch { } } }); - StartThread(ts, name, false, log); + StartThread(ts, name, false); } /// diff --git a/Source/OpenSim.Framework.Serialization/External/ExternalRepresentationUtils.cs b/Source/OpenSim.Framework.Serialization/External/ExternalRepresentationUtils.cs index 7aa8b1ae1e6..937ab02180b 100644 --- a/Source/OpenSim.Framework.Serialization/External/ExternalRepresentationUtils.cs +++ b/Source/OpenSim.Framework.Serialization/External/ExternalRepresentationUtils.cs @@ -25,14 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Reflection; -using System.Text; using System.Xml; -using log4net; using OpenMetaverse; using OpenSim.Services.Interfaces; @@ -43,8 +38,6 @@ namespace OpenSim.Framework.Serialization.External /// public class ExternalRepresentationUtils { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Populate a node with data read from xml using a dictinoary of processors /// @@ -60,8 +53,8 @@ public static bool ExecuteReadProcessors( processors, xtr, (o, nodeName, e) => { - m_log.Debug(string.Format("[ExternalRepresentationUtils]: Error while parsing element {0} ", - nodeName), e); + //m_log.Debug(string.Format("[ExternalRepresentationUtils]: Error while parsing element {0} ", + // nodeName), e); }); } @@ -110,13 +103,13 @@ public static bool ExecuteReadProcessors( if (xtr.EOF) { - m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to unexpected end of XML"); + //m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to unexpected end of XML"); break; } if (++numErrors == 10) { - m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to too many parsing errors"); + //m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to too many parsing errors"); break; } @@ -132,7 +125,7 @@ public static bool ExecuteReadProcessors( if (timer.Elapsed.TotalSeconds >= 60) { - m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to timeout"); + //m_log.Debug("[ExternalRepresentationUtils]: Aborting ExecuteReadProcessors due to timeout"); errors = true; break; } @@ -376,9 +369,9 @@ protected static void TransformXml(XmlReader reader, XmlWriter writer, string sc break; default: - m_log.WarnFormat( - "[HG ASSET MAPPER]: Unrecognized node {0} in asset XML transform in {1}", - reader.NodeType, sceneName); + //m_log.WarnFormat( + // "[HG ASSET MAPPER]: Unrecognized node {0} in asset XML transform in {1}", + // reader.NodeType, sceneName); break; } } diff --git a/Source/OpenSim.Framework.Serialization/External/LandDataSerializer.cs b/Source/OpenSim.Framework.Serialization/External/LandDataSerializer.cs index 8e5ddf8ed94..af7196930b1 100644 --- a/Source/OpenSim.Framework.Serialization/External/LandDataSerializer.cs +++ b/Source/OpenSim.Framework.Serialization/External/LandDataSerializer.cs @@ -25,12 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; using System.Text; using System.Xml; -using log4net; + using OpenMetaverse; namespace OpenSim.Framework.Serialization.External @@ -40,8 +37,6 @@ namespace OpenSim.Framework.Serialization.External /// public class LandDataSerializer { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static Dictionary> m_ldProcessors = new Dictionary>(); diff --git a/Source/OpenSim.Framework.Serialization/External/OspResolver.cs b/Source/OpenSim.Framework.Serialization/External/OspResolver.cs index a1e9d554bf0..e17a24c2a2f 100644 --- a/Source/OpenSim.Framework.Serialization/External/OspResolver.cs +++ b/Source/OpenSim.Framework.Serialization/External/OspResolver.cs @@ -27,9 +27,7 @@ using System.Reflection; using System.Text; -using log4net; using OpenMetaverse; -using OpenSim.Framework; using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Serialization @@ -40,8 +38,6 @@ namespace OpenSim.Framework.Serialization /// public class OspResolver { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public const string OSPA_PREFIX = "ospa:"; public const string OSPA_NAME_KEY = "n"; public const string OSPA_NAME_VALUE_SEPARATOR = " "; @@ -59,7 +55,7 @@ public static string MakeOspa(UUID userId, IUserAccountService userService) { if (userService == null) { - m_log.Warn("[OSP RESOLVER]: UserService is null"); + //m_log.Warn("[OSP RESOLVER]: UserService is null"); return userId.ToString(); } @@ -70,7 +66,7 @@ public static string MakeOspa(UUID userId, IUserAccountService userService) } // else // { -// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); +// //m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); // System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId); // } @@ -87,7 +83,7 @@ public static string MakeOspa(string firstName, string lastName) string ospa = OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; -// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); +// //m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); // System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName); return ospa; @@ -110,11 +106,11 @@ public static UUID ResolveOspa(string ospa, IUserAccountService userService) { if (!ospa.StartsWith(OSPA_PREFIX)) { -// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa); +// //m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa); return UUID.Zero; } -// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); +// //m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); @@ -125,7 +121,7 @@ public static UUID ResolveOspa(string ospa, IUserAccountService userService) if (tupleSeparatorIndex < 0) { - m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa); + //m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa); continue; } @@ -167,7 +163,7 @@ protected static UUID ResolveOspaName(string name, IUserAccountService userServi if (nameSeparatorIndex < 0) { - m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); + //m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); return UUID.Zero; } @@ -177,7 +173,7 @@ protected static UUID ResolveOspaName(string name, IUserAccountService userServi UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); if (account != null) { -// m_log.DebugFormat( +// //m_log.DebugFormat( // "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}", // account.PrincipalID, firstName, lastName); @@ -185,7 +181,7 @@ protected static UUID ResolveOspaName(string name, IUserAccountService userServi } // else // { -// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name); +// //m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name); // } // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc @@ -195,7 +191,7 @@ protected static UUID ResolveOspaName(string name, IUserAccountService userServi tempUserProfile.SurName = lastName; tempUserProfile.ID = HashName(tempUserProfile.Name); - m_log.DebugFormat( + //m_log.DebugFormat( "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); diff --git a/Source/OpenSim.Framework.Serialization/External/RegionSettingsSerializer.cs b/Source/OpenSim.Framework.Serialization/External/RegionSettingsSerializer.cs index 8341e04a567..81e6a2d51c7 100644 --- a/Source/OpenSim.Framework.Serialization/External/RegionSettingsSerializer.cs +++ b/Source/OpenSim.Framework.Serialization/External/RegionSettingsSerializer.cs @@ -25,13 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System.IO; using System.Text; using System.Xml; using OpenMetaverse; -using OpenSim.Framework; -using log4net; -using System.Reflection; namespace OpenSim.Framework.Serialization.External { diff --git a/Source/OpenSim.Framework.Serialization/External/UserInventoryItemSerializer.cs b/Source/OpenSim.Framework.Serialization/External/UserInventoryItemSerializer.cs index e8c811892a1..e15d20b60ab 100644 --- a/Source/OpenSim.Framework.Serialization/External/UserInventoryItemSerializer.cs +++ b/Source/OpenSim.Framework.Serialization/External/UserInventoryItemSerializer.cs @@ -25,16 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; using System.Text; using System.Xml; - -using log4net; using OpenMetaverse; -using OpenSim.Framework; using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Serialization.External @@ -44,8 +37,6 @@ namespace OpenSim.Framework.Serialization.External /// public class UserInventoryItemSerializer { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static Dictionary> m_InventoryItemXmlProcessors = new Dictionary>(); diff --git a/Source/OpenSim.Framework.Serialization/OpenSim.Framework.Serialization.csproj b/Source/OpenSim.Framework.Serialization/OpenSim.Framework.Serialization.csproj index 30f2ef90cc2..95b37600e14 100644 --- a/Source/OpenSim.Framework.Serialization/OpenSim.Framework.Serialization.csproj +++ b/Source/OpenSim.Framework.Serialization/OpenSim.Framework.Serialization.csproj @@ -25,7 +25,5 @@ - - diff --git a/Source/OpenSim.Framework.Serialization/TarArchiveReader.cs b/Source/OpenSim.Framework.Serialization/TarArchiveReader.cs index 339a37ad11f..a018279bf31 100644 --- a/Source/OpenSim.Framework.Serialization/TarArchiveReader.cs +++ b/Source/OpenSim.Framework.Serialization/TarArchiveReader.cs @@ -25,11 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; -using System.Reflection; using System.Text; -using log4net; namespace OpenSim.Framework.Serialization { @@ -38,8 +34,6 @@ namespace OpenSim.Framework.Serialization /// public class TarArchiveReader { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public enum TarEntryType { TYPE_UNKNOWN = 0, diff --git a/Source/OpenSim.Framework.Serialization/TarArchiveWriter.cs b/Source/OpenSim.Framework.Serialization/TarArchiveWriter.cs index fbd88af791a..349d791cd96 100644 --- a/Source/OpenSim.Framework.Serialization/TarArchiveWriter.cs +++ b/Source/OpenSim.Framework.Serialization/TarArchiveWriter.cs @@ -25,12 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; using System.Text; -using log4net; namespace OpenSim.Framework.Serialization { diff --git a/Source/OpenSim.Framework.Servers.HttpServer/BaseHttpServer.cs b/Source/OpenSim.Framework.Servers.HttpServer/BaseHttpServer.cs index cbeb9b13674..4ff28780777 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/BaseHttpServer.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/BaseHttpServer.cs @@ -1980,7 +1980,7 @@ public void Start(bool performPollResponsesAsync, bool runPool) { if (runPool) { - m_pollServiceManager ??= new PollServiceRequestManager(performPollResponsesAsync, 2, 25000); + m_pollServiceManager ??= new PollServiceRequestManager(m_logger, performPollResponsesAsync, 2, 25000); m_pollServiceManager.Start(); } } diff --git a/Source/OpenSim.Framework.Servers.HttpServer/BaseStreamHandlerBasicDOSProtector.cs b/Source/OpenSim.Framework.Servers.HttpServer/BaseStreamHandlerBasicDOSProtector.cs index b3b80985411..3837086b9aa 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/BaseStreamHandlerBasicDOSProtector.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/BaseStreamHandlerBasicDOSProtector.cs @@ -25,8 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework.Servers.HttpServer { @@ -42,13 +41,13 @@ public abstract class BaseStreamHandlerBasicDOSProtector : BaseRequestHandler, I private readonly BasicDosProtectorOptions _options; private readonly BasicDOSProtector _dosProtector; - protected BaseStreamHandlerBasicDOSProtector(string httpMethod, string path, BasicDosProtectorOptions options) : this(httpMethod, path, null, null, options) {} + protected BaseStreamHandlerBasicDOSProtector(ILogger logger, string httpMethod, string path, BasicDosProtectorOptions options) : this(logger, httpMethod, path, null, null, options) {} - protected BaseStreamHandlerBasicDOSProtector(string httpMethod, string path, string name, string description, BasicDosProtectorOptions options) + protected BaseStreamHandlerBasicDOSProtector(ILogger logger, string httpMethod, string path, string name, string description, BasicDosProtectorOptions options) : base(httpMethod, path, name, description) { _options = options; - _dosProtector = new BasicDOSProtector(_options); + _dosProtector = new BasicDOSProtector(logger, _options); } public virtual byte[] Handle( diff --git a/Source/OpenSim.Framework.Servers.HttpServer/GenericHTTPBasicDOSProtector.cs b/Source/OpenSim.Framework.Servers.HttpServer/GenericHTTPBasicDOSProtector.cs index 98d33e4537c..3e77c8a733e 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/GenericHTTPBasicDOSProtector.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/GenericHTTPBasicDOSProtector.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using Microsoft.Extensions.Logging; using System.Collections; namespace OpenSim.Framework.Servers.HttpServer @@ -37,13 +38,13 @@ public class GenericHTTPDOSProtector private readonly BasicDosProtectorOptions _options; private readonly BasicDOSProtector _dosProtector; - public GenericHTTPDOSProtector(GenericHTTPMethod normalMethod, GenericHTTPMethod throttledMethod, BasicDosProtectorOptions options) + public GenericHTTPDOSProtector(ILogger logger, GenericHTTPMethod normalMethod, GenericHTTPMethod throttledMethod, BasicDosProtectorOptions options) { _normalMethod = normalMethod; _throttledMethod = throttledMethod; _options = options; - _dosProtector = new BasicDOSProtector(_options); + _dosProtector = new BasicDOSProtector(logger, _options); } public Hashtable Process(Hashtable request) { diff --git a/Source/OpenSim.Framework.Servers.HttpServer/JsonRpcRequestManager.cs b/Source/OpenSim.Framework.Servers.HttpServer/JsonRpcRequestManager.cs index 4bd3a82b923..6dde6e8adc4 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/JsonRpcRequestManager.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/JsonRpcRequestManager.cs @@ -25,15 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Text; -using System.IO; using OpenMetaverse.StructuredData; using OpenMetaverse; -using log4net; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework.Servers.HttpServer { @@ -42,10 +36,11 @@ namespace OpenSim.Framework.Servers.HttpServer /// public class JsonRpcRequestManager { - static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILogger _logger; - public JsonRpcRequestManager() + public JsonRpcRequestManager(ILogger logger) { + _logger = logger; } /// @@ -95,29 +90,26 @@ public bool JsonRpcRequest(ref object parameters, string method, string uri, str } catch (Exception e) { - m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e); + _logger.LogDebug(e, string.Format("JsonRpc request '{0}' to {1} failed", method, uri)); return false; } OSD osdtmp; if (!outerResponse.TryGetValue("_Result", out osdtmp) || (osdtmp is not OSDMap response)) { - m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", - method, uri, OSDParser.SerializeJsonString(outerResponse)); + _logger.LogDebug($"JsonRpc request '{method}' to {uri} returned an invalid response: {OSDParser.SerializeJsonString(outerResponse)}"); return false; } if (response.TryGetValue("error", out osdtmp)) { - m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", - method, uri, OSDParser.SerializeJsonString(osdtmp)); + _logger.LogDebug($"JsonRpc request '{method}' to {uri} returned an error: {OSDParser.SerializeJsonString(osdtmp)}"); return false; } if (!response.TryGetValue("result", out osdtmp) || (osdtmp is not OSDMap resultmap)) { - m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", - method, uri, OSDParser.SerializeJsonString(response)); + _logger.LogDebug($"JsonRpc request '{method}' to {uri} returned an invalid response: {OSDParser.SerializeJsonString(response)}"); return false; } @@ -159,27 +151,25 @@ public bool JsonRpcRequest(ref OSD data, string method, string uri, string jsonI OSDMap outerresponse; try { - outerresponse = WebUtil.PostToService(uri, request, 10000, true); + outerresponse = WebUtil.PostToService( uri, request, 10000, true); } catch (Exception e) { - m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e); + _logger.LogDebug(e, $"JsonRpc request '{method}' to {uri} failed"); return false; } OSD osdtmp; if (!outerresponse.TryGetValue("_Result", out osdtmp) || (osdtmp is not OSDMap response)) { - m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", - method, uri, OSDParser.SerializeJsonString(outerresponse)); + _logger.LogDebug($"JsonRpc request '{method}' to {uri} returned an invalid response: {OSDParser.SerializeJsonString(outerresponse)}"); return false; } if (response.TryGetValue("error", out osdtmp)) { data = osdtmp; - m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", - method, uri, OSDParser.SerializeJsonString(osdtmp)); + _logger.LogDebug($"JsonRpc request '{method}' to {uri} returned an error: {OSDParser.SerializeJsonString(osdtmp)}"); return false; } diff --git a/Source/OpenSim.Framework.Servers.HttpServer/OSHttpRequest.cs b/Source/OpenSim.Framework.Servers.HttpServer/OSHttpRequest.cs index 49b728400a9..4360574de8d 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/OSHttpRequest.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/OSHttpRequest.cs @@ -25,24 +25,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; using System.Collections.Specialized; -using System.IO; using System.Net; -using System.Reflection; using System.Text; -using System.Web; + using OSHttpServer; -using log4net; namespace OpenSim.Framework.Servers.HttpServer { public class OSHttpRequest : IOSHttpRequest { - private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected IHttpRequest m_request = null; protected IHttpClientContext m_context = null; diff --git a/Source/OpenSim.Framework.Servers.HttpServer/OpenSim.Framework.Servers.HttpServer.csproj b/Source/OpenSim.Framework.Servers.HttpServer/OpenSim.Framework.Servers.HttpServer.csproj index bbedd7eeabd..959e2f82f9b 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/OpenSim.Framework.Servers.HttpServer.csproj +++ b/Source/OpenSim.Framework.Servers.HttpServer/OpenSim.Framework.Servers.HttpServer.csproj @@ -8,8 +8,6 @@ - - @@ -28,6 +26,5 @@ - \ No newline at end of file diff --git a/Source/OpenSim.Framework.Servers.HttpServer/PollServiceHttpRequest.cs b/Source/OpenSim.Framework.Servers.HttpServer/PollServiceHttpRequest.cs index cea86b1e5e4..de6797b8145 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/PollServiceHttpRequest.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/PollServiceHttpRequest.cs @@ -25,22 +25,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; using System.Net; -using System.Reflection; using System.Text; using OSHttpServer; -using log4net; using OpenMetaverse; namespace OpenSim.Framework.Servers.HttpServer { public class PollServiceHttpRequest { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public readonly PollServiceEventArgs PollServiceArgs; public readonly IHttpRequest Request; public readonly int RequestTime; @@ -198,14 +192,14 @@ internal void DoHTTPGruntWork(Hashtable responsedata) } catch (Exception ex) { - if(ex is System.Net.Sockets.SocketException) - { - // only mute connection reset by peer so we are not totally blind for now - if(((System.Net.Sockets.SocketException)ex).SocketErrorCode != System.Net.Sockets.SocketError.ConnectionReset) - m_log.Warn("[POLL SERVICE WORKER THREAD]: Error ", ex); - } - else - m_log.Warn("[POLL SERVICE WORKER THREAD]: Error ", ex); + //if(ex is System.Net.Sockets.SocketException) + //{ + // // only mute connection reset by peer so we are not totally blind for now + // if(((System.Net.Sockets.SocketException)ex).SocketErrorCode != System.Net.Sockets.SocketError.ConnectionReset) + // m_log.Warn("[POLL SERVICE WORKER THREAD]: Error ", ex); + //} + //else + // m_log.Warn("[POLL SERVICE WORKER THREAD]: Error ", ex); } PollServiceArgs.RequestsHandled++; diff --git a/Source/OpenSim.Framework.Servers.HttpServer/PollServiceRequestManager.cs b/Source/OpenSim.Framework.Servers.HttpServer/PollServiceRequestManager.cs index beb8d88ac20..0aa9fd3602a 100755 --- a/Source/OpenSim.Framework.Servers.HttpServer/PollServiceRequestManager.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/PollServiceRequestManager.cs @@ -25,31 +25,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Threading; -using System.Reflection; -using log4net; using OpenSim.Framework.Monitoring; -using Amib.Threading; -using System.Collections.Generic; using System.Collections.Concurrent; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework.Servers.HttpServer { public class PollServiceRequestManager { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly ConcurrentQueue m_retryRequests = new(); private readonly int m_WorkerThreadCount = 0; private ObjectJobEngine m_workerPool; private Thread m_retrysThread; private bool m_running = false; + private readonly ILogger m_logger; - public PollServiceRequestManager(bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) + public PollServiceRequestManager(ILogger logger, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) { + m_logger = logger; m_WorkerThreadCount = (int)pWorkerThreadCount; } @@ -59,7 +54,7 @@ public void Start() return; m_running = true; - m_workerPool = new ObjectJobEngine(PoolWorkerJob, "PollServiceWorker", 4000, m_WorkerThreadCount); + m_workerPool = new ObjectJobEngine(m_logger, PoolWorkerJob, "PollServiceWorker", 4000, m_WorkerThreadCount); m_retrysThread = WorkManager.StartThread( CheckRetries, @@ -173,7 +168,7 @@ private void PoolWorkerJob(object o) } catch (Exception e) { - m_log.Error($"Exception in poll service thread: {e}"); + m_logger.LogError(e, $"Exception in poll service thread"); } } } diff --git a/Source/OpenSim.Framework.Servers.HttpServer/RestSessionService.cs b/Source/OpenSim.Framework.Servers.HttpServer/RestSessionService.cs index a7349979100..87bc5fb8846 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/RestSessionService.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/RestSessionService.cs @@ -25,14 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; using System.Net; using System.Reflection; using System.Text; using System.Xml; using System.Xml.Serialization; -using log4net; namespace OpenSim.Framework.Servers.HttpServer { @@ -185,9 +182,6 @@ private void AsyncCallback(IAsyncResult result) public class RestDeserialiseSecureHandler : BaseOutputStreamHandler, IStreamHandler where TRequest : new() { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private RestDeserialiseMethod m_method; private CheckIdentityMethod m_smethod; @@ -216,7 +210,6 @@ protected override void ProcessRequest(string path, Stream request, Stream respo } catch (Exception e) { - m_log.Error("[REST]: Deserialization problem. Ignoring request. " + e); fail = true; } } @@ -240,9 +233,6 @@ protected override void ProcessRequest(string path, Stream request, Stream respo public class RestDeserialiseTrustedHandler : BaseOutputStreamHandler, IStreamHandler where TRequest : new() { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// The operation to perform once trust has been established. /// @@ -276,7 +266,6 @@ protected override void ProcessRequest(string path, Stream request, Stream respo } catch (Exception e) { - m_log.Error("[REST]: Deserialization problem. Ignoring request. " + e); fail = true; } } diff --git a/Source/OpenSim.Framework.Servers.HttpServer/XmlRpcBasicDOSProtector.cs b/Source/OpenSim.Framework.Servers.HttpServer/XmlRpcBasicDOSProtector.cs index 6b2c0ab801c..21c3305bd50 100644 --- a/Source/OpenSim.Framework.Servers.HttpServer/XmlRpcBasicDOSProtector.cs +++ b/Source/OpenSim.Framework.Servers.HttpServer/XmlRpcBasicDOSProtector.cs @@ -26,8 +26,8 @@ */ using System.Net; +using Microsoft.Extensions.Logging; using Nwc.XmlRpc; -using OpenSim.Framework; namespace OpenSim.Framework.Servers.HttpServer @@ -40,13 +40,13 @@ public class XmlRpcBasicDOSProtector private readonly BasicDosProtectorOptions _options; private readonly BasicDOSProtector _dosProtector; - public XmlRpcBasicDOSProtector(XmlRpcMethod normalMethod, XmlRpcMethod throttledMethod,BasicDosProtectorOptions options) + public XmlRpcBasicDOSProtector(ILogger logger, XmlRpcMethod normalMethod, XmlRpcMethod throttledMethod,BasicDosProtectorOptions options) { _normalMethod = normalMethod; _throttledMethod = throttledMethod; _options = options; - _dosProtector = new BasicDOSProtector(_options); + _dosProtector = new BasicDOSProtector(logger, _options); } public XmlRpcResponse Process(XmlRpcRequest request, IPEndPoint client) diff --git a/Source/OpenSim.Framework.Servers/BaseOpenSimServer.cs b/Source/OpenSim.Framework.Servers/BaseOpenSimServer.cs index 35910a14850..7ff2b9bdd82 100644 --- a/Source/OpenSim.Framework.Servers/BaseOpenSimServer.cs +++ b/Source/OpenSim.Framework.Servers/BaseOpenSimServer.cs @@ -25,23 +25,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; using System.Text; -using System.Threading; using System.Timers; using System.Net; using System.Net.Security; +using Timer = System.Timers.Timer; +using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; -using log4net; + using OpenMetaverse; -using OpenSim.Framework; + using OpenSim.Framework.Monitoring; using OpenSim.Framework.Servers.HttpServer; -using Timer=System.Timers.Timer; -using Nini.Config; -using System.Runtime.InteropServices; + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; diff --git a/Source/OpenSim.Framework.Servers/OpenSim.Framework.Servers.csproj b/Source/OpenSim.Framework.Servers/OpenSim.Framework.Servers.csproj index b654ad426c1..9f85ebe06b9 100644 --- a/Source/OpenSim.Framework.Servers/OpenSim.Framework.Servers.csproj +++ b/Source/OpenSim.Framework.Servers/OpenSim.Framework.Servers.csproj @@ -100,10 +100,8 @@ - - - + diff --git a/Source/OpenSim.Framework.Servers/ServerBase.cs b/Source/OpenSim.Framework.Servers/ServerBase.cs index 6671b2bd23e..91a53720f0f 100755 --- a/Source/OpenSim.Framework.Servers/ServerBase.cs +++ b/Source/OpenSim.Framework.Servers/ServerBase.cs @@ -26,14 +26,9 @@ */ using System.Diagnostics; -using System.Reflection; using System.Runtime; using System.Text; using System.Text.RegularExpressions; -using log4net; -using log4net.Appender; -using log4net.Core; -using log4net.Repository; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using OpenSim.Framework.Console; @@ -55,10 +50,6 @@ public class ServerBase protected ICommandConsole m_console; public ICommandConsole Console { get => m_console; set => m_console = value; } - protected OpenSimAppender m_consoleAppender; - protected FileAppender m_logFileAppender; - protected FileAppender m_statsLogFileAppender; - protected DateTime m_startuptime; protected string m_startupDirectory = Environment.CurrentDirectory; @@ -115,14 +106,6 @@ public void RegisterCommonCommands() m_console.Commands.AddCommand( "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); - m_console.Commands.AddCommand( - "General", false, "get log level", "get log level", "Get the current console logging level", - (mod, cmd) => ShowLogLevel()); - - m_console.Commands.AddCommand( - "General", false, "set log level", "set log level ", - "Set the console logging level for this session.", HandleSetLogLevel); - m_console.Commands.AddCommand( "General", false, "config get", "config get [
] []", @@ -484,45 +467,6 @@ private void HandleConfig(string module, string[] cmd) } } - private void HandleSetLogLevel(string module, string[] cmd) - { - if (cmd.Length != 4) - { - Notice("Usage: set log level "); - return; - } - - if (null == m_consoleAppender) - { - Notice("No appender named Console found (see the log4net config file for this executable)!"); - return; - } - - string rawLevel = cmd[3]; - - ILoggerRepository repository = LogManager.GetRepository(); - Level consoleLevel = repository.LevelMap[rawLevel]; - - if (consoleLevel != null) - m_consoleAppender.Threshold = consoleLevel; - else - Notice( - "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", - rawLevel); - - ShowLogLevel(); - } - - private void ShowLogLevel() - { - if (null == m_consoleAppender) - { - Notice("No appender named Console found (see the log4net config file for this executable)!"); - return; - } - Notice("Console log level is {0}", m_consoleAppender.Threshold); - } - protected virtual void HandleScript(string module, string[] parms) { if (parms.Length != 2) @@ -583,8 +527,6 @@ protected void ShowInfo() { Notice(GetVersionText()); Notice("Startup directory: " + m_startupDirectory); - if (null != m_consoleAppender) - Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold)); } /// diff --git a/Source/OpenSim.Framework/AgentCircuitData.cs b/Source/OpenSim.Framework/AgentCircuitData.cs index 7242993a455..411cbd9db55 100644 --- a/Source/OpenSim.Framework/AgentCircuitData.cs +++ b/Source/OpenSim.Framework/AgentCircuitData.cs @@ -25,10 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; -using System.Collections.Generic; -using log4net; +using Microsoft.Extensions.Logging; + using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -40,8 +38,6 @@ namespace OpenSim.Framework /// public class AgentCircuitData { - private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - /// /// Avatar Unique Agent Identifier /// @@ -173,8 +169,16 @@ public string Viewer public Dictionary ServiceURLs; + private readonly ILogger? m_logger = null; + public AgentCircuitData() { + m_logger = null; + } + + public AgentCircuitData(ILogger logger) + { + m_logger = logger; } /// @@ -255,7 +259,6 @@ public OSDMap PackAgentCircuitData(EntityTransferContext ctx) args["serviceurls"] = urls; } - return args; } @@ -338,7 +341,7 @@ public void UnpackAgentCircuitData(OSDMap args) if(args.TryGetValue("far", out tmpOSD)) startfar = (float)tmpOSD.AsReal(); - //m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos); + // m_logger?.LogInformation($"[AGENTCIRCUITDATA]: agentid={AgentID}, child={child}, startpos={startpos}"); try { @@ -353,16 +356,16 @@ public void UnpackAgentCircuitData(OSDMap args) if (args.TryGetValue("packed_appearance", out tmpOSD) && (tmpOSD is OSDMap)) { Appearance.Unpack((OSDMap)tmpOSD); -// m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); + m_logger?.LogDebug($"[AGENTCIRCUITDATA] unpacked appearance"); } else { - m_log.Warn("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance"); + m_logger?.LogWarning("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance"); } } catch (Exception e) { - m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); + m_logger?.LogError(e, $"[AGENTCIRCUITDATA] failed to unpack appearance;"); } ServiceURLs = new Dictionary(); diff --git a/Source/OpenSim.Framework/AgentCircuitManager.cs b/Source/OpenSim.Framework/AgentCircuitManager.cs index 837c56d760f..7a6b807c385 100644 --- a/Source/OpenSim.Framework/AgentCircuitManager.cs +++ b/Source/OpenSim.Framework/AgentCircuitManager.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System.Collections.Generic; using System.Runtime.InteropServices; using OpenMetaverse; @@ -75,6 +74,7 @@ public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID age } } } + return new AuthenticateResponse(); } diff --git a/Source/OpenSim.Framework/AvatarAppearance.cs b/Source/OpenSim.Framework/AvatarAppearance.cs index 848f47cb3c6..b6a07dc6c81 100644 --- a/Source/OpenSim.Framework/AvatarAppearance.cs +++ b/Source/OpenSim.Framework/AvatarAppearance.cs @@ -25,12 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; -using System.Collections.Generic; using OpenMetaverse; using OpenMetaverse.StructuredData; -using log4net; using System.Text; namespace OpenSim.Framework @@ -41,26 +37,27 @@ namespace OpenSim.Framework public class AvatarAppearance { // SL box diferent to size - const float AVBOXAJUST = 0.2f; + private const float AVBOXAJUST = 0.2f; + // constrains for ubitode physics - const float AVBOXMINX = 0.2f; - const float AVBOXMINY = 0.3f; - const float AVBOXMINZ = 1.2f; + private const float AVBOXMINX = 0.2f; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private const float AVBOXMINY = 0.3f; + private const float AVBOXMINZ = 1.2f; // this is viewer capabilities and weared things dependent // should be only used as initial default value ( V1 viewers ) public const int VISUALPARAM_COUNT = 218; // regions and viewer compatibility - public readonly static int TEXTURE_COUNT = 45; + public static readonly int TEXTURE_COUNT = 45; + public const int TEXTURE_COUNT_PV7 = 29; public const int BAKES_COUNT_PV7 = 6; public const int MAXWEARABLE_PV7 = 16; public const int MAXWEARABLE_LEGACY = 15; - public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20, 40, 41, 42, 43, 44 }; + public static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20, 40, 41, 42, 43, 44 }; protected int m_serial = 0; protected byte[] m_visualparams; @@ -104,11 +101,7 @@ public float AvatarFeetOffset public Primitive.TextureEntry Texture { get { return m_texture; } - set - { -// m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value); - m_texture = value; - } + set { m_texture = value; } } public AvatarWearable[] Wearables @@ -133,29 +126,23 @@ public WearableCacheItem[] WearableCacheItems public AvatarAppearance() { -// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); - m_serial = 0; SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); -// SetHeight(); - SetSize(new Vector3(0.45f,0.6f,1.9f)); + // SetHeight(); + SetSize(new Vector3(0.45f, 0.6f, 1.9f)); m_attachments = new Dictionary>(); } public AvatarAppearance(OSDMap map) { -// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); - Unpack(map); -// SetHeight(); done in Unpack + // SetHeight(); done in Unpack } public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) { -// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); - m_serial = 0; if (wearables != null) @@ -173,14 +160,14 @@ public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textu else SetDefaultParams(); -// SetHeight(); - if(m_avatarHeight == 0) - SetSize(new Vector3(0.45f,0.6f,1.9f)); + // SetHeight(); + if (m_avatarHeight == 0) + SetSize(new Vector3(0.45f, 0.6f, 1.9f)); m_attachments = new Dictionary>(); } - public AvatarAppearance(AvatarAppearance appearance): this(appearance, true,true) + public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true, true) { } @@ -191,7 +178,7 @@ public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked) { -// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); + // //m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); if (appearance == null) { @@ -199,7 +186,7 @@ public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool co SetDefaultWearables(); SetDefaultTexture(); SetDefaultParams(); -// SetHeight(); + // SetHeight(); SetSize(new Vector3(0.45f, 0.6f, 1.9f)); AvatarPreferencesHoverZ = 0; m_attachments = new Dictionary>(); @@ -218,17 +205,20 @@ public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool co m_wearables[i] = new AvatarWearable(); AvatarWearable wearable = appearance.Wearables[i]; for (int j = 0; j < wearable.Count; j++) - m_wearables[i].Add(wearable[j].ItemID, wearable[j].AssetID); - } + m_wearables[i].Add(wearable[j].ItemID, wearable[j].AssetID); + } } else + { ClearWearables(); + } m_texture = null; + if (appearance.Texture != null) { byte[] tbytes = appearance.Texture.GetBakesBytes(); - m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); + m_texture = new Primitive.TextureEntry(tbytes, 0, tbytes.Length); if (copyBaked && appearance.m_cacheitems != null) m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone(); else @@ -239,7 +229,7 @@ public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool co if (appearance.VisualParams != null) m_visualparams = (byte[])appearance.VisualParams.Clone(); -// m_avatarHeight = appearance.m_avatarHeight; + // m_avatarHeight = appearance.m_avatarHeight; SetSize(appearance.AvatarSize); // Copy the attachment, force append mode since that ensures consistency @@ -250,14 +240,14 @@ public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool co public void GetAssetsFrom(AvatarAppearance app) { - int len = m_wearables.Length; - if(len > app.m_wearables.Length) + int len = m_wearables.Length; + if (len > app.m_wearables.Length) len = app.m_wearables.Length; for (int i = 0; i < len; i++) { - int count = m_wearables[i].Count; - if(count > app.m_wearables[i].Count) + int count = m_wearables[i].Count; + if (count > app.m_wearables[i].Count) count = app.m_wearables[i].Count; for (int j = 0; j < count; j++) @@ -289,8 +279,6 @@ protected void SetDefaultWearables() /// public void ResetAppearance() { -// m_log.WarnFormat("[AVATAR APPEARANCE]: Reset appearance"); - m_serial = 0; SetDefaultTexture(); @@ -305,7 +293,7 @@ public void ResetAppearance() protected void SetDefaultParams() { - m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; + m_visualparams = new byte[] { 33, 61, 85, 23, 58, 127, 63, 85, 63, 42, 0, 85, 63, 36, 85, 95, 153, 63, 34, 0, 63, 109, 88, 132, 63, 136, 81, 85, 103, 136, 127, 0, 150, 150, 150, 127, 0, 0, 0, 0, 0, 127, 0, 0, 255, 127, 114, 127, 99, 63, 127, 140, 127, 127, 0, 0, 0, 191, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 145, 216, 133, 0, 127, 0, 127, 170, 0, 0, 127, 127, 109, 85, 127, 127, 63, 85, 42, 150, 150, 150, 150, 150, 150, 150, 25, 150, 150, 150, 0, 127, 0, 0, 144, 85, 127, 132, 127, 85, 0, 127, 127, 127, 127, 127, 127, 59, 127, 85, 127, 127, 106, 47, 79, 127, 127, 204, 2, 141, 66, 0, 0, 127, 127, 0, 0, 0, 0, 127, 0, 159, 0, 0, 178, 127, 36, 85, 131, 127, 127, 127, 153, 95, 0, 140, 75, 27, 127, 127, 0, 150, 150, 198, 0, 0, 63, 30, 127, 165, 209, 198, 127, 127, 153, 204, 51, 51, 255, 255, 255, 204, 0, 255, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 0, 150, 150, 150, 150, 150, 0, 127, 127, 150, 150, 150, 150, 150, 150, 150, 150, 0, 0, 150, 51, 132, 150, 150, 150 }; } /// @@ -341,6 +329,7 @@ public bool SetTextureEntries(Primitive.TextureEntry textureEntry) //make sure textureEntry.DefaultTexture is the unused one(DEFAULT_AVATAR_TEXTURE). Primitive.TextureEntry converted = new Primitive.TextureEntry(AppearanceManager.DEFAULT_AVATAR_TEXTURE); + for (uint i = 0; i < TEXTURE_COUNT; ++i) { newface = textureEntry.GetFace(i); @@ -360,8 +349,12 @@ public bool SetTextureEntries(Primitive.TextureEntry textureEntry) changed = true; } } - if(changed) + + if (changed) + { m_texture = converted; + } + return changed; } @@ -391,15 +384,10 @@ public bool SetVisualParams(byte[] visualParams) } else { - for (int i = 0; i < newsize; i++) { if (visualParams[i] != m_visualparams[i]) { - // DEBUG ON - // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", - // i,m_visualparams[i],visualParams[i]); - // DEBUG OFF m_visualparams[i] = visualParams[i]; changed = true; } @@ -423,20 +411,20 @@ public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualPara /// public void SetHeight() { -/* - // Start with shortest possible female avatar height - m_avatarHeight = 1.14597f; - // Add offset for male avatars - if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0) - m_avatarHeight += 0.0848f; - // Add offsets for visual params - m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f - + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f - + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f - + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f - + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; -*/ + /* + // Start with shortest possible female avatar height + m_avatarHeight = 1.14597f; + // Add offset for male avatars + if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0) + m_avatarHeight += 0.0848f; + // Add offsets for visual params + m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f + + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f + + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f + + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; + */ } public void SetSize(Vector3 avSize) @@ -469,22 +457,23 @@ public void SetSize(Vector3 avSize) public void SetWearable(int wearableId, AvatarWearable wearable) { -// DEBUG ON -// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); -// DEBUG OFF if (wearableId >= m_wearables.Length) { int currentLength = m_wearables.Length; Array.Resize(ref m_wearables, wearableId + 1); - for (int i = currentLength ; i < m_wearables.Length ; i++) + for (int i = currentLength; i < m_wearables.Length; i++) m_wearables[i] = new AvatarWearable(); } + m_wearables[wearableId].Clear(); + for (int i = 0; i < wearable.Count; i++) + { m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); + } } -// DEBUG ON + // DEBUG ON public override String ToString() { StringBuilder sb = new(); @@ -511,7 +500,6 @@ public override String ToString() return sb.ToString(); } -// DEBUG OFF /// /// Get a list of the attachments. @@ -535,7 +523,7 @@ public List GetAttachments() internal void AppendAttachment(AvatarAttachment attach) { - //m_log.DebugFormat( + ////m_log.DebugFormat( // "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}", // attach.ItemID, attach.AssetID, attach.AttachPoint); @@ -556,7 +544,7 @@ internal void AppendAttachment(AvatarAttachment attach) internal void ReplaceAttachment(AvatarAttachment attach) { - //m_log.DebugFormat( + ////m_log.DebugFormat( // "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}", // attach.ItemID, attach.AssetID, attach.AttachPoint); @@ -584,10 +572,6 @@ internal void ReplaceAttachment(AvatarAttachment attach) /// public bool SetAttachment(int attachpoint, UUID item, UUID asset) { - //m_log.DebugFormat( - // "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}", - // attachpoint, item, asset); - if (attachpoint == 0) return false; @@ -605,19 +589,14 @@ public bool SetAttachment(int attachpoint, UUID item, UUID asset) AvatarAttachment existingAttachment = GetAttachmentForItem(item); if (existingAttachment != null) { -// m_log.DebugFormat( -// "[AVATAR APPEARANCE]: Found existing attachment for {0}, asset {1} at point {2}", -// existingAttachment.ItemID, existingAttachment.AssetID, existingAttachment.AttachPoint); - if (!existingAttachment.AssetID.IsZero() && existingAttachment.AttachPoint == (attachpoint & 0x7F)) { - m_log.Debug($"[AVATAR APPEARANCE]: Ignoring attach of an already attached item {item} at point {attachpoint}"); return false; } else { - // Remove it here so that the later append does not add a second attachment but we still update - // the assetID + // Remove it here so that the later append does not add a second attachment + // but we still update the assetID DetachAttachment(existingAttachment.ItemID); } } @@ -631,7 +610,7 @@ public bool SetAttachment(int attachpoint, UUID item, UUID asset) } else { - ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); + ReplaceAttachment(new AvatarAttachment(attachpoint, item, asset)); } } @@ -649,7 +628,7 @@ public AvatarAttachment GetAttachmentForItem(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID.Equals(itemID); }); + int index = kvp.Value.FindIndex(delegate (AvatarAttachment a) { return a.ItemID.Equals(itemID); }); if (index >= 0) return kvp.Value[index]; } @@ -664,7 +643,7 @@ public int GetAttachpoint(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID.Equals(itemID); }); + int index = kvp.Value.FindIndex(delegate (AvatarAttachment a) { return a.ItemID.Equals(itemID); }); if (index >= 0) return kvp.Key; } @@ -678,13 +657,9 @@ public bool DetachAttachment(UUID itemID) { foreach (KeyValuePair> kvp in m_attachments) { - int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID.Equals(itemID); }); + int index = kvp.Value.FindIndex(delegate (AvatarAttachment a) { return a.ItemID.Equals(itemID); }); if (index >= 0) { - //m_log.DebugFormat( - // "[AVATAR APPEARANCE]: Detaching attachment {0}, index {1}, point {2}", - // m_attachments[kvp.Key][index].ItemID, index, m_attachments[kvp.Key][index].AttachPoint); - // Remove it from the list of attachments at that attach point m_attachments[kvp.Key].RemoveAt(index); @@ -731,7 +706,7 @@ public OSDMap Pack(EntityTransferContext ctx) count = MAXWEARABLE_LEGACY; else { - if(ctx.OutboundVersion >= 0.8) + if (ctx.OutboundVersion >= 0.8) { sendPV8 = true; count = m_wearables.Length; @@ -752,7 +727,7 @@ public OSDMap Pack(EntityTransferContext ctx) } } - if(count > m_wearables.Length) + if (count > m_wearables.Length) count = m_wearables.Length; wears = new OSDArray(count); @@ -811,7 +786,7 @@ public OSDMap PackForNotecard(bool NoHuds = true) // old regions may not like missing/empty wears OSDArray wears = new OSDArray(MAXWEARABLE_LEGACY); - for (int i = 0; i< MAXWEARABLE_LEGACY; ++i) + for (int i = 0; i < MAXWEARABLE_LEGACY; ++i) wears.Add(new OSDArray()); data["wearables"] = wears; @@ -876,16 +851,13 @@ public void Unpack(OSDMap data) SetDefaultParams(); m_attachments = new Dictionary>(); - if(data == null) - { - m_log.Warn("[AVATAR APPEARANCE]: data to unpack is null"); + if (data == null) return; - } OSD tmpOSD; if (data.TryGetValue("serial", out tmpOSD)) m_serial = tmpOSD.AsInteger(); - if(data.TryGetValue("aphz", out tmpOSD)) + if (data.TryGetValue("aphz", out tmpOSD)) AvatarPreferencesHoverZ = (float)tmpOSD.AsReal(); if (data.TryGetValue("height", out tmpOSD)) SetSize(new Vector3(0.45f, 0.6f, (float)tmpOSD.AsReal())); @@ -906,7 +878,7 @@ public void Unpack(OSDMap data) if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray)) { OSDArray wears = (OSDArray)tmpOSD; - if(wears.Count + wears8Count > 0) + if (wears.Count + wears8Count > 0) { m_wearables = new AvatarWearable[wears.Count + wears8Count]; @@ -976,7 +948,7 @@ public void Unpack(OSDMap data) } else { - m_log.Warn("[AVATAR APPEARANCE]: failed to unpack visual parameters"); + //m_log.Warn("[AVATAR APPEARANCE]: failed to unpack visual parameters"); } // Attachments @@ -988,7 +960,7 @@ public void Unpack(OSDMap data) AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]); AppendAttachment(att); - //m_log.DebugFormat( + ////m_log.DebugFormat( // "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}", // att.ItemID, att.AssetID, att.AttachPoint); } @@ -996,11 +968,11 @@ public void Unpack(OSDMap data) } catch (Exception e) { - m_log.ErrorFormat("[AVATAR APPEARANCE]: unpack failed badly: {0}{1}", e.Message, e.StackTrace); + //m_log.ErrorFormat("[AVATAR APPEARANCE]: unpack failed badly: {0}{1}", e.Message, e.StackTrace); } } - #endregion + #endregion Packing Functions public bool CanTeleport(float version) { @@ -1008,9 +980,9 @@ public bool CanTeleport(float version) return true; if (m_wearables.Length <= MAXWEARABLE_PV7) return true; - for(int i = MAXWEARABLE_PV7; i < m_wearables.Length; ++i) + for (int i = MAXWEARABLE_PV7; i < m_wearables.Length; ++i) { - if(m_wearables[i].Count > 0) + if (m_wearables[i].Count > 0) return false; } @@ -1040,658 +1012,826 @@ public enum VPElement : int /// Brow Size - Small 0--+255 Large /// SHAPE_BIG_BROW = 0, + /// /// Nose Size - Small 0--+255 Large /// SHAPE_NOSE_BIG_OUT = 1, + /// /// Nostril Width - Narrow 0--+255 Broad /// SHAPE_BROAD_NOSTRILS = 2, + /// /// Chin Cleft - Round 0--+255 Cleft /// SHAPE_CLEFT_CHIN = 3, + /// /// Nose Tip Shape - Pointy 0--+255 Bulbous /// SHAPE_BULBOUS_NOSE_TIP = 4, + /// /// Chin Angle - Chin Out 0--+255 Chin In /// SHAPE_WEAK_CHIN = 5, + /// /// Chin-Neck - Tight Chin 0--+255 Double Chin /// SHAPE_DOUBLE_CHIN = 6, + /// /// Lower Cheeks - Well-Fed 0--+255 Sunken /// SHAPE_SUNKEN_CHEEKS = 7, + /// /// Upper Bridge - Low 0--+255 High /// SHAPE_NOBLE_NOSE_BRIDGE = 8, + /// /// - Less 0--+255 More /// SHAPE_JOWLS = 9, + /// /// Upper Chin Cleft - Round 0--+255 Cleft /// SHAPE_CLEFT_CHIN_UPPER = 10, + /// /// Cheek Bones - Low 0--+255 High /// SHAPE_HIGH_CHEEK_BONES = 11, + /// /// Ear Angle - In 0--+255 Out /// SHAPE_EARS_OUT = 12, + /// /// Eyebrow Points - Smooth 0--+255 Pointy /// HAIR_POINTY_EYEBROWS = 13, + /// /// Jaw Shape - Pointy 0--+255 Square /// SHAPE_SQUARE_JAW = 14, + /// /// Upper Cheeks - Thin 0--+255 Puffy /// SHAPE_PUFFY_UPPER_CHEEKS = 15, + /// /// Nose Tip Angle - Downturned 0--+255 Upturned /// SHAPE_UPTURNED_NOSE_TIP = 16, + /// /// Nose Thickness - Thin Nose 0--+255 Bulbous Nose /// SHAPE_BULBOUS_NOSE = 17, + /// /// Upper Eyelid Fold - Uncreased 0--+255 Creased /// SHAPE_UPPER_EYELID_FOLD = 18, + /// /// Attached Earlobes - Unattached 0--+255 Attached /// SHAPE_ATTACHED_EARLOBES = 19, + /// /// Eye Bags - Smooth 0--+255 Baggy /// SHAPE_BAGGY_EYES = 20, + /// /// Eye Opening - Narrow 0--+255 Wide /// SHAPE_WIDE_EYES = 21, + /// /// Lip Cleft - Narrow 0--+255 Wide /// SHAPE_WIDE_LIP_CLEFT = 22, + /// /// Bridge Width - Narrow 0--+255 Wide /// SHAPE_WIDE_NOSE_BRIDGE = 23, + /// /// Eyebrow Arc - Flat 0--+255 Arced /// HAIR_ARCED_EYEBROWS = 24, + /// /// Height - Short 0--+255 Tall /// SHAPE_HEIGHT = 25, + /// /// Body Thickness - Body Thin 0--+255 Body Thick /// SHAPE_THICKNESS = 26, + /// /// Ear Size - Small 0--+255 Large /// SHAPE_BIG_EARS = 27, + /// /// Shoulders - Narrow 0--+255 Broad /// SHAPE_SHOULDERS = 28, + /// /// Hip Width - Narrow 0--+255 Wide /// SHAPE_HIP_WIDTH = 29, + /// /// - Short Torso 0--+255 Long Torso /// SHAPE_TORSO_LENGTH = 30, + SHAPE_MALE = 31, + /// /// - Short 0--+255 Long /// GLOVES_GLOVE_LENGTH = 32, + /// /// - Darker 0--+255 Lighter /// EYES_EYE_LIGHTNESS = 33, + /// /// - Natural 0--+255 Unnatural /// EYES_EYE_COLOR = 34, + /// /// - Small 0--+255 Large /// SHAPE_BREAST_SIZE = 35, + /// /// - None 0--+255 Wild /// SKIN_RAINBOW_COLOR = 36, + /// /// Ruddiness - Pale 0--+255 Ruddy /// SKIN_RED_SKIN = 37, + /// /// - Light 0--+255 Dark /// SKIN_PIGMENT = 38, + HAIR_RAINBOW_COLOR_39 = 39, + /// /// - No Red 0--+255 Very Red /// HAIR_RED_HAIR = 40, + /// /// - Black 0--+255 Blonde /// HAIR_BLONDE_HAIR = 41, + /// /// - No White 0--+255 All White /// HAIR_WHITE_HAIR = 42, + /// /// - Less Rosy 0--+255 More Rosy /// SKIN_ROSY_COMPLEXION = 43, + /// /// - Darker 0--+255 Pinker /// SKIN_LIP_PINKNESS = 44, + /// /// - Thin Eyebrows 0--+255 Bushy Eyebrows /// HAIR_EYEBROW_SIZE = 45, + /// /// - Short 0--+255 Long /// HAIR_FRONT_FRINGE = 46, + /// /// - Short 0--+255 Long /// HAIR_SIDE_FRINGE = 47, + /// /// - Short 0--+255 Long /// HAIR_BACK_FRINGE = 48, + /// /// - Short 0--+255 Long /// HAIR_HAIR_FRONT = 49, + /// /// - Short 0--+255 Long /// HAIR_HAIR_SIDES = 50, + /// /// - Short 0--+255 Long /// HAIR_HAIR_BACK = 51, + /// /// - Sweep Forward 0--+255 Sweep Back /// HAIR_HAIR_SWEEP = 52, + /// /// - Left 0--+255 Right /// HAIR_HAIR_TILT = 53, + /// /// Middle Part - No Part 0--+255 Part /// HAIR_HAIR_PART_MIDDLE = 54, + /// /// Right Part - No Part 0--+255 Part /// HAIR_HAIR_PART_RIGHT = 55, + /// /// Left Part - No Part 0--+255 Part /// HAIR_HAIR_PART_LEFT = 56, + /// /// Full Hair Sides - Mowhawk 0--+255 Full Sides /// HAIR_HAIR_SIDES_FULL = 57, + /// /// - Less 0--+255 More /// SKIN_BODY_DEFINITION = 58, + /// /// Lip Width - Narrow Lips 0--+255 Wide Lips /// SHAPE_LIP_WIDTH = 59, + /// /// - Small 0--+255 Big /// SHAPE_BELLY_SIZE = 60, + /// /// - Less 0--+255 More /// SKIN_FACIAL_DEFINITION = 61, + /// /// - Less 0--+255 More /// SKIN_WRINKLES = 62, + /// /// - Less 0--+255 More /// SKIN_FRECKLES = 63, + /// /// - Short Sideburns 0--+255 Mutton Chops /// HAIR_SIDEBURNS = 64, + /// /// - Chaplin 0--+255 Handlebars /// HAIR_MOUSTACHE = 65, + /// /// - Less soul 0--+255 More soul /// HAIR_SOULPATCH = 66, + /// /// - Less Curtains 0--+255 More Curtains /// HAIR_CHIN_CURTAINS = 67, + /// /// Rumpled Hair - Smooth Hair 0--+255 Rumpled Hair /// HAIR_HAIR_RUMPLED = 68, + /// /// Big Hair Front - Less 0--+255 More /// HAIR_HAIR_BIG_FRONT = 69, + /// /// Big Hair Top - Less 0--+255 More /// HAIR_HAIR_BIG_TOP = 70, + /// /// Big Hair Back - Less 0--+255 More /// HAIR_HAIR_BIG_BACK = 71, + /// /// Spiked Hair - No Spikes 0--+255 Big Spikes /// HAIR_HAIR_SPIKED = 72, + /// /// Chin Depth - Shallow 0--+255 Deep /// SHAPE_DEEP_CHIN = 73, + /// /// Part Bangs - No Part 0--+255 Part Bangs /// HAIR_BANGS_PART_MIDDLE = 74, + /// /// Head Shape - More Square 0--+255 More Round /// SHAPE_HEAD_SHAPE = 75, + /// /// Eye Spacing - Close Set Eyes 0--+255 Far Set Eyes /// SHAPE_EYE_SPACING = 76, + /// /// - Low Heels 0--+255 High Heels /// SHOES_HEEL_HEIGHT = 77, + /// /// - Low Platforms 0--+255 High Platforms /// SHOES_PLATFORM_HEIGHT = 78, + /// /// - Thin Lips 0--+255 Fat Lips /// SHAPE_LIP_THICKNESS = 79, + /// /// Mouth Position - High 0--+255 Low /// SHAPE_MOUTH_HEIGHT = 80, + /// /// Breast Buoyancy - Less Gravity 0--+255 More Gravity /// SHAPE_BREAST_GRAVITY = 81, + /// /// Platform Width - Narrow 0--+255 Wide /// SHOES_SHOE_PLATFORM_WIDTH = 82, + /// /// - Pointy Heels 0--+255 Thick Heels /// SHOES_HEEL_SHAPE = 83, + /// /// - Pointy 0--+255 Square /// SHOES_TOE_SHAPE = 84, + /// /// Foot Size - Small 0--+255 Big /// SHAPE_FOOT_SIZE = 85, + /// /// Nose Width - Narrow 0--+255 Wide /// SHAPE_WIDE_NOSE = 86, + /// /// Eyelash Length - Short 0--+255 Long /// SHAPE_EYELASHES_LONG = 87, + /// /// - Short 0--+255 Long /// UNDERSHIRT_SLEEVE_LENGTH = 88, + /// /// - Short 0--+255 Long /// UNDERSHIRT_BOTTOM = 89, + /// /// - Low 0--+255 High /// UNDERSHIRT_COLLAR_FRONT = 90, + JACKET_SLEEVE_LENGTH_91 = 91, JACKET_COLLAR_FRONT_92 = 92, + /// /// Jacket Length - Short 0--+255 Long /// JACKET_BOTTOM_LENGTH_LOWER = 93, + /// /// Open Front - Open 0--+255 Closed /// JACKET_OPEN_JACKET = 94, + /// /// - Short 0--+255 Tall /// SHOES_SHOE_HEIGHT = 95, + /// /// - Short 0--+255 Long /// SOCKS_SOCKS_LENGTH = 96, + /// /// - Short 0--+255 Long /// UNDERPANTS_PANTS_LENGTH = 97, + /// /// - Low 0--+255 High /// UNDERPANTS_PANTS_WAIST = 98, + /// /// Cuff Flare - Tight Cuffs 0--+255 Flared Cuffs /// PANTS_LEG_PANTFLAIR = 99, + /// /// - More Vertical 0--+255 More Sloped /// SHAPE_FOREHEAD_ANGLE = 100, + /// /// - Less Body Fat 0--+255 More Body Fat /// SHAPE_BODY_FAT = 101, + /// /// Pants Crotch - High and Tight 0--+255 Low and Loose /// PANTS_LOW_CROTCH = 102, + /// /// Egg Head - Chin Heavy 0--+255 Forehead Heavy /// SHAPE_EGG_HEAD = 103, + /// /// Head Stretch - Squash Head 0--+255 Stretch Head /// SHAPE_SQUASH_STRETCH_HEAD = 104, + /// /// Torso Muscles - Less Muscular 0--+255 More Muscular /// SHAPE_TORSO_MUSCLES = 105, + /// /// Outer Eye Corner - Corner Down 0--+255 Corner Up /// SHAPE_EYELID_CORNER_UP = 106, + /// /// - Less Muscular 0--+255 More Muscular /// SHAPE_LEG_MUSCLES = 107, + /// /// Lip Fullness - Less Full 0--+255 More Full /// SHAPE_TALL_LIPS = 108, + /// /// Toe Thickness - Flat Toe 0--+255 Thick Toe /// SHOES_SHOE_TOE_THICK = 109, + /// /// Crooked Nose - Nose Left 0--+255 Nose Right /// SHAPE_CROOKED_NOSE = 110, + /// /// - Corner Down 0--+255 Corner Up /// SHAPE_MOUTH_CORNER = 111, + /// /// - Shear Right Up 0--+255 Shear Left Up /// SHAPE_FACE_SHEAR = 112, + /// /// Shift Mouth - Shift Left 0--+255 Shift Right /// SHAPE_SHIFT_MOUTH = 113, + /// /// Eye Pop - Pop Right Eye 0--+255 Pop Left Eye /// SHAPE_POP_EYE = 114, + /// /// Jaw Jut - Overbite 0--+255 Underbite /// SHAPE_JAW_JUT = 115, + /// /// Shear Back - Full Back 0--+255 Sheared Back /// HAIR_HAIR_SHEAR_BACK = 116, + /// /// - Small Hands 0--+255 Large Hands /// SHAPE_HAND_SIZE = 117, + /// /// Love Handles - Less Love 0--+255 More Love /// SHAPE_LOVE_HANDLES = 118, + SHAPE_TORSO_MUSCLES_119 = 119, + /// /// Head Size - Small Head 0--+255 Big Head /// SHAPE_HEAD_SIZE = 120, + /// /// - Skinny Neck 0--+255 Thick Neck /// SHAPE_NECK_THICKNESS = 121, + /// /// Breast Cleavage - Separate 0--+255 Join /// SHAPE_BREAST_FEMALE_CLEAVAGE = 122, + /// /// Pectorals - Big Pectorals 0--+255 Sunken Chest /// SHAPE_CHEST_MALE_NO_PECS = 123, + /// /// Eye Size - Beady Eyes 0--+255 Anime Eyes /// SHAPE_EYE_SIZE = 124, + /// /// - Short Legs 0--+255 Long Legs /// SHAPE_LEG_LENGTH = 125, + /// /// - Short Arms 0--+255 Long arms /// SHAPE_ARM_LENGTH = 126, + /// /// - Pink 0--+255 Black /// SKIN_LIPSTICK_COLOR = 127, + /// /// - No Lipstick 0--+255 More Lipstick /// SKIN_LIPSTICK = 128, + /// /// - No Lipgloss 0--+255 Glossy /// SKIN_LIPGLOSS = 129, + /// /// - No Eyeliner 0--+255 Full Eyeliner /// SKIN_EYELINER = 130, + /// /// - No Blush 0--+255 More Blush /// SKIN_BLUSH = 131, + /// /// - Pink 0--+255 Orange /// SKIN_BLUSH_COLOR = 132, + /// /// - Clear 0--+255 Opaque /// SKIN_OUT_SHDW_OPACITY = 133, + /// /// - No Eyeshadow 0--+255 More Eyeshadow /// SKIN_OUTER_SHADOW = 134, + /// /// - Light 0--+255 Dark /// SKIN_OUT_SHDW_COLOR = 135, + /// /// - No Eyeshadow 0--+255 More Eyeshadow /// SKIN_INNER_SHADOW = 136, + /// /// - No Polish 0--+255 Painted Nails /// SKIN_NAIL_POLISH = 137, + /// /// - Clear 0--+255 Opaque /// SKIN_BLUSH_OPACITY = 138, + /// /// - Light 0--+255 Dark /// SKIN_IN_SHDW_COLOR = 139, + /// /// - Clear 0--+255 Opaque /// SKIN_IN_SHDW_OPACITY = 140, + /// /// - Dark Green 0--+255 Black /// SKIN_EYELINER_COLOR = 141, + /// /// - Pink 0--+255 Black /// SKIN_NAIL_POLISH_COLOR = 142, + /// /// - Sparse 0--+255 Dense /// HAIR_EYEBROW_DENSITY = 143, + /// /// - 5 O'Clock Shadow 0--+255 Bushy Hair /// HAIR_HAIR_THICKNESS = 144, + /// /// Saddle Bags - Less Saddle 0--+255 More Saddle /// SHAPE_SADDLEBAGS = 145, + /// /// Taper Back - Wide Back 0--+255 Narrow Back /// HAIR_HAIR_TAPER_BACK = 146, + /// /// Taper Front - Wide Front 0--+255 Narrow Front /// HAIR_HAIR_TAPER_FRONT = 147, + /// /// - Short Neck 0--+255 Long Neck /// SHAPE_NECK_LENGTH = 148, + /// /// Eyebrow Height - Higher 0--+255 Lower /// HAIR_LOWER_EYEBROWS = 149, + /// /// Lower Bridge - Low 0--+255 High /// SHAPE_LOWER_BRIDGE_NOSE = 150, + /// /// Nostril Division - High 0--+255 Low /// SHAPE_LOW_SEPTUM_NOSE = 151, + /// /// Jaw Angle - Low Jaw 0--+255 High Jaw /// SHAPE_JAW_ANGLE = 152, + /// /// Shear Front - Full Front 0--+255 Sheared Front /// HAIR_HAIR_SHEAR_FRONT = 153, + /// /// - Less Volume 0--+255 More Volume /// HAIR_HAIR_VOLUME = 154, + /// /// Lip Cleft Depth - Shallow 0--+255 Deep /// SHAPE_LIP_CLEFT_DEEP = 155, + /// /// Puffy Eyelids - Flat 0--+255 Puffy /// SHAPE_PUFFY_LOWER_LIDS = 156, + /// /// - Sunken Eyes 0--+255 Bugged Eyes /// SHAPE_EYE_DEPTH = 157, + /// /// - Flat Head 0--+255 Long Head /// SHAPE_HEAD_LENGTH = 158, + /// /// - Less Freckles 0--+255 More Freckles /// SKIN_BODY_FRECKLES = 159, + /// /// - Low 0--+255 High /// UNDERSHIRT_COLLAR_BACK = 160, + JACKET_COLLAR_BACK_161 = 161, SHIRT_COLLAR_BACK_162 = 162, + /// /// - Short Pigtails 0--+255 Long Pigtails /// HAIR_PIGTAILS = 163, + /// /// - Short Ponytail 0--+255 Long Ponytail /// HAIR_PONYTAIL = 164, + /// /// Butt Size - Flat Butt 0--+255 Big Butt /// SHAPE_BUTT_SIZE = 165, + /// /// Ear Tips - Flat 0--+255 Pointy /// SHAPE_POINTY_EARS = 166, + /// /// Lip Ratio - More Upper Lip 0--+255 More Lower Lip /// SHAPE_LIP_RATIO = 167, + SHIRT_SLEEVE_LENGTH_168 = 168, + /// /// - Short 0--+255 Long /// SHIRT_SHIRT_BOTTOM = 169, + SHIRT_COLLAR_FRONT_170 = 170, SHIRT_SHIRT_RED = 171, SHIRT_SHIRT_GREEN = 172, @@ -1701,15 +1841,19 @@ public enum VPElement : int PANTS_PANTS_BLUE = 176, SHOES_SHOES_RED = 177, SHOES_SHOES_GREEN = 178, + /// /// - Low 0--+255 High /// PANTS_WAIST_HEIGHT = 179, + PANTS_PANTS_LENGTH_180 = 180, + /// /// Pants Fit - Tight Pants 0--+255 Loose Pants /// PANTS_LOOSE_LOWER_CLOTHING = 181, + SHOES_SHOES_BLUE = 182, SOCKS_SOCKS_RED = 183, SOCKS_SOCKS_GREEN = 184, @@ -1721,73 +1865,91 @@ public enum VPElement : int UNDERPANTS_UNDERPANTS_GREEN = 190, UNDERPANTS_UNDERPANTS_BLUE = 191, GLOVES_GLOVES_RED = 192, + /// /// Shirt Fit - Tight Shirt 0--+255 Loose Shirt /// SHIRT_LOOSE_UPPER_CLOTHING = 193, + GLOVES_GLOVES_GREEN = 194, GLOVES_GLOVES_BLUE = 195, JACKET_JACKET_RED = 196, JACKET_JACKET_GREEN = 197, JACKET_JACKET_BLUE = 198, + /// /// Sleeve Looseness - Tight Sleeves 0--+255 Loose Sleeves /// SHIRT_SHIRTSLEEVE_FLAIR = 199, + /// /// Knee Angle - Knock Kneed 0--+255 Bow Legged /// SHAPE_BOWED_LEGS = 200, + /// /// - Short hips 0--+255 Long Hips /// SHAPE_HIP_LENGTH = 201, + /// /// - Fingerless 0--+255 Fingers /// GLOVES_GLOVE_FINGERS = 202, + /// /// bustle skirt - no bustle 0--+255 more bustle /// SKIRT_SKIRT_BUSTLE = 203, + /// /// - Short 0--+255 Long /// SKIRT_SKIRT_LENGTH = 204, + /// /// - Open Front 0--+255 Closed Front /// SKIRT_SLIT_FRONT = 205, + /// /// - Open Back 0--+255 Closed Back /// SKIRT_SLIT_BACK = 206, + /// /// - Open Left 0--+255 Closed Left /// SKIRT_SLIT_LEFT = 207, + /// /// - Open Right 0--+255 Closed Right /// SKIRT_SLIT_RIGHT = 208, + /// /// Skirt Fit - Tight Skirt 0--+255 Poofy Skirt /// SKIRT_SKIRT_LOOSENESS = 209, + SHIRT_SHIRT_WRINKLES = 210, PANTS_PANTS_WRINKLES = 211, + /// /// Jacket Wrinkles - No Wrinkles 0--+255 Wrinkles /// JACKET_JACKET_WRINKLES = 212, + /// /// Package - Coin Purse 0--+255 Duffle Bag /// SHAPE_MALE_PACKAGE = 213, + /// /// Inner Eye Corner - Corner Down 0--+255 Corner Up /// SHAPE_EYELID_INNER_CORNER_UP = 214, + SKIRT_SKIRT_RED = 215, SKIRT_SKIRT_GREEN = 216, SKIRT_SKIRT_BLUE = 217, @@ -1800,6 +1962,7 @@ public enum VPElement : int /// Breast Part 1 ///
BREAST_PHYSICS_MASS = 218, + BREAST_PHYSICS_GRAVITY = 219, BREAST_PHYSICS_DRAG = 220, BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, @@ -1810,10 +1973,12 @@ public enum VPElement : int BREAST_PHYSICS_INOUT_SPRING = 226, BREAST_PHYSICS_INOUT_GAIN = 227, BREAST_PHYSICS_INOUT_DAMPING = 228, + /// /// Belly /// BELLY_PHYISCS_MASS = 229, + BELLY_PHYSICS_GRAVITY = 230, BELLY_PHYSICS_DRAG = 231, BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, @@ -1825,6 +1990,7 @@ public enum VPElement : int /// Butt /// BUTT_PHYSICS_MASS = 236, + BUTT_PHYSICS_GRAVITY = 237, BUTT_PHYSICS_DRAG = 238, BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, @@ -1835,11 +2001,13 @@ public enum VPElement : int BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, + /// /// Breast Part 2 /// BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, - BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, + + BREAST_PHYSICS_LEFTRIGHT_SPRING = 248, BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250, @@ -1848,6 +2016,7 @@ public enum VPElement : int SHAPE_HOVER = 252, //ID 11001 } - #endregion + + #endregion VPElement } -} +} \ No newline at end of file diff --git a/Source/OpenSim.Framework/BasicDOSProtector.cs b/Source/OpenSim.Framework/BasicDOSProtector.cs index d1026088b24..c668f5655d4 100644 --- a/Source/OpenSim.Framework/BasicDOSProtector.cs +++ b/Source/OpenSim.Framework/BasicDOSProtector.cs @@ -24,14 +24,11 @@ * (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.Reflection; -using log4net; + +using Microsoft.Extensions.Logging; namespace OpenSim.Framework { - public class BasicDOSProtector { public enum ThrottleAction @@ -45,11 +42,19 @@ public enum ThrottleAction private readonly Dictionary _tempBlocked; // blocked list private readonly Dictionary _sessions; private readonly System.Timers.Timer _forgetTimer; // Cleanup timer - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly System.Threading.ReaderWriterLockSlim _blockLockSlim = new System.Threading.ReaderWriterLockSlim(); private readonly System.Threading.ReaderWriterLockSlim _sessionLockSlim = new System.Threading.ReaderWriterLockSlim(); - public BasicDOSProtector(BasicDosProtectorOptions options) + + private readonly ILogger _logger; + + public BasicDOSProtector( + ILogger logger, + BasicDosProtectorOptions options + ) { + _logger = logger; + _generalRequestTimes = new CircularBuffer(options.MaxRequestsInTimeframe + 1, true); _generalRequestTimes.Put(0); _options = options; @@ -65,27 +70,31 @@ public BasicDOSProtector(BasicDosProtectorOptions options) _blockLockSlim.EnterReadLock(); foreach (string str in _tempBlocked.Keys) { - if ( - Util.EnvironmentTickCountSubtract(Util.EnvironmentTickCount(), - _tempBlocked[str]) > 0) + if (Util.EnvironmentTickCountSubtract(Util.EnvironmentTickCount(), _tempBlocked[str]) > 0) removes.Add(str); } + _blockLockSlim.ExitReadLock(); + lock (_deeperInspection) { _blockLockSlim.EnterWriteLock(); + for (int i = 0; i < removes.Count; i++) { _tempBlocked.Remove(removes[i]); _deeperInspection.Remove(removes[i]); _sessions.Remove(removes[i]); } + _blockLockSlim.ExitWriteLock(); } + foreach (string str in removes) { - m_log.Info($"[{_options.ReportingName}] client: {str} is no longer blocked."); + _logger.LogInformation($"[{_options.ReportingName}] client: {str} is no longer blocked."); } + _blockLockSlim.EnterReadLock(); if (_tempBlocked.Count > 0) _forgetTimer.Enabled = true; @@ -145,6 +154,7 @@ public bool Process(string key, string endpoint) _sessionLockSlim.EnterReadLock(); if (_sessions.ContainsKey(key)) sessionscount = _sessions[key]; + _sessionLockSlim.ExitReadLock(); if (sessionscount > _options.MaxConcurrentSessions) @@ -159,7 +169,10 @@ public bool Process(string key, string endpoint) Util.EnvironmentTickCount() + (int) _options.ForgetTimeSpan.TotalMilliseconds); _forgetTimer.Enabled = true; - m_log.Warn($"[{_options.ReportingName}]: client: {clientstring} is blocked for {_options.ForgetTimeSpan.TotalMilliseconds}ms based on concurrency, X-ForwardedForAllowed status is {_options.AllowXForwardedFor}, endpoint:{_options.AllowXForwardedFor}"); + + _logger.LogWarning( + $"[{_options.ReportingName}]: client: {clientstring} is blocked for {_options.ForgetTimeSpan.TotalMilliseconds}ms " + + $"based on concurrency, X-ForwardedForAllowed status is {_options.AllowXForwardedFor}, endpoint:{_options.AllowXForwardedFor}"); } else @@ -240,7 +253,10 @@ private bool DeeperInspection(string key, string endpoint) _tempBlocked[clientstring] = Util.EnvironmentTickCount() + (int)_options.ForgetTimeSpan.TotalMilliseconds; _blockLockSlim.ExitWriteLock(); - m_log.Warn($"[{_options.ReportingName}]: client: {clientstring} is blocked for {_options.ForgetTimeSpan.TotalMilliseconds}ms, X-ForwardedForAllowed status is {_options.AllowXForwardedFor}, endpoint:{endpoint}"); + _logger.LogWarning( + $"[{_options.ReportingName}]: client: {clientstring} is blocked for {_options.ForgetTimeSpan.TotalMilliseconds}ms, " + + $"X-ForwardedForAllowed status is {_options.AllowXForwardedFor}, endpoint:{endpoint}"); + return false; } //else diff --git a/Source/OpenSim.Framework/ChildAgentDataUpdate.cs b/Source/OpenSim.Framework/ChildAgentDataUpdate.cs index 0314aaf467f..12f510c7b97 100644 --- a/Source/OpenSim.Framework/ChildAgentDataUpdate.cs +++ b/Source/OpenSim.Framework/ChildAgentDataUpdate.cs @@ -25,11 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using log4net; + using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -403,8 +400,6 @@ public UUID AgentID public List CachedFriendsOnline; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public void SetLookAt(Vector3 value) { if (value.X == 0 && value.Y == 0) @@ -422,7 +417,7 @@ public void SetLookAt(Vector3 value) public virtual OSDMap Pack(EntityTransferContext ctx) { - //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); + ////m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); OSDMap args = new OSDMap(); args["message_type"] = OSD.FromString("AgentData"); @@ -562,7 +557,7 @@ public virtual OSDMap Pack(EntityTransferContext ctx) } catch (IndexOutOfRangeException) { - m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list."); + //m_logger.LogWarning("[CHILD AGENT DATA]: scripts list is shorter than object list."); } attObjs.Add(info); @@ -591,7 +586,7 @@ public virtual OSDMap Pack(EntityTransferContext ctx) /// public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx) { - //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); + ////m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); OSD tmp; if (args.TryGetValue("region_id", out tmp) && tmp != null) UUID.TryParse(tmp.AsString(), out RegionID); @@ -781,13 +776,13 @@ public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx) // packed_appearence should contain all appearance information if (args.TryGetValue("packed_appearance", out tmp) && tmp is OSDMap) { - //m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance"); + ////m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance"); Appearance = new AvatarAppearance((OSDMap)tmp); } else { // if missing try the old pack method - m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method"); + //m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method"); Appearance = new AvatarAppearance(); @@ -825,7 +820,7 @@ public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx) // We know all of these must end up as attachments so we // append rather than replace to ensure multiple attachments // per point continues to work - // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); + // //m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); } } diff --git a/Source/OpenSim.Framework/ConfigurationMember.cs b/Source/OpenSim.Framework/ConfigurationMember.cs index 08bf91ee3a7..df57b34cea9 100755 --- a/Source/OpenSim.Framework/ConfigurationMember.cs +++ b/Source/OpenSim.Framework/ConfigurationMember.cs @@ -25,15 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Globalization; using System.Net; using System.Reflection; using System.Xml; -using log4net; using OpenMetaverse; -//using OpenSim.Framework.Console; namespace OpenSim.Framework { @@ -47,7 +43,6 @@ public class ConfigurationMember #endregion - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private int cE = 0; private string configurationDescription = String.Empty; @@ -119,9 +114,9 @@ private void checkAndAddConfigOption(ConfigurationOption option) } else { - m_log.Info( - "Required fields for adding a configuration option is invalid. Will not add this option (" + - option.configurationKey + ")"); + //m_log.Info( + //"Required fields for adding a configuration option is invalid. Will not add this option (" + + //option.configurationKey + ")"); } } @@ -160,39 +155,39 @@ public void addConfigurationOption(string configuration_key, public void performConfigurationRetrieve() { if (cE > 1) - m_log.Error("READING CONFIGURATION COUT: " + cE.ToString()); + //m_log.Error("READING CONFIGURATION COUT: " + cE.ToString()); configurationPlugin = LoadConfigDll(configurationPluginFilename); configurationOptions.Clear(); if (loadFunction == null) { - m_log.Error("Load Function for '" + configurationDescription + - "' is null. Refusing to run configuration."); + //m_log.Error("Load Function for '" + configurationDescription + + //"' is null. Refusing to run configuration."); return; } if (resultFunction == null) { - m_log.Error("Result Function for '" + configurationDescription + - "' is null. Refusing to run configuration."); + //m_log.Error("Result Function for '" + configurationDescription + + //"' is null. Refusing to run configuration."); return; } - //m_log.Debug("[CONFIG]: Calling Configuration Load Function..."); + ////m_log.Debug("[CONFIG]: Calling Configuration Load Function..."); loadFunction(); if (configurationOptions.Count <= 0) { - m_log.Error("[CONFIG]: No configuration options were specified for '" + configurationOptions + - "'. Refusing to continue configuration."); + //m_log.Error("[CONFIG]: No configuration options were specified for '" + configurationOptions + + //"'. Refusing to continue configuration."); return; } bool useFile = true; if (configurationPlugin == null) { - m_log.Error("[CONFIG]: Configuration Plugin NOT LOADED!"); + //m_log.Error("[CONFIG]: Configuration Plugin NOT LOADED!"); return; } @@ -206,10 +201,10 @@ public void performConfigurationRetrieve() } catch (XmlException e) { - m_log.WarnFormat("[CONFIG] Not using {0}: {1}", - configurationFilename, - e.Message.ToString()); - //m_log.Error("Error loading " + configurationFilename + ": " + e.ToString()); + ////m_log.WarnFormat("[CONFIG] Not using {0}: {1}", + // configurationFilename, + // e.Message.ToString()); + ////m_log.Error("Error loading " + configurationFilename + ": " + e.ToString()); useFile = false; } } @@ -217,11 +212,11 @@ public void performConfigurationRetrieve() { if (configurationFromXMLNode != null) { - m_log.Info("Loading from XML Node, will not save to the file"); + //m_log.Info("Loading from XML Node, will not save to the file"); configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); } - m_log.Info("XML Configuration Filename is not valid; will not save to the file."); + //m_log.Info("XML Configuration Filename is not valid; will not save to the file."); useFile = false; } @@ -458,8 +453,7 @@ public void performConfigurationRetrieve() if (!resultFunction(configOption.configurationKey, return_result)) { - m_log.Info( - "The handler for the last configuration option denied that input, please try again."); + //m_log.Info("The handler for the last configuration option denied that input, please try again."); convertSuccess = false; ignoreNextFromConfig = true; } @@ -468,18 +462,18 @@ public void performConfigurationRetrieve() { if (configOption.configurationUseDefaultNoPrompt) { - m_log.Error(string.Format( - "[CONFIG]: [{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); + //m_log.Error(string.Format( + //"[CONFIG]: [{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", + //configOption.configurationKey, console_result, errorMessage, + //configurationFilename)); convertSuccess = true; } else { - m_log.Warn(string.Format( - "[CONFIG]: [{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", - configOption.configurationKey, console_result, errorMessage, - configurationFilename)); + //m_log.Warn(string.Format( + //"[CONFIG]: [{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", + //configOption.configurationKey, console_result, errorMessage, + //configurationFilename)); ignoreNextFromConfig = true; } } diff --git a/Source/OpenSim.Framework/DAMap.cs b/Source/OpenSim.Framework/DAMap.cs index 1915fa52f9d..003a0c59d1d 100644 --- a/Source/OpenSim.Framework/DAMap.cs +++ b/Source/OpenSim.Framework/DAMap.cs @@ -25,17 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; -using log4net; -using OpenMetaverse; + using OpenMetaverse.StructuredData; namespace OpenSim.Framework @@ -52,13 +45,12 @@ namespace OpenSim.Framework /// public class DAMap : IXmlSerializable { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly int MIN_NAMESPACE_LENGTH = 4; private OSDMap m_map = new OSDMap(); // WARNING: this is temporary for experimentation only, it will be removed!!!! + [Obsolete] public OSDMap TopLevelMap { get { return m_map; } diff --git a/Source/OpenSim.Framework/GridInfo.cs b/Source/OpenSim.Framework/GridInfo.cs index d82d5e0809d..3ae7daa9a34 100644 --- a/Source/OpenSim.Framework/GridInfo.cs +++ b/Source/OpenSim.Framework/GridInfo.cs @@ -25,13 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Net; using System.Reflection; -using log4net; + using Microsoft.Extensions.Configuration; -using Nini.Config; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework { @@ -354,8 +352,6 @@ public override int GetHashCode() public class GridInfo { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private bool m_hasHGconfig; private OSHHTPHost m_gateKeeperURL; private HashSet m_gateKeeperAlias; @@ -370,11 +366,14 @@ public class GridInfo private string m_DestinationGuideURL = string.Empty; private string m_economyURL = string.Empty; - public GridInfo (IConfiguration config, string defaultURI = "") + private readonly ILogger m_logger; + + public GridInfo (IConfiguration config, ILogger logger, string defaultURI = "") { - string[] sections = new string[] {"Const", "Startup", "Hypergrid"}; + m_logger = logger; - string gatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", sections, string.Empty); + string[] sections = new string[] {"Const", "Startup", "Hypergrid"}; + string? gatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", sections, string.Empty); if (string.IsNullOrEmpty(gatekeeper)) { @@ -402,7 +401,7 @@ public GridInfo (IConfiguration config, string defaultURI = "") if (!m_gateKeeperURL.IsResolvedHost) { - m_log.Error(m_gateKeeperURL.IsValidHost ? "Could not resolve GatekeeperURI" : "GatekeeperURI is a invalid host"); + m_logger.LogError(m_gateKeeperURL.IsValidHost ? "Could not resolve GatekeeperURI" : "GatekeeperURI is a invalid host"); throw new Exception("GatekeeperURI configuration error"); } @@ -447,7 +446,7 @@ public GridInfo (IConfiguration config, string defaultURI = "") if (!m_homeURL.IsResolvedHost) { - m_log.Error(m_homeURL.IsValidHost ? "Could not resolve HomeURI" : "HomeURI is a invalid host"); + m_logger.LogError(m_homeURL.IsValidHost ? "Could not resolve HomeURI" : "HomeURI is a invalid host"); throw new Exception("HomeURI configuration error"); } @@ -484,7 +483,7 @@ public GridInfo (IConfiguration config, string defaultURI = "") tmpuri = new OSHTTPURI(m_SearchURL.Trim(), true); if (!tmpuri.IsResolvedHost) { - m_log.Error(tmpuri.IsValidHost ? "Could not resolve SearchServerURI" : "SearchServerURI is a invalid host"); + m_logger.LogError(tmpuri.IsValidHost ? "Could not resolve SearchServerURI" : "SearchServerURI is a invalid host"); throw new Exception("SearchServerURI configuration error"); } m_SearchURL = tmpuri.URI; @@ -500,7 +499,7 @@ public GridInfo (IConfiguration config, string defaultURI = "") tmpuri = new OSHTTPURI(m_DestinationGuideURL.Trim(), true); if (!tmpuri.IsResolvedHost) { - m_log.Error(tmpuri.IsValidHost ? "Could not resolve DestinationGuideURL" : "DestinationGuideURL is a invalid host"); + m_logger.LogError(tmpuri.IsValidHost ? "Could not resolve DestinationGuideURL" : "DestinationGuideURL is a invalid host"); throw new Exception("DestinationGuideURL configuration error"); } m_DestinationGuideURL = tmpuri.URI; @@ -512,7 +511,7 @@ public GridInfo (IConfiguration config, string defaultURI = "") tmpuri = new OSHTTPURI(m_economyURL.Trim(), true); if (!tmpuri.IsResolvedHost) { - m_log.Error(tmpuri.IsValidHost ? "Could not resolve economyURL" : "economyURL is a invalid host"); + m_logger.LogError(tmpuri.IsValidHost ? "Could not resolve economyURL" : "economyURL is a invalid host"); throw new Exception("economyURL configuration error"); } m_economyURL = tmpuri.URI; @@ -714,9 +713,13 @@ public string GridUrl { OSHHTPHost tmp = new OSHHTPHost(value, true); if (tmp.IsResolvedHost) + { m_gridUrl = tmp.URI; + } else - m_log.Error((tmp.IsValidHost ? "Could not resolve GridUrl" : "GridUrl is a invalid host ") + value ?? ""); + { + m_logger.LogError((tmp.IsValidHost ? "Could not resolve GridUrl" : "GridUrl is a invalid host ") + value ?? ""); + } } } @@ -727,9 +730,13 @@ public string SearchURL { OSHTTPURI tmp = new OSHTTPURI(value, true); if (tmp.IsResolvedHost) + { m_SearchURL = tmp.URI; + } else - m_log.Error((tmp.IsValidHost ? "Could not resolve SearchURL" : "SearchURL is a invalid host ") + value??""); + { + m_logger.LogError((tmp.IsValidHost ? "Could not resolve SearchURL" : "SearchURL is a invalid host ") + value ?? ""); + } } } @@ -740,9 +747,13 @@ public string DestinationGuideURL { OSHTTPURI tmp = new OSHTTPURI(value, true); if (tmp.IsResolvedHost) + { m_DestinationGuideURL = tmp.URI; + } else - m_log.Error((tmp.IsValidHost ? "Could not resolve DestinationGuideURL" : "DestinationGuideURL is a invalid host ") + value ?? ""); + { + m_logger.LogError((tmp.IsValidHost ? "Could not resolve DestinationGuideURL" : "DestinationGuideURL is a invalid host ") + value ?? ""); + } } } @@ -753,9 +764,13 @@ public string EconomyURL { OSHTTPURI tmp = new OSHTTPURI(value, true); if (tmp.IsResolvedHost) + { m_economyURL = tmp.URI; + } else - m_log.Error((tmp.IsValidHost ? "Could not resolve EconomyURL" : "EconomyURL is a invalid host ") + value ?? ""); + { + m_logger.LogError((tmp.IsValidHost ? "Could not resolve EconomyURL" : "EconomyURL is a invalid host ") + value ?? ""); + } } } } diff --git a/Source/OpenSim.Framework/ICommandConsole.cs b/Source/OpenSim.Framework/ICommandConsole.cs index 69d261f1264..975fec8287d 100755 --- a/Source/OpenSim.Framework/ICommandConsole.cs +++ b/Source/OpenSim.Framework/ICommandConsole.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using Microsoft.Extensions.Configuration; -using Nini.Config; -using System; -using System.Collections.Generic; using System.Xml; namespace OpenSim.Framework diff --git a/Source/OpenSim.Framework/IScene.cs b/Source/OpenSim.Framework/IScene.cs index bb6426b13e7..ec1d5b0a920 100644 --- a/Source/OpenSim.Framework/IScene.cs +++ b/Source/OpenSim.Framework/IScene.cs @@ -26,9 +26,9 @@ */ using OpenMetaverse; -//using OpenSim.Framework.Console; -using Nini.Config; + using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework { @@ -67,6 +67,8 @@ public interface IScene IConfiguration Config { get; } + ILogger Logger { get; } + /// /// Are logins enabled on this simulator? /// diff --git a/Source/OpenSim.Framework/InventoryFolderImpl.cs b/Source/OpenSim.Framework/InventoryFolderImpl.cs index 02259ab9942..7233f0efa9f 100644 --- a/Source/OpenSim.Framework/InventoryFolderImpl.cs +++ b/Source/OpenSim.Framework/InventoryFolderImpl.cs @@ -25,18 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; using OpenMetaverse; namespace OpenSim.Framework { public class InventoryFolderImpl : InventoryFolderBase { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static readonly string PATH_DELIMITER = "/"; /// @@ -386,8 +380,6 @@ public List RequestListOfItems() } } - //m_log.DebugFormat("[INVENTORY FOLDER IMPL]: Found {0} items", itemList.Count); - return itemList; } diff --git a/Source/OpenSim.Framework/LogWriter.cs b/Source/OpenSim.Framework/LogWriter.cs index 2e0bf4a354d..d010e52181f 100755 --- a/Source/OpenSim.Framework/LogWriter.cs +++ b/Source/OpenSim.Framework/LogWriter.cs @@ -25,10 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; +using Microsoft.Extensions.Logging; using System.Text; -using log4net; namespace OpenSim.Framework { @@ -55,7 +53,7 @@ public class LogWriter : IDisposable private bool m_flushWrite; // set externally when debugging. If let 'null', this does not write any error messages. - public ILog ErrorLogger = null; + public ILogger ErrorLogger = null; private string LogHeader = "[LOG WRITER]"; /// @@ -171,7 +169,7 @@ public void Write(string line) { if (ErrorLogger != null) { - ErrorLogger.ErrorFormat("{0}: FAILURE WRITING TO LOGFILE: {1}", LogHeader, e); + ErrorLogger.LogError(e, $"{LogHeader}: FAILURE WRITING TO LOGFILE: "); } Enabled = false; } diff --git a/Source/OpenSim.Framework/ModuleLoader.cs b/Source/OpenSim.Framework/ModuleLoader.cs deleted file mode 100644 index 0e2ad5ac7ed..00000000000 --- a/Source/OpenSim.Framework/ModuleLoader.cs +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) Contributors, http://whitecore-sim.org/, http://aurora-sim.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 WhiteCore-Sim 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.Linq; -using System.Reflection; - -namespace OpenSim.Framework -{ - public static class ModuleLoader - { - #region Module Loaders - - /// - /// Find all T modules in the current directory - /// - /// - /// - public static List FindModules() - { - return LoadModules("."); - } - - /// - /// Gets all modules found in the given directory. - /// Identifier is the name of the interface. - /// - /// - /// - /// - public static List LoadModules(string moduleDir) - { - PluginLoadContext loadContext = new PluginLoadContext(moduleDir); - List modules = new List(); - - DirectoryInfo dir = new DirectoryInfo(moduleDir); - - foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) - modules.AddRange(LoadModulesFromDLL(moduleDir, fileInfo.FullName)); - - //try - //{ - // List loadedDllModules; - // LoadedDlls.TryGetValue(moduleDir, out loadedDllModules); - // foreach (Type pluginType in loadedDllModules) - // { - // try - // { - // if (pluginType.IsPublic) - // { - // if (!pluginType.IsAbstract) - // { - // if(typeof (T).IsAssignableFrom(pluginType)) - // { - // modules.Add((T) Activator.CreateInstance(pluginType)); - // } - // } - // } - // } - // catch (Exception) - // { - // } - // } - // } - // catch (Exception) - // { - // } - - return modules; - } - - /// - /// Load all T modules from dllname - /// - /// - /// - /// - /// - private static List LoadModulesFromDLL(string moduleDir, string dllName) - { - List modules = new List(); - - Assembly pluginAssembly = Assembly.Load(AssemblyName.GetAssemblyName(dllName)); - - if (pluginAssembly != null) - { - try - { - List loadedTypes = new List(); - foreach (Type pluginType in pluginAssembly.GetTypes().Where((p) => p.IsPublic && !p.IsAbstract)) - { - try - { - if (typeof(T).IsAssignableFrom(pluginType)) - { - modules.Add((T) Activator.CreateInstance(pluginType)); - } - } - catch (Exception ex) - { - //MainConsole.Instance.Warn("[MODULELOADER]: Error loading module " + pluginType.Name + - // " in file " + dllName + - // " : " + ex); - } - } - } - catch (Exception) - { - } - } - - return modules; - } - - #endregion - - /// - /// Load all plugins from the given .dll file with the interface 'type' - /// - /// - /// - /// - public static List LoadPlugins(string dllName) - { - List plugins = new List(); - try - { - Assembly pluginAssembly = Assembly.Load(AssemblyName.GetAssemblyName(dllName)); - foreach (Type pluginType in pluginAssembly.GetTypes().Where(pluginType => pluginType.IsPublic)) - { - try - { - if (typeof(T).IsAssignableFrom(pluginType)) - { - plugins.Add((T) Activator.CreateInstance(pluginType)); - } - } - catch (Exception) - { - } - } - } - catch (ReflectionTypeLoadException e) - { - foreach (Exception e2 in e.LoaderExceptions) - { - //MainConsole.Instance.Error(e2.ToString()); - } - throw e; - } - return plugins; - } - } -} diff --git a/Source/OpenSim.Framework/NetworkUtil.cs b/Source/OpenSim.Framework/NetworkUtil.cs index 93c94463a2f..541dfdf19e4 100644 --- a/Source/OpenSim.Framework/NetworkUtil.cs +++ b/Source/OpenSim.Framework/NetworkUtil.cs @@ -25,14 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Net.Sockets; using System.Net; using System.Net.NetworkInformation; -using System.Reflection; -using System.Text; -using log4net; namespace OpenSim.Framework { @@ -46,9 +41,6 @@ namespace OpenSim.Framework /// public static class NetworkUtil { - // Logger - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static bool m_disabled = true; public static bool Enabled @@ -70,7 +62,6 @@ public static IPAddress GetIPFor(IPAddress user, IPAddress simulator) { if (host.Equals(user) && host.AddressFamily == AddressFamily.InterNetwork) { - m_log.Info("[NetworkUtil] Localhost user detected, sending them '" + host + "' instead of '" + simulator + "'"); return host; } } @@ -101,7 +92,6 @@ public static IPAddress GetIPFor(IPAddress user, IPAddress simulator) if (valid) { - m_log.Info("[NetworkUtil] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + simulator + "'"); return subnet.Key; } } @@ -119,7 +109,6 @@ private static IPAddress GetExternalIPFor(IPAddress destination, string defaultH { if (host.AddressFamily == AddressFamily.InterNetworkV6) { - m_log.Info("[NetworkUtil] Localhost user detected, sending them '" + host + "' instead of '" + defaultHostname + "'"); return host; } } @@ -134,7 +123,6 @@ private static IPAddress GetExternalIPFor(IPAddress destination, string defaultH IPAddress host = pair.Value; if (host.Equals(destination) && host.AddressFamily == AddressFamily.InterNetwork) { - m_log.Info("[NATROUTING] Localhost user detected, sending them '" + host + "' instead of '" + defaultHostname + "'"); return destination; } } @@ -165,7 +153,6 @@ private static IPAddress GetExternalIPFor(IPAddress destination, string defaultH if (valid) { - m_log.Info("[NetworkUtil] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + defaultHostname + "'"); return subnet.Key; } } diff --git a/Source/OpenSim.Framework/ObjectJobEngine.cs b/Source/OpenSim.Framework/ObjectJobEngine.cs index 19e59d7147e..24693539403 100644 --- a/Source/OpenSim.Framework/ObjectJobEngine.cs +++ b/Source/OpenSim.Framework/ObjectJobEngine.cs @@ -29,18 +29,14 @@ // can have up to m_concurrency number of execution threads // it will hold each thread up to m_threadsHoldtime ms waiting for more work, before releasing it back to the pool. -using System; +using Microsoft.Extensions.Logging; using System.Collections.Concurrent; using System.Reflection; -using System.Threading; -using log4net; namespace OpenSim.Framework { public class ObjectJobEngine : IDisposable { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly object m_mainLock = new object(); private readonly string m_name; private readonly int m_threadsHoldtime; @@ -52,8 +48,16 @@ public class ObjectJobEngine : IDisposable private int m_numberThreads = 0; private bool m_isRunning; - public ObjectJobEngine(WaitCallback callback, string name, int threadsHoldtime = 1000, int concurrency = 1) + private ILogger m_logger; + + public ObjectJobEngine( + ILogger logger, + WaitCallback callback, + string name, + int threadsHoldtime = 1000, + int concurrency = 1) { + m_logger = logger; m_name = name; m_threadsHoldtime = threadsHoldtime; @@ -155,12 +159,13 @@ public bool Enqueue(object o) private void ProcessRequests(object o) { - object obj; + object? obj; + while (m_isRunning) { try { - if(!m_jobQueue.TryTake(out obj, m_threadsHoldtime, m_cancelSource.Token)) + if (!m_jobQueue.TryTake(out obj, m_threadsHoldtime, m_cancelSource.Token)) { lock (m_mainLock) { @@ -178,6 +183,7 @@ private void ProcessRequests(object o) if(!m_isRunning || m_callback == null) break; + try { m_callback.Invoke(obj); @@ -185,11 +191,14 @@ private void ProcessRequests(object o) } catch (Exception e) { - m_log.ErrorFormat("[ObjectJob {0}]: Job failed, continuing. Exception {1}", m_name, e); + m_logger.LogError(e, $"[ObjectJob {m_name}]: Job failed, continuing."); } } + lock (m_mainLock) + { --m_numberThreads; + } } } } diff --git a/Source/OpenSim.Framework/OpenSim.Framework.csproj b/Source/OpenSim.Framework/OpenSim.Framework.csproj index 5d75e300e3c..9b306f4ff6e 100644 --- a/Source/OpenSim.Framework/OpenSim.Framework.csproj +++ b/Source/OpenSim.Framework/OpenSim.Framework.csproj @@ -29,9 +29,6 @@ False - - - @@ -39,8 +36,9 @@ - - + + + diff --git a/Source/OpenSim.Framework/OutboundUrlFilter.cs b/Source/OpenSim.Framework/OutboundUrlFilter.cs index 5fc201a05a5..3834a1bca14 100644 --- a/Source/OpenSim.Framework/OutboundUrlFilter.cs +++ b/Source/OpenSim.Framework/OutboundUrlFilter.cs @@ -26,10 +26,9 @@ */ using System.Net; -using System.Reflection; -using log4net; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using IPNetwork = LukeSkywalker.IPNetwork.IPNetwork; @@ -37,8 +36,6 @@ namespace OpenSim.Framework { public class OutboundUrlFilter { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get; private set; } private List m_blacklistNetworks; @@ -47,11 +44,15 @@ public class OutboundUrlFilter private List m_blacklistExceptionNetworks; private List m_blacklistExceptionEndPoints; + private ILogger m_logger; + public OutboundUrlFilter( + ILogger logger, string name, List blacklistNetworks, List blacklistEndPoints, List blacklistExceptionNetworks, List blacklistExceptionEndPoints) { + m_logger = logger; Name = name; m_blacklistNetworks = blacklistNetworks; @@ -65,8 +66,9 @@ public OutboundUrlFilter( /// /// Name of the filter for logging purposes. /// Filter configuration - public OutboundUrlFilter(string name, IConfiguration config) + public OutboundUrlFilter(ILogger logger, string name, IConfiguration config) { + m_logger = logger; Name = name; string configBlacklist @@ -80,10 +82,10 @@ string configBlacklist configBlacklistExceptions = networkConfig.GetValue("OutboundDisallowForUserScriptsExcept", configBlacklistExceptions); } - m_log.DebugFormat( - "[OUTBOUND URL FILTER]: OutboundDisallowForUserScripts for {0} is [{1}]", Name, configBlacklist); - m_log.DebugFormat( - "[OUTBOUND URL FILTER]: OutboundDisallowForUserScriptsExcept for {0} is [{1}]", Name, configBlacklistExceptions); + m_logger.LogDebug( + $"[OUTBOUND URL FILTER]: OutboundDisallowForUserScripts for {Name} is [{configBlacklist}]"); + m_logger.LogDebug( + $"[OUTBOUND URL FILTER]: OutboundDisallowForUserScriptsExcept for {Name} is [{configBlacklistExceptions}]"); OutboundUrlFilter.ParseConfigList( configBlacklist, Name, out m_blacklistNetworks, out m_blacklistEndPoints); @@ -111,8 +113,8 @@ string[] configBlacklistEntries if (!IPNetwork.TryParse(configEntry, out network)) { - m_log.ErrorFormat( - "[OUTBOUND URL FILTER]: Entry [{0}] is invalid network for {1}", configEntry, filterName); +// m_logger.LogError( +// $"[OUTBOUND URL FILTER]: Entry [{configEntry}] is invalid network for {filterName}"); continue; } @@ -125,9 +127,8 @@ string[] configBlacklistEntries if (!Uri.TryCreate("http://" + configEntry, UriKind.Absolute, out configEntryUri)) { - m_log.ErrorFormat( - "[OUTBOUND URL FILTER]: EndPoint entry [{0}] is invalid endpoint for {1}", - configEntry, filterName); +// m_logger.LogError( +// $"[OUTBOUND URL FILTER]: EndPoint entry [{configEntry}] is invalid endpoint for {filterName}"); continue; } @@ -138,12 +139,12 @@ string[] configBlacklistEntries { if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { - // m_log.DebugFormat("[OUTBOUND URL FILTER]: Found address [{0}] in config", addr); +// m_logger.LogDebug($"[OUTBOUND URL FILTER]: Found address [{addr}] in config"); IPEndPoint configEntryEp = new IPEndPoint(addr, configEntryUri.Port); endPoints.Add(configEntryEp); - // m_log.DebugFormat("[OUTBOUND URL FILTER]: Added blacklist exception [{0}]", configEntryEp); +// m_logger.LogDebug($"[OUTBOUND URL FILTER]: Added blacklist exception [{configEntryEp}]"); } } } diff --git a/Source/OpenSim.Framework/PermissionsUtil.cs b/Source/OpenSim.Framework/PermissionsUtil.cs index 99650d8bc5e..70a5cf42b54 100644 --- a/Source/OpenSim.Framework/PermissionsUtil.cs +++ b/Source/OpenSim.Framework/PermissionsUtil.cs @@ -25,27 +25,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using log4net; +using Microsoft.Extensions.Logging; namespace OpenSim.Framework { public static class PermissionsUtil { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Logs permissions flags. Useful when debugging permission problems. /// /// - public static void LogPermissions(String name, String message, uint basePerm, uint curPerm, uint nextPerm) + public static void LogPermissions(ILogger log, String name, String message, uint basePerm, uint curPerm, uint nextPerm) { - m_log.DebugFormat("Permissions of \"{0}\" at \"{1}\": Base {2} ({3:X4}), Current {4} ({5:X4}), NextOwner {6} ({7:X4})", - name, message, - PermissionsToString(basePerm), basePerm, PermissionsToString(curPerm), curPerm, PermissionsToString(nextPerm), nextPerm); + log.LogDebug( + $"Permissions of \"{name}\" at \"{message}\": Base {PermissionsToString(basePerm)} ({basePerm:X4}), " + + $"Current {PermissionsToString(curPerm)} ({curPerm:X4}), NextOwner {PermissionsToString(nextPerm)} ({nextPerm:X4})"); } /// diff --git a/Source/OpenSim.Framework/PluginLoadContext.cs b/Source/OpenSim.Framework/PluginLoadContext.cs deleted file mode 100644 index 75882265ed6..00000000000 --- a/Source/OpenSim.Framework/PluginLoadContext.cs +++ /dev/null @@ -1,46 +0,0 @@ -using log4net; -using System; -using System.Reflection; -using System.Runtime.Loader; - -/* - * To support the dotnet core way of doing plugin loading - */ -namespace OpenSim.Framework -{ - public class PluginLoadContext : AssemblyLoadContext - { - private static readonly ILog log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private AssemblyDependencyResolver _resolver; - - public PluginLoadContext(string pluginPath) - { - _resolver = new AssemblyDependencyResolver(pluginPath); - } - - protected override Assembly Load(AssemblyName assemblyName) - { - string assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName); - - if (assemblyPath != null) - { - return LoadFromAssemblyPath(assemblyPath); - } - - return null; - } - - protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) - { - string libraryPath = _resolver.ResolveUnmanagedDllToPath(unmanagedDllName); - if (libraryPath != null) - { - return LoadUnmanagedDllFromPath(libraryPath); - } - - return IntPtr.Zero; - } - } -} diff --git a/Source/OpenSim.Framework/PluginLoader.cs b/Source/OpenSim.Framework/PluginLoader.cs deleted file mode 100644 index d9c03b0787b..00000000000 --- a/Source/OpenSim.Framework/PluginLoader.cs +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.Reflection; -using System.Runtime.Loader; -using log4net; - -namespace OpenSim.Framework -{ - /// - /// Generic Plugin Loader - /// - public class PluginLoader where T : IPlugin - { - private static readonly ILog log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public PluginInitialiserBase Initialiser { get; set; } = new PluginInitialiserBase(); - - private string pluginBaseDir = String.Empty; - - public PluginLoader(PluginInitialiserBase init) - { - Initialiser = init; - } - - public PluginLoader(PluginInitialiserBase init, string dir) - { - Initialiser = init; - pluginBaseDir = dir; - } - - public List Load() - { - List loadedPlugins = new List(); - if (string.IsNullOrEmpty(pluginBaseDir)) - { - pluginBaseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - } - - DirectoryInfo dir = new DirectoryInfo(pluginBaseDir); - AssemblyLoadContext loadContext = new AssemblyLoadContext(dir.FullName); - - foreach (FileInfo fileInfo in dir.GetFiles("OpenSim.ApplicationPlugins.*.dll")) - { - try - { - AssemblyName assemblyName = AssemblyName.GetAssemblyName(fileInfo.FullName); - - log.Info($"[PLUGINLOADER] Searching {assemblyName.FullName} for modules to load"); - Assembly pluginAssembly = loadContext.LoadFromAssemblyPath(fileInfo.FullName); - - if (pluginAssembly != null) - { - foreach (var pluginType in pluginAssembly.GetTypes().Where((p) => p.IsPublic && !p.IsAbstract)) - { - try - { - if (typeof(T).IsAssignableFrom(pluginType)) - { - log.Info($"[PLUGINLOADER] Initializing {pluginType.FullName}"); - loadedPlugins.Add((T)Activator.CreateInstance(pluginType)); - } - } - catch (Exception ex) - { - log.Warn($"[MODULELOADER]: Error loading module {pluginType.Name} in file {fileInfo.FullName} : {ex}"); - } - } - } - } - catch (Exception ex) - { - log.Warn($"[MODULELOADER]: Error loading assembly {fileInfo.FullName} : {ex}"); - continue; - } - } - - foreach (T plugin in loadedPlugins) - { - Initialiser.Initialise(plugin); - } - - return loadedPlugins; - } - } -} diff --git a/Source/OpenSim.Framework/PrimitiveBaseShape.cs b/Source/OpenSim.Framework/PrimitiveBaseShape.cs index fb9c416ec03..232ce801b04 100644 --- a/Source/OpenSim.Framework/PrimitiveBaseShape.cs +++ b/Source/OpenSim.Framework/PrimitiveBaseShape.cs @@ -25,16 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; - -using System.IO; -using System.Reflection; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Runtime.CompilerServices; -using log4net; + using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -79,8 +74,6 @@ public enum Extrusion : byte [Serializable] public class PrimitiveBaseShape { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes(); private byte[] m_textureEntry; @@ -197,10 +190,8 @@ public byte ProfileCurve if (!Enum.IsDefined(typeof(HollowShape), hollowShapeByte)) { - m_log.WarnFormat( - "[SHAPE]: Attempt to set a ProfileCurve with a hollow shape value of {0}, which isn't a valid enum. Replacing with default shape.", - hollowShapeByte); - + // Attempt to set a ProfileCurve with a hollow shape value of {0}, which isn't a valid enum. + // Replacing with default shape.", _hollowShape = HollowShape.Same; } else @@ -213,10 +204,8 @@ public byte ProfileCurve if (!Enum.IsDefined(typeof(ProfileShape), profileShapeByte)) { - m_log.WarnFormat( - "[SHAPE]: Attempt to set a ProfileCurve with a profile shape value of {0}, which isn't a valid enum. Replacing with square.", - profileShapeByte); - + // Attempt to set a ProfileCurve with a profile shape value of {0}, which isn't a valid enum. + // Replacing with square. _profileShape = ProfileShape.Square; } else @@ -292,10 +281,11 @@ public Primitive.TextureEntry Textures get { //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); - try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } + try { + return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); + } catch { } - m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0)); return new Primitive.TextureEntry(UUID.Zero); } @@ -1675,7 +1665,7 @@ public void ReadXml(string rawXml) } catch { - m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" ); + // PrimitiveBaseShape] error decoding MOAP xml } } diff --git a/Source/OpenSim.Framework/RegionInfo.cs b/Source/OpenSim.Framework/RegionInfo.cs index c8407bd492c..7cdb885cf9c 100644 --- a/Source/OpenSim.Framework/RegionInfo.cs +++ b/Source/OpenSim.Framework/RegionInfo.cs @@ -25,21 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using log4net; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Configuration.Ini; using OpenMetaverse; using OpenMetaverse.StructuredData; - using System.Net; -using System.Reflection; -using System.Xml; namespace OpenSim.Framework { public class RegionInfo { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string LogHeader = "[REGION INFO]"; public bool commFailTF = false; @@ -437,13 +430,13 @@ public void SetEndPoint(string ipaddr, int port) m_internalEndPoint = tmpEPE; } - public string GetSetting(string key) + public string? GetSetting(string key) { string val; string keylower = key.ToLower(); if (m_extraSettings.TryGetValue(keylower, out val)) return val; - m_log.DebugFormat("[RegionInfo] Could not locate value for parameter {0}", key); + return null; } @@ -749,9 +742,6 @@ private void DoDefaultLandingSanityChecks() // Height if (DefaultLandingPoint.Z < 0f) DefaultLandingPoint.Z = 0f; - - if (ValuesCapped) - m_log.WarnFormat("[RegionInfo]: The default landing location for {0} has been capped to {1}", RegionName, DefaultLandingPoint); } // Make sure user specified region sizes are sane. @@ -768,17 +758,14 @@ private void DoRegionSizeSanityChecks() RegionSizeX -= partial; if (RegionSizeX == 0) RegionSizeX = Constants.RegionSize; - m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}", - LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial); } + partial = RegionSizeY % Constants.RegionSize; if (partial != 0) { RegionSizeY -= partial; if (RegionSizeY == 0) RegionSizeY = Constants.RegionSize; - m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}", - LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial); } // Because of things in the viewer, regions MUST be square. @@ -788,8 +775,6 @@ private void DoRegionSizeSanityChecks() uint minSize = Math.Min(RegionSizeX, RegionSizeY); RegionSizeX = minSize; RegionSizeY = minSize; - m_log.ErrorFormat("{0} Regions must be square until viewers are updated. Forcing region {1} size to <{2},{3}>", - LogHeader, m_regionName, RegionSizeX, RegionSizeY); } // There is a practical limit to region size. @@ -797,11 +782,7 @@ private void DoRegionSizeSanityChecks() { RegionSizeX = Util.Clamp(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize); RegionSizeY = Util.Clamp(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize); - m_log.ErrorFormat("{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>", - LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY); } - - m_log.InfoFormat("{0} Region {1} size set to <{2},{3}>", LogHeader, m_regionName, RegionSizeX, RegionSizeY); } } diff --git a/Source/OpenSim.Framework/RestClient.cs b/Source/OpenSim.Framework/RestClient.cs index 49c7f632a55..75cdf0162d5 100644 --- a/Source/OpenSim.Framework/RestClient.cs +++ b/Source/OpenSim.Framework/RestClient.cs @@ -25,18 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; using System.Net; -using System.Net.Http; -using System.Reflection; using System.Runtime.CompilerServices; using System.Text; -using System.Threading; using System.Web; -using log4net; - +using Microsoft.Extensions.Logging; using OpenSim.Framework.ServiceAuth; namespace OpenSim.Framework @@ -49,8 +42,6 @@ namespace OpenSim.Framework /// public class RestClient : IDisposable { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - // private string realuri; #region member variables @@ -103,15 +94,18 @@ public class RestClient : IDisposable /// Instantiate a new RestClient /// /// Web-service to query, e.g. http://osgrid.org:8003 - public RestClient(string url) + public RestClient(ILogger logger, string url) { + _logger = logger; + _lock = new object(); + _url = url; _readbuf = new byte[BufferSize]; _resource = new MemoryStream(); - _lock = new object(); } private readonly object _lock; + private readonly ILogger _logger; #endregion constructors @@ -164,11 +158,11 @@ public void AddQueryParameter(string name, string value) } catch (ArgumentException) { - m_log.Error("[REST]: Query parameter " + name + " is already added."); + _logger.LogError($"[REST]: Query parameter {name} is already added."); } catch (Exception e) { - m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e); + _logger.LogError(e, "[REST]: An exception was raised adding query parameter to dictionary."); } } @@ -184,11 +178,11 @@ public void AddQueryParameter(string name) } catch (ArgumentException) { - m_log.Error("[REST]: Query parameter " + name + " is already added."); + _logger.LogError($"[REST]: Query parameter {name} is already added."); } catch (Exception e) { - m_log.Error("[REST]: An exception was raised adding query parameter to dictionary. Exception: {0}",e); + _logger.LogError(e, "[REST]: An exception was raised adding query parameter to dictionary."); } } @@ -234,8 +228,7 @@ private Uri buildUri() sb.Append(kv.Value); } } - // realuri = sb.ToString(); - //m_log.InfoFormat("[REST CLIENT]: RestURL: {0}", realuri); + return new Uri(sb.ToString()); } @@ -243,15 +236,15 @@ private Uri buildUri() /// Perform a synchronous request /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public MemoryStream Request() + public MemoryStream? Request(ILogger logger) { - return Request(null); + return Request(logger, auth: null); } /// /// Perform a synchronous request /// - public MemoryStream Request(IServiceAuth auth) + public MemoryStream? Request(ILogger logger, IServiceAuth auth) { lock (_lock) { @@ -280,7 +273,9 @@ public MemoryStream Request(IServiceAuth auth) if (WebUtil.DebugLevel >= 3) - m_log.DebugFormat("[REST CLIENT] {0} to {1}", RequestMethod, uri); + { + _logger.LogDebug($"[REST CLIENT] {RequestMethod} to {uri}"); + } //_request.ContentType = "application/xml"; responseMessage = client.Send(request, HttpCompletionOption.ResponseHeadersRead); @@ -303,22 +298,23 @@ public MemoryStream Request(IServiceAuth auth) if (status == HttpStatusCode.NotFound) { // This is often benign. E.g., requesting a missing asset will return 404. - m_log.DebugFormat("[REST CLIENT] Resource not found (404): {0}", uri.ToString()); + _logger.LogDebug($"[REST CLIENT] Resource not found (404): {uri}"); } else { - m_log.Error($"[REST CLIENT] Error fetching resource from server: {uri} status: {status} {e.Message}"); + _logger.LogError(e, $"[REST CLIENT] Error fetching resource from server: {uri} status: {status}"); } } else { - m_log.Error($"[REST CLIENT] Error fetching resource from server: {uri} {e.Message}"); + _logger.LogError(e, $"[REST CLIENT] Error fetching resource from server: {uri}"); } } else { - m_log.Error($"[REST CLIENT] Error fetching null resource from server: {e.Message}"); + _logger.LogError(e, $"[REST CLIENT] Error fetching null resource from server."); } + return null; } finally @@ -335,7 +331,9 @@ public MemoryStream Request(IServiceAuth auth) } if (WebUtil.DebugLevel >= 5) - WebUtil.LogOutgoingDetail("[REST CLIENT]", _resource); + { + // WebUtil.LogOutgoingDetail(logger, "[REST CLIENT]", _resource); + } return _resource; } @@ -376,23 +374,23 @@ public void POSTRequest(byte[] src, IServiceAuth auth) } catch (HttpRequestException e) { - if(uri is not null) + if (uri is not null) { if (e.StatusCode is HttpStatusCode status) - m_log.Warn($"[REST]: POST {uri} failed with status {status} and message {e.Message}"); + _logger.LogWarning(e, $"[REST]: POST {uri} failed with status {status}"); else - m_log.Warn($"[REST]: POST {uri} failed with message {e.Message}"); + _logger.LogError(e, $"[REST]: POST {uri}"); } else - m_log.Warn($"[REST]: POST failed {e.Message}"); + _logger.LogError(e, $"[REST]: POST failed"); return; } catch (Exception e) { if (uri is not null) - m_log.Warn($"[REST]: POST {uri} failed with message {e.Message}"); + _logger.LogError(e, $"[REST]: POST {uri}"); else - m_log.Warn($"[REST]: POST failed {e.Message}"); + _logger.LogError(e, $"[REST]: POST failed"); return; } finally diff --git a/Source/OpenSim.Framework/ServiceAuth/BasicHttpAuthentication.cs b/Source/OpenSim.Framework/ServiceAuth/BasicHttpAuthentication.cs index 23210500cbb..7d0ea661811 100644 --- a/Source/OpenSim.Framework/ServiceAuth/BasicHttpAuthentication.cs +++ b/Source/OpenSim.Framework/ServiceAuth/BasicHttpAuthentication.cs @@ -25,14 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Collections.Specialized; using System.Net; -using System.Reflection; - -using Nini.Config; -using log4net; using System.Net.Http.Headers; using Microsoft.Extensions.Configuration; @@ -40,8 +34,6 @@ namespace OpenSim.Framework.ServiceAuth { public class BasicHttpAuthentication : IServiceAuth { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "BasicHttp"; } } private string m_Username, m_Password; diff --git a/Source/OpenSim.Framework/ServiceAuth/ServiceAuth.cs b/Source/OpenSim.Framework/ServiceAuth/ServiceAuth.cs index abb71058692..c32ffe707d4 100644 --- a/Source/OpenSim.Framework/ServiceAuth/ServiceAuth.cs +++ b/Source/OpenSim.Framework/ServiceAuth/ServiceAuth.cs @@ -25,12 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; using Microsoft.Extensions.Configuration; -using Nini.Config; namespace OpenSim.Framework.ServiceAuth { diff --git a/Source/OpenSim.Framework/TaskInventoryDictionary.cs b/Source/OpenSim.Framework/TaskInventoryDictionary.cs index d1a112a69a2..12ede85bf86 100644 --- a/Source/OpenSim.Framework/TaskInventoryDictionary.cs +++ b/Source/OpenSim.Framework/TaskInventoryDictionary.cs @@ -25,15 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Reflection; using System.Xml; -using System.Diagnostics; using System.Xml.Schema; using System.Xml.Serialization; -using log4net; using OpenMetaverse; namespace OpenSim.Framework @@ -50,7 +44,6 @@ public class TaskInventoryDictionary : Dictionary, IClo // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Thread LockedByThread; // private string WriterStack; @@ -119,7 +112,7 @@ public void LockItemsForRead(bool locked) if (m_itemLock.RecursiveReadCount > 0) { - m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); + //m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); try { // That call stack is useful for end users only. RealProgrammers need a full dump. Commented. @@ -148,7 +141,7 @@ public void LockItemsForRead(bool locked) } if (m_itemLock.RecursiveWriteCount > 0) { - m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); +// m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); // try // { // System.Console.WriteLine("------------------------------------------"); @@ -164,9 +157,9 @@ public void LockItemsForRead(bool locked) while (!m_itemLock.TryEnterReadLock(60000)) { - m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - //if (m_itemLock.IsWriteLockHeld) - //{ +// m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); +// if (m_itemLock.IsWriteLockHeld) +// { m_itemLock = new System.Threading.ReaderWriterLockSlim(); // System.Console.WriteLine("------------------------------------------"); // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); @@ -200,12 +193,12 @@ public void LockItemsForWrite(bool locked) //Enter a write lock, wait indefinately for one to open. if (m_itemLock.RecursiveReadCount > 0) { - m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); +// m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); m_itemLock.ExitReadLock(); } if (m_itemLock.RecursiveWriteCount > 0) { - m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); +// m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); m_itemLock.ExitWriteLock(); } @@ -213,7 +206,7 @@ public void LockItemsForWrite(bool locked) { if (m_itemLock.IsWriteLockHeld) { - m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); +// m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); // System.Console.WriteLine("------------------------------------------"); // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); // System.Console.WriteLine("------------------------------------------"); @@ -222,7 +215,7 @@ public void LockItemsForWrite(bool locked) } else { - m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); +// m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); // System.Console.WriteLine("------------------------------------------"); // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); // System.Console.WriteLine("------------------------------------------"); diff --git a/Source/OpenSim.Framework/TaskInventoryItem.cs b/Source/OpenSim.Framework/TaskInventoryItem.cs index 68e2babe2d0..fed246d1b18 100644 --- a/Source/OpenSim.Framework/TaskInventoryItem.cs +++ b/Source/OpenSim.Framework/TaskInventoryItem.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; -using log4net; using OpenMetaverse; namespace OpenSim.Framework diff --git a/Source/OpenSim.Framework/TerrainData.cs b/Source/OpenSim.Framework/TerrainData.cs index bbaebb838c0..aafa08c0138 100644 --- a/Source/OpenSim.Framework/TerrainData.cs +++ b/Source/OpenSim.Framework/TerrainData.cs @@ -25,15 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.IO; using System.IO.Compression; -using System.Reflection; - -using OpenMetaverse; - -using log4net; namespace OpenSim.Framework { @@ -68,9 +60,6 @@ public enum DBTerrainRevision public class TerrainData { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static string LogHeader = "[TERRAIN DATA]"; - private float[,] m_heightmap; // Remember subregions of the heightmap that has changed. @@ -470,7 +459,6 @@ public TerrainData(double[,] pTerrain) } } - // m_log.DebugFormat("{0} new by doubles. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); m_taints = new TerrainTaintsArray(m_taintSizeX * m_taintSizeY); } @@ -489,7 +477,6 @@ public TerrainData(int pX, int pY, int pZ) m_heightmap = new float[SizeX, SizeY]; m_taints = new TerrainTaintsArray(m_taintSizeX * m_taintSizeY); - // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); ClearLand(0f); } @@ -501,7 +488,6 @@ public TerrainData(float[] cmap, float pCompressionFactor, int pX, int pY, int p for (int xx = 0; xx < SizeX; xx++) for (int yy = 0; yy < SizeY; yy++) m_heightmap[xx, yy] = cmap[ind++]; - // m_log.DebugFormat("{0} new by compressed map. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); } // Create a heighmap from a database blob @@ -512,20 +498,16 @@ public TerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] p { case DBTerrainRevision.Variable2DGzip: FromCompressedTerrainSerializationV2DGZip(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2DGzip serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Variable2D: FromCompressedTerrainSerializationV2D(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Variable2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; case DBTerrainRevision.Compressed2D: FromCompressedTerrainSerialization2D(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from Compressed2D serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; default: FromLegacyTerrainSerialization(pBlob); - m_log.DebugFormat("{0} HeightmapTerrainData create from legacy serialization. Size=<{1},{2}>", LogHeader, SizeX, SizeY); break; } } @@ -593,7 +575,7 @@ public void FromLegacyTerrainSerialization(byte[] pBlob) // int32 sizeY // float[,] array - public Array ToCompressedTerrainSerializationV2D() + public Array? ToCompressedTerrainSerializationV2D() { Array ret = null; try @@ -617,8 +599,6 @@ public Array ToCompressedTerrainSerializationV2D() } catch {} - m_log.DebugFormat("{0} V2D {1} bytes", LogHeader, ret.Length); - return ret; } @@ -658,7 +638,6 @@ public Array ToCompressedTerrainSerializationV2DGzip() } catch {} - m_log.DebugFormat("{0} V2DGzip {1} bytes", LogHeader, ret.Length); return ret; } @@ -708,9 +687,6 @@ public void FromCompressedTerrainSerialization2D(byte[] pBlob) } } ClearTaint(); - - m_log.DebugFormat("{0} Read (compressed2D) heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", - LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); } } @@ -759,22 +735,15 @@ public void FromCompressedTerrainSerializationV2D(byte[] pBlob) catch (Exception e) { ClearTaint(); - m_log.ErrorFormat("{0} 2D error: {1} - terrain may be damaged", - LogHeader, e.Message); return; } - ClearTaint(); - - m_log.DebugFormat("{0} V2D Heightmap size=<{1},{2}>. Region size=<{3},{4}>", - LogHeader, hmSizeX, hmSizeY, SizeX, SizeY); + ClearTaint(); } // as above but Gzip compressed public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob) { - m_log.InfoFormat("{0} VD2Gzip {1} bytes input", - LogHeader, pBlob.Length); int hmSizeX, hmSizeY; try @@ -825,15 +794,10 @@ public void FromCompressedTerrainSerializationV2DGZip(byte[] pBlob) catch( Exception e) { ClearTaint(); - m_log.ErrorFormat("{0} V2DGzip error: {1} - terrain may be damaged", - LogHeader, e.Message); return; } ClearTaint(); - m_log.DebugFormat("{0} V2DGzip. Heightmap size=<{1},{2}>. Region size=<{3},{4}>", - LogHeader, hmSizeX, hmSizeY, SizeX, SizeY); - } } } diff --git a/Source/OpenSim.Framework/Util.cs b/Source/OpenSim.Framework/Util.cs index 44ea6f2d357..8f0f51aebf3 100644 --- a/Source/OpenSim.Framework/Util.cs +++ b/Source/OpenSim.Framework/Util.cs @@ -25,39 +25,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; +using System.Collections.Concurrent; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Globalization; -using System.IO; using System.IO.Compression; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Binary; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Xml; -using System.Threading; -using log4net; -using log4net.Appender; -using Nini.Config; + using Nwc.XmlRpc; +using Amib.Threading; + using OpenMetaverse; using OpenMetaverse.StructuredData; -using Amib.Threading; -using System.Collections.Concurrent; -using System.Net.Http; + using Microsoft.Extensions.Configuration; + namespace OpenSim.Framework { [Flags] @@ -141,8 +135,6 @@ public class STPInfo /// public static class Util { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Log-level for the thread pool: /// 0 = no logging @@ -164,7 +156,7 @@ static Util() LogOverloads = true; TimeStampClockPeriod = 1.0D / (double)Stopwatch.Frequency; TimeStampClockPeriodMS = 1e3 * TimeStampClockPeriod; - m_log.Info($"[UTIL] TimeStamp clock with period of {Math.Round(TimeStampClockPeriodMS, 6, MidpointRounding.AwayFromZero)}ms"); +// m_log.Info($"[UTIL] TimeStamp clock with period of {Math.Round(TimeStampClockPeriodMS, 6, MidpointRounding.AwayFromZero)}ms"); } private static uint nextXferID = 5000; @@ -1097,11 +1089,11 @@ public static bool LoadArchSpecificWindowsDll(string libraryName, string path) else nativeLibraryPath = Path.Combine(Path.Combine(path, "lib32"), libraryName); - m_log.Debug($"[UTIL]: Loading native Windows library at {nativeLibraryPath}"); + // m_log.Debug($"[UTIL]: Loading native Windows library at {nativeLibraryPath}"); if (!NativeLibrary.TryLoad(nativeLibraryPath, out _)) { - m_log.Error($"[UTIL]: Couldn't find native Windows library at {nativeLibraryPath}"); + // m_log.Error($"[UTIL]: Couldn't find native Windows library at {nativeLibraryPath}"); return false; } return true; @@ -1762,37 +1754,37 @@ public static string dataDir() return "."; } - public static string logFile() - { - foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) - { - if (appender is FileAppender appender1 && appender1.Name == "LogFileAppender") - { - return appender1.File; - } - } - - return "./OpenSim.log"; - } - - public static string StatsLogFile() - { - foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) - { - if (appender is FileAppender appender1 && appender1.Name == "StatsLogFileAppender") - { - return appender1.File; - } - } - - return "./OpenSimStats.log"; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string logDir() - { - return Path.GetDirectoryName(logFile()); - } + //public static string logFile() + //{ + // foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) + // { + // if (appender is FileAppender appender1 && appender1.Name == "LogFileAppender") + // { + // return appender1.File; + // } + // } + + // return "./OpenSim.log"; + //} + + //public static string StatsLogFile() + //{ + // foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) + // { + // if (appender is FileAppender appender1 && appender1.Name == "StatsLogFileAppender") + // { + // return appender1.File; + // } + // } + + // return "./OpenSimStats.log"; + //} + + //[MethodImpl(MethodImplOptions.AggressiveInlining)] + //public static string logDir() + //{ + // return Path.GetDirectoryName(logFile()); + //} // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html public static string GetUniqueFilename(string FileName) @@ -1915,8 +1907,8 @@ public static T GetConfigVarFromSections(IConfiguration config, string varnam val = cnf.GetValue(varname, (float)val); else if (typeof(T) == typeof(double)) val = cnf.GetValue(varname, (double)val); - else - m_log.ErrorFormat($"[UTIL]: Unhandled type {typeof(T)}"); + //else + // m_log.ErrorFormat($"[UTIL]: Unhandled type {typeof(T)}"); } return (T)val; @@ -2477,13 +2469,13 @@ public static OSDMap GetOSDMap(string data) else { // uh? - m_log.Debug($"[UTILS]: Got OSD of unexpected type {buffer.Type}"); + //m_log.Debug($"[UTILS]: Got OSD of unexpected type {buffer.Type}"); return null; } } catch (Exception ex) { - m_log.Debug($"[UTILS]: exception on GetOSDMap {ex.Message}"); + //m_log.Debug($"[UTILS]: exception on GetOSDMap {ex.Message}"); return null; } } @@ -2892,23 +2884,19 @@ public static void InitThreadPool(int minThreads, int maxThreads) if (minThreads > maxThreads || minThreads < 2) throw new ArgumentOutOfRangeException(nameof(minThreads), "minThreads must be greater than 2 and less than or equal to maxThreads"); - if (m_ThreadPool != null) + if (m_ThreadPool is null) { - m_log.Warn("SmartThreadPool is already initialized. Ignoring request."); - return; - } - - STPStartInfo startInfo = new() - { - ThreadPoolName = "Util", - IdleTimeout = 20000, - MaxWorkerThreads = maxThreads, - MinWorkerThreads = minThreads, - SuppressFlow = true - }; + STPStartInfo startInfo = new() + { + ThreadPoolName = "Util", + IdleTimeout = 20000, + MaxWorkerThreads = maxThreads, + MinWorkerThreads = minThreads, + }; - m_ThreadPool = new SmartThreadPool(startInfo); - m_threadPoolWatchdog = new Timer(ThreadPoolWatchdog, null, 0, 1000); + m_ThreadPool = new SmartThreadPool(startInfo); + m_threadPoolWatchdog = new Timer(ThreadPoolWatchdog, null, 0, 1000); + } } public static int FireAndForgetCount() @@ -3030,7 +3018,7 @@ private static void ThreadPoolWatchdog(object state) ThreadInfo t = entry.Value; if (t.DoTimeout && t.Running && !t.Aborted && (t.Elapsed() >= THREAD_TIMEOUT)) { - m_log.Warn($"Timeout in threadfunc {t.ThreadFuncNum} ({t.Thread.Name}) {t.GetStackTrace()}"); + // m_log.Warn($"Timeout in threadfunc {t.ThreadFuncNum} ({t.Thread.Name}) {t.GetStackTrace()}"); t.Abort(); activeThreads.TryRemove(entry.Key, out _); @@ -3103,8 +3091,8 @@ public static void FireAndForget(System.Threading.WaitCallback callback, object try { - if (loggingEnabled && threadInfo.LogThread) - m_log.DebugFormat("Run threadfunc {0} (Queued {1}, Running {2})", threadFuncNum, numQueued1, numRunning1); + //if (loggingEnabled && threadInfo.LogThread) + // m_log.DebugFormat("Run threadfunc {0} (Queued {1}, Running {2})", threadFuncNum, numQueued1, numRunning1); Culture.SetCurrentCulture(); callback(o); @@ -3114,14 +3102,16 @@ public static void FireAndForget(System.Threading.WaitCallback callback, object } catch (Exception e) { - m_log.Error($"[UTIL]: Util STP threadfunc {threadFuncNum} terminated with error {e.Message}"); + // m_log.Error($"[UTIL]: Util STP threadfunc {threadFuncNum} terminated with error {e.Message}"); } finally { Interlocked.Decrement(ref numRunningThreadFuncs); activeThreads.TryRemove(threadFuncNum, out ThreadInfo dummy); - if (loggingEnabled && threadInfo.LogThread) - m_log.Debug($"Exit threadfunc {threadFuncNum} ({FormatDuration(threadInfo.Elapsed())}"); + + //if (loggingEnabled && threadInfo.LogThread) + // m_log.Debug($"Exit threadfunc {threadFuncNum} ({FormatDuration(threadInfo.Elapsed())}"); + callback = null; o = null; threadInfo = null; @@ -3140,18 +3130,22 @@ public static void FireAndForget(System.Threading.WaitCallback callback, object case FireAndForgetMethod.None: realCallback.Invoke(obj); break; + case FireAndForgetMethod.QueueUserWorkItem: ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); break; - case FireAndForgetMethod.SmartThreadPool: - if (m_ThreadPool == null) - InitThreadPool(2, 15); - threadInfo.WorkItem = m_ThreadPool.QueueWorkItem(realCallback, obj); - break; + + //case FireAndForgetMethod.SmartThreadPool: + // if (m_ThreadPool == null) + // InitThreadPool(2, 15); + // threadInfo.WorkItem = m_ThreadPool.QueueWorkItem(realCallback, obj); + // break; + case FireAndForgetMethod.Thread: Thread thread = new(delegate (object o) { realCallback(o); realCallback = null; }); thread.Start(obj); break; + default: throw new NotImplementedException(); } @@ -3499,27 +3493,27 @@ public static string FormatDuration(int ms) return str; } - /// - /// Prints the call stack at any given point. Useful for debugging. - /// - public static void PrintCallStack() - { - PrintCallStack(m_log.DebugFormat); - } - - public delegate void DebugPrinter(string msg, params Object[] parm); - public static void PrintCallStack(DebugPrinter printer) - { - StackTrace stackTrace = new(true); // get call stack - StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) - - // write call stack method names - foreach (StackFrame stackFrame in stackFrames) - { - MethodBase mb = stackFrame.GetMethod(); - printer($"{mb.DeclaringType}.{mb.Name}:{stackFrame.GetFileLineNumber()}"); // write method name - } - } + ///// + ///// Prints the call stack at any given point. Useful for debugging. + ///// + //public static void PrintCallStack() + //{ + // PrintCallStack(m_log.DebugFormat); + //} + + //public delegate void DebugPrinter(string msg, params Object[] parm); + //public static void PrintCallStack(DebugPrinter printer) + //{ + // StackTrace stackTrace = new(true); // get call stack + // StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) + + // // write call stack method names + // foreach (StackFrame stackFrame in stackFrames) + // { + // MethodBase mb = stackFrame.GetMethod(); + // printer($"{mb.DeclaringType}.{mb.Name}:{stackFrame.GetFileLineNumber()}"); // write method name + // } + //} /// /// Gets the client IP address @@ -3540,7 +3534,7 @@ public static IPEndPoint GetClientIPFromXFF(string xff) } catch (Exception e) { - m_log.Warn($"[UTIL]: Exception parsing XFF header {xff}: {e.Message}"); + //m_log.Warn($"[UTIL]: Exception parsing XFF header {xff}: {e.Message}"); } } @@ -3559,7 +3553,7 @@ public static string GetCallerIP(Hashtable req) } catch (Exception e) { - m_log.Warn($"[UTIL]: exception in GetCallerIP: {e.Message}"); + //m_log.Warn($"[UTIL]: exception in GetCallerIP: {e.Message}"); } } return string.Empty; @@ -4301,23 +4295,23 @@ public static string GetViewerName(AgentCircuitData agent) return name; } - public static void LogFailedXML(string message, string xml) - { - int length = xml.Length; - if (length > 250) - xml = xml[..250] + "..."; + //public static void LogFailedXML(string message, string xml) + //{ + // int length = xml.Length; + // if (length > 250) + // xml = xml[..250] + "..."; - for (int i = 0; i < xml.Length; i++) - { - if (xml[i] < 0x20) - { - xml = "Unprintable binary data"; - break; - } - } + // for (int i = 0; i < xml.Length; i++) + // { + // if (xml[i] < 0x20) + // { + // xml = "Unprintable binary data"; + // break; + // } + // } - m_log.Error($"{message} Failed XML ({length} bytes) = {xml}"); - } + // //m_log.Error($"{message} Failed XML ({length} bytes) = {xml}"); + //} /// /// Performs a high quality image resize diff --git a/Source/OpenSim.Framework/WebUtil.cs b/Source/OpenSim.Framework/WebUtil.cs index 1a9d9cc1e51..837a4ee0418 100644 --- a/Source/OpenSim.Framework/WebUtil.cs +++ b/Source/OpenSim.Framework/WebUtil.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; using System.Collections.Specialized; using System.Globalization; -using System.IO; using System.IO.Compression; using System.Net; using System.Net.Security; @@ -40,14 +38,13 @@ using System.Xml; using System.Xml.Serialization; using System.Xml.Linq; -using log4net; + using Nwc.XmlRpc; + using OpenMetaverse.StructuredData; using OpenSim.Framework.ServiceAuth; -using System.Net.Http; using System.Security.Authentication; using System.Runtime.CompilerServices; -using System.Threading; namespace OpenSim.Framework { @@ -58,8 +55,6 @@ namespace OpenSim.Framework public static class WebUtil { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static SocketsHttpHandler SharedSocketsHttpHandlerNoRedir = null; public static SocketsHttpHandler SharedSocketsHttpHandler = null; @@ -339,7 +334,7 @@ public static void LogOutgoingDetail(string context, string output) output = output[..MaxRequestDiagLength] + "..."; } - m_log.DebugFormat($"[LOGHTTP]: {context}{Util.BinaryToASCII(output)}"); + //m_log.DebugFormat($"[LOGHTTP]: {context}{Util.BinaryToASCII(output)}"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -359,7 +354,9 @@ public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, i int reqnum = RequestNumber++; if (DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} JSON-RPC {method} to {url}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} JSON-RPC {method} to {url}"); + } string errorMessage = "unknown error"; int ticks = Util.EnvironmentTickCount(); @@ -443,7 +440,7 @@ public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, i catch (Exception ex) { errorMessage = ex.Message; - m_log.Debug($"[WEB UTIL]: Exception making request: {errorMessage}"); + //m_log.Debug($"[WEB UTIL]: Exception making request: {errorMessage}"); } finally { @@ -454,15 +451,15 @@ public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, i ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > LongCallTime) { - m_log.Info($"[WEB UTIL]: SvcOSD {reqnum} {method} {url} took {ticks}ms, {sendlen}/{rcvlen}bytes"); + //m_log.Info($"[WEB UTIL]: SvcOSD {reqnum} {method} {url} took {ticks}ms, {sendlen}/{rcvlen}bytes"); } else if (DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); } } - m_log.Debug($"[LOGHTTP]: request {reqnum} {method} to {url} FAILED: {errorMessage}"); + //m_log.Debug($"[LOGHTTP]: request {reqnum} {method} to {url} FAILED: {errorMessage}"); return ErrorResponseMap(errorMessage); } @@ -508,7 +505,7 @@ private static OSDMap CanonicalizeResults(string response) catch { // don't need to treat this as an error... we're just guessing anyway - //m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); + ////m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); } return result; @@ -534,7 +531,9 @@ public static OSDMap ServiceFormRequest(string url, NameValueCollection data, in string method = (data is not null && data["RequestMethod"] is not null) ? data["RequestMethod"] : "unknown"; if (DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} ServiceForm '{method}' to {url}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} ServiceForm '{method}' to {url}"); + } string errorMessage = "unknown error"; int ticks = Util.EnvironmentTickCount(); @@ -620,16 +619,15 @@ public static OSDMap ServiceFormRequest(string url, NameValueCollection data, in ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > LongCallTime) { - m_log.Info( - $"[LOGHTTP]: Slow ServiceForm request {reqnum} '{method}' to {url} took {ticks}ms, {sendlen}/{rcvlen}bytes"); + //m_log.Info($"[LOGHTTP]: Slow ServiceForm request {reqnum} '{method}' to {url} took {ticks}ms, {sendlen}/{rcvlen}bytes"); } else if (DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); } } - m_log.Warn($"[LOGHTTP]: ServiceForm request {reqnum} '{method}' to {url} failed: {errorMessage}"); + //m_log.Warn($"[LOGHTTP]: ServiceForm request {reqnum} '{method}' to {url} failed: {errorMessage}"); return ErrorResponseMap(errorMessage); } @@ -900,8 +898,6 @@ public static string[] GetPreferredImageTypes(string accept) public static class AsynchronousRestObjectRequester { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Perform an asynchronous REST request. /// @@ -951,7 +947,9 @@ public static void MakeRequest(string verb, int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} AsynchronousRequestObject {verb} to {requestUrl}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} AsynchronousRequestObject {verb} to {requestUrl}"); + } int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; @@ -1065,24 +1063,22 @@ public static void MakeRequest(string verb, { // We don't appear to be handling any other status codes, so log these feailures to that // people don't spend unnecessary hours hunting phantom bugs. - m_log.Debug( - $"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with unexpected status code {httpResponse.StatusCode}"); + //m_log.Debug($"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with unexpected status code {httpResponse.StatusCode}"); } httpResponse.Dispose(); } } else { - m_log.Error( - $"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with status {e.Status} and message {e.Message}"); + //m_log.Error($"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with status {e.Status} and message {e.Message}"); } } catch (Exception e) { - m_log.Error($"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with exception {e.Message}"); + //m_log.Error($"[ASYNC REQUEST]: Request {verb} {requestUrl} failed with exception {e.Message}"); } - //m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); + ////m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); try { @@ -1090,7 +1086,7 @@ public static void MakeRequest(string verb, } catch (Exception e) { - m_log.ErrorFormat($"[ASYNC REQUEST]: Request {verb} {requestUrl} callback failed with exception {e.Message}"); + //m_log.ErrorFormat($"[ASYNC REQUEST]: Request {verb} {requestUrl} callback failed with exception {e.Message}"); } }, null); @@ -1108,14 +1104,14 @@ public static void MakeRequest(string verb, if (originalRequest.Length > WebUtil.MaxRequestDiagLength) originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength); } - m_log.InfoFormat( - "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", - reqnum, verb, requestUrl, tickdiff, tickdata, - originalRequest); + //m_log.InfoFormat( + // "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}", + // reqnum, verb, requestUrl, tickdiff, tickdata, + // originalRequest); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {tickdiff}ms, {tickdata}ms writing"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {tickdiff}ms, {tickdata}ms writing"); } } catch { } @@ -1124,8 +1120,6 @@ public static void MakeRequest(string verb, public static class SynchronousRestFormsRequester { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Perform a synchronous REST request. /// @@ -1143,7 +1137,9 @@ public static string MakeRequest(string method, string requestUrl, string obj, i int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SynchronousRestForms {method} to {requestUrl}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SynchronousRestForms {method} to {requestUrl}"); + } int ticks = Util.EnvironmentTickCount(); HttpResponseMessage responseMessage = null; @@ -1199,7 +1195,7 @@ public static string MakeRequest(string method, string requestUrl, string obj, i } catch (Exception e) { - m_log.Info($"[FORMS]: Error receiving response from {requestUrl}: {e.Message}"); + //m_log.Info($"[FORMS]: Error receiving response from {requestUrl}: {e.Message}"); throw; } finally @@ -1212,11 +1208,11 @@ public static string MakeRequest(string method, string requestUrl, string obj, i ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > WebUtil.LongCallTime) { - m_log.Info($"[FORMS]: request {reqnum} {method} {requestUrl} took {ticks}ms, {sendlen}/{rcvlen}bytes"); + //m_log.Info($"[FORMS]: request {reqnum} {method} {requestUrl} took {ticks}ms, {sendlen}/{rcvlen}bytes"); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); if (WebUtil.DebugLevel >= 5) WebUtil.LogResponseDetail(reqnum, respstring); } @@ -1236,7 +1232,9 @@ public static string MakePostRequest(string requestUrl, string obj, int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SynchronousRestForms POST to {requestUrl}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SynchronousRestForms POST to {requestUrl}"); + } int ticks = Util.EnvironmentTickCount(); HttpResponseMessage responseMessage = null; @@ -1283,7 +1281,7 @@ public static string MakePostRequest(string requestUrl, string obj, } catch (Exception e) { - m_log.Info($"[FORMS]: Error receiving response from {requestUrl}: {e.Message}"); + //m_log.Info($"[FORMS]: Error receiving response from {requestUrl}: {e.Message}"); throw; } finally @@ -1296,11 +1294,11 @@ public static string MakePostRequest(string requestUrl, string obj, ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > WebUtil.LongCallTime) { - m_log.Info($"[FORMS]: request {reqnum} POST {requestUrl} took {ticks}ms {sendlen}/{rcvlen}bytes"); + //m_log.Info($"[FORMS]: request {reqnum} POST {requestUrl} took {ticks}ms {sendlen}/{rcvlen}bytes"); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); if (WebUtil.DebugLevel >= 5) WebUtil.LogResponseDetail(reqnum, respstring); } @@ -1311,8 +1309,6 @@ public static string MakePostRequest(string requestUrl, string obj, public class SynchronousRestObjectRequester { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Perform a synchronous REST request. /// @@ -1370,7 +1366,9 @@ public static TResponse MakeRequest(string method, string r int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SRestObjReq {method} {requestUrl}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SRestObjReq {method} {requestUrl}"); + } int ticks = Util.EnvironmentTickCount(); TResponse deserial = default; @@ -1433,17 +1431,17 @@ public static TResponse MakeRequest(string method, string r } else { - m_log.Debug($"[SRestObjReq]: Oops! no content found in response stream from {method} {requestUrl}"); + //m_log.Debug($"[SRestObjReq]: Oops! no content found in response stream from {method} {requestUrl}"); } ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > WebUtil.LongCallTime) { - m_log.Info($"[LOGHTTP]: Slow SRestObjReq {reqnum} {method} {requestUrl} took {ticks}ms, {rcvlen}bytes"); + //m_log.Info($"[LOGHTTP]: Slow SRestObjReq {reqnum} {method} {requestUrl} took {ticks}ms, {rcvlen}bytes"); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); } } catch (HttpRequestException e) @@ -1452,26 +1450,28 @@ public static TResponse MakeRequest(string method, string r { if (status == HttpStatusCode.Unauthorized) { - m_log.Error($"[SRestObjReq]: GET {requestUrl} requires authentication"); + //m_log.Error($"[SRestObjReq]: GET {requestUrl} requires authentication"); } else if (status != HttpStatusCode.NotFound) { - m_log.Warn($"[SRestObjReq]: GET {requestUrl} returned error: {status}"); + //m_log.Warn($"[SRestObjReq]: GET {requestUrl} returned error: {status}"); } } else - m_log.ErrorFormat( - "[SRestObjReq]: WebException for {0} {1} {2} {3}", - method, requestUrl, typeof(TResponse).ToString(), e.Message); + { + //m_log.ErrorFormat( + // "[SRestObjReq]: WebException for {0} {1} {2} {3}", + // method, requestUrl, typeof(TResponse).ToString(), e.Message); + } } catch (System.InvalidOperationException) { // This is what happens when there is invalid XML - m_log.Debug($"[SRestObjReq]: Invalid XML from {method} {requestUrl} {typeof(TResponse)}"); + //m_log.Debug($"[SRestObjReq]: Invalid XML from {method} {requestUrl} {typeof(TResponse)}"); } catch (Exception e) { - m_log.Debug($"[SRestObjReq]: Exception on response from {method} {requestUrl}: {e.Message}"); + //m_log.Debug($"[SRestObjReq]: Exception on response from {method} {requestUrl}: {e.Message}"); } finally { @@ -1488,7 +1488,9 @@ public static TResponse MakeGetRequest(string requestUrl, int pTimeou int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SRestObjReq GET {requestUrl}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} SRestObjReq GET {requestUrl}"); + } int ticks = Util.EnvironmentTickCount(); TResponse deserial = default; @@ -1527,43 +1529,45 @@ public static TResponse MakeGetRequest(string requestUrl, int pTimeou } else { - m_log.Debug($"[SRestObjReq]: Oops! no content found in response stream from GET {requestUrl}"); + //m_log.Debug($"[SRestObjReq]: Oops! no content found in response stream from GET {requestUrl}"); } ticks = Util.EnvironmentTickCountSubtract(ticks); if (ticks > WebUtil.LongCallTime) { - m_log.Info($"[LOGHTTP]: Slow SRestObjReq GET {reqnum} {requestUrl} took {ticks}ms, {rcvlen}bytes"); + //m_log.Info($"[LOGHTTP]: Slow SRestObjReq GET {reqnum} {requestUrl} took {ticks}ms, {rcvlen}bytes"); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {ticks}ms"); } } catch (HttpRequestException e) { - if(e.StatusCode is HttpStatusCode status) + if (e.StatusCode is HttpStatusCode status) { if (status == HttpStatusCode.Unauthorized) { - m_log.Error($"[SRestObjReq]: GET {requestUrl} requires authentication"); + //m_log.Error($"[SRestObjReq]: GET {requestUrl} requires authentication"); } else if (status != HttpStatusCode.NotFound) { - m_log.Warn($"[SRestObjReq]: GET {requestUrl} returned error: {status}"); + //m_log.Warn($"[SRestObjReq]: GET {requestUrl} returned error: {status}"); } } else - m_log.Error($"[SRestObjReq]: WebException for GET {requestUrl} {typeof(TResponse)} {e.Message}"); + { + //m_log.Error($"[SRestObjReq]: WebException for GET {requestUrl} {typeof(TResponse)} {e.Message}"); + } } catch (System.InvalidOperationException) { // This is what happens when there is invalid XML - m_log.Debug($"[SRestObjReq]: Invalid XML from GET {requestUrl} {typeof(TResponse)}"); + //m_log.Debug($"[SRestObjReq]: Invalid XML from GET {requestUrl} {typeof(TResponse)}"); } catch (Exception e) { - m_log.Debug($"[SRestObjReq]: Exception on response from GET {requestUrl}: {e.Message}"); + //m_log.Debug($"[SRestObjReq]: Exception on response from GET {requestUrl}: {e.Message}"); } finally { @@ -1624,14 +1628,14 @@ public static TResponse LogAndDeserialize(int reqnum, Stream respStre public static class XMLRPCRequester { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static Hashtable SendRequest(Hashtable ReqParams, string method, string url) { int reqnum = WebUtil.RequestNumber++; if (WebUtil.DebugLevel >= 3) - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} XML-RPC '{method}' to {url}"); + { + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} XML-RPC '{method}' to {url}"); + } int tickstart = Util.EnvironmentTickCount(); string responseStr = null; @@ -1666,13 +1670,12 @@ public static Hashtable SendRequest(Hashtable ReqParams, string method, string u } catch (Exception e) { - m_log.Error($"[LOGHTTP]: Error parsing XML-RPC response: {e.Message}"); + //m_log.Error($"[LOGHTTP]: Error parsing XML-RPC response: {e.Message}"); } if (Resp.IsFault) { - m_log.Debug( - $"[LOGHTTP]: XML-RPC request {reqnum} '{method}' to {url} FAILED: FaultCode={Resp.FaultCode}, {Resp.FaultString}"); + //m_log.Debug($"[LOGHTTP]: XML-RPC request {reqnum} '{method}' to {url} FAILED: FaultCode={Resp.FaultCode}, {Resp.FaultString}"); return null; } @@ -1686,16 +1689,16 @@ public static Hashtable SendRequest(Hashtable ReqParams, string method, string u int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > WebUtil.LongCallTime) { - m_log.InfoFormat( - "[LOGHTTP]: Slow XML-RPC request {0} '{1}' to {2} took {3}ms, {4}", - reqnum, method, url, tickdiff, - responseStr != null - ? (responseStr.Length > WebUtil.MaxRequestDiagLength ? responseStr.Remove(WebUtil.MaxRequestDiagLength) : responseStr) - : ""); + //m_log.InfoFormat( + // "[LOGHTTP]: Slow XML-RPC request {0} '{1}' to {2} took {3}ms, {4}", + // reqnum, method, url, tickdiff, + // responseStr != null + // ? (responseStr.Length > WebUtil.MaxRequestDiagLength ? responseStr.Remove(WebUtil.MaxRequestDiagLength) : responseStr) + // : ""); } else if (WebUtil.DebugLevel >= 4) { - m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {tickdiff}ms"); + //m_log.Debug($"[LOGHTTP]: HTTP OUT {reqnum} took {tickdiff}ms"); } } } diff --git a/Source/OpenSim.Region.ClientStack.LindenUDP/OpenSim.Region.ClientStack.LindenUDP.csproj b/Source/OpenSim.Region.ClientStack.LindenUDP/OpenSim.Region.ClientStack.LindenUDP.csproj index e1b5e4e1626..8ef6d685cd9 100644 --- a/Source/OpenSim.Region.ClientStack.LindenUDP/OpenSim.Region.ClientStack.LindenUDP.csproj +++ b/Source/OpenSim.Region.ClientStack.LindenUDP/OpenSim.Region.ClientStack.LindenUDP.csproj @@ -39,8 +39,6 @@ - - diff --git a/Source/OpenSim.Region.CoreModules/OpenSim.Region.CoreModules.csproj b/Source/OpenSim.Region.CoreModules/OpenSim.Region.CoreModules.csproj index 4467d2edbcf..bad98e54123 100644 --- a/Source/OpenSim.Region.CoreModules/OpenSim.Region.CoreModules.csproj +++ b/Source/OpenSim.Region.CoreModules/OpenSim.Region.CoreModules.csproj @@ -55,10 +55,10 @@ - - - + + + - + diff --git a/Source/OpenSim.Region.Framework/Interfaces/IOpenSimBase.cs b/Source/OpenSim.Region.Framework/Interfaces/IOpenSimBase.cs index 6c029f5dd5f..d53b8a0662d 100644 --- a/Source/OpenSim.Region.Framework/Interfaces/IOpenSimBase.cs +++ b/Source/OpenSim.Region.Framework/Interfaces/IOpenSimBase.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/Source/OpenSim.Region.Framework/Interfaces/IWindModelPlugin.cs b/Source/OpenSim.Region.Framework/Interfaces/IWindModelPlugin.cs index 441d7ea729b..962dfd837bd 100644 --- a/Source/OpenSim.Region.Framework/Interfaces/IWindModelPlugin.cs +++ b/Source/OpenSim.Region.Framework/Interfaces/IWindModelPlugin.cs @@ -25,14 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; - -using Nini.Config; using OpenSim.Framework; using OpenMetaverse; using OpenSim.Region.Framework.Scenes; +using Microsoft.Extensions.Configuration; + namespace OpenSim.Region.Framework.Interfaces { public interface IWindModelPlugin : IPlugin @@ -45,7 +43,7 @@ public interface IWindModelPlugin : IPlugin /// /// Provides access to the wind configuration, if any. /// - void WindConfig(Scene scene, IConfig windConfig); + void WindConfig(Scene scene, IConfigurationSection windConfig); /// /// Update wind. diff --git a/Source/OpenSim.Region.Framework/OpenSim.Region.Framework.csproj b/Source/OpenSim.Region.Framework/OpenSim.Region.Framework.csproj index 29a90a1ecfa..c0fffad514d 100644 --- a/Source/OpenSim.Region.Framework/OpenSim.Region.Framework.csproj +++ b/Source/OpenSim.Region.Framework/OpenSim.Region.Framework.csproj @@ -41,9 +41,7 @@ - - - - + + \ No newline at end of file diff --git a/Source/OpenSim.Region.Framework/Scenes/Animation/AnimationSet.cs b/Source/OpenSim.Region.Framework/Scenes/Animation/AnimationSet.cs index 268c926b5cd..2f2579c5102 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Animation/AnimationSet.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Animation/AnimationSet.cs @@ -25,25 +25,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; using System.Text; -using log4net; using OpenMetaverse; using OpenMetaverse.StructuredData; -using OpenSim.Framework; - -using Animation = OpenSim.Framework.Animation; - namespace OpenSim.Region.Framework.Scenes.Animation { [Serializable] public class AnimationSet { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Framework.Animation m_implicitDefaultAnimation = new OpenSim.Framework.Animation(); private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); private readonly List m_animations = new List(); diff --git a/Source/OpenSim.Region.Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/Source/OpenSim.Region.Framework/Scenes/Animation/DefaultAvatarAnimations.cs index 89ebd00fa03..fd4c91729a7 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Animation/DefaultAvatarAnimations.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Animation/DefaultAvatarAnimations.cs @@ -25,18 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System.Collections.Generic; -using System.Reflection; using System.Xml; -using log4net; + using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes.Animation { public class DefaultAvatarAnimations { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; public static Dictionary AnimsUUIDbyName = new Dictionary(); diff --git a/Source/OpenSim.Region.Framework/Scenes/Animation/MovementAnimationOverrides.cs b/Source/OpenSim.Region.Framework/Scenes/Animation/MovementAnimationOverrides.cs index d3dae7163f1..1e1d4111881 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Animation/MovementAnimationOverrides.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Animation/MovementAnimationOverrides.cs @@ -25,34 +25,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Xml; -using System.Collections.Generic; -using System.Reflection; -using System.Threading; -using System.Timers; -using Timer = System.Timers.Timer; +using Microsoft.Extensions.Logging; using OpenMetaverse; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Client; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes.Animation; -using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.PhysicsModule.SharedBase; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; -using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes { public class MovementAnimationOverrides { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private object MAOLock = new object(); private Dictionary m_overrides = new Dictionary(); + + private readonly ILogger _logger; + + public MovementAnimationOverrides(ILogger logger) + { + _logger = logger; + } + public void SetOverride(string state, UUID animID) { if (animID.IsZero()) @@ -64,7 +53,7 @@ public void SetOverride(string state, UUID animID) return; } - m_log.DebugFormat("Setting override for {0} to {1}", state, animID); + _logger.LogDebug($"Setting override for {state} to {animID}", state, animID); lock (MAOLock) m_overrides[state] = animID; diff --git a/Source/OpenSim.Region.Framework/Scenes/Animation/ScenePresenceAnimator.cs b/Source/OpenSim.Region.Framework/Scenes/Animation/ScenePresenceAnimator.cs index f6eef682b40..72cd76143ca 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -25,16 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading; -using log4net; +using Microsoft.Extensions.Logging; + using OpenMetaverse; + using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; using OpenSim.Region.PhysicsModule.SharedBase; namespace OpenSim.Region.Framework.Scenes.Animation @@ -44,23 +39,31 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public class ScenePresenceAnimator { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILogger _logger; + + private float m_lastFallVelocity; + + private int m_animTickFall; + private int m_animTickLand; + private int m_animTickJump; + + protected AnimationSet m_animations = new AnimationSet(); + + /// + /// The scene presence that this animator applies to + /// + protected ScenePresence m_scenePresence; public AnimationSet Animations { get { return m_animations; } } - protected AnimationSet m_animations = new AnimationSet(); /// /// The current movement animation /// public string CurrentMovementAnimation { get; private set; } - private int m_animTickFall; - private int m_animTickLand; - private int m_animTickJump; - public bool isJumping; // private int m_landing = 0; @@ -70,15 +73,10 @@ public AnimationSet Animations /// public bool Falling { get; private set; } - private float m_lastFallVelocity; - - /// - /// The scene presence that this animator applies to - /// - protected ScenePresence m_scenePresence; - - public ScenePresenceAnimator(ScenePresence sp) + public ScenePresenceAnimator(ILogger logger, ScenePresence sp) { + _logger = logger; + m_scenePresence = sp; CurrentMovementAnimation = "STAND"; } @@ -88,11 +86,10 @@ public void AddAnimation(UUID animID, UUID objectID) if (m_scenePresence.IsChildAgent) return; - // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); if (m_scenePresence.Scene.DebugAnimations) - m_log.DebugFormat( - "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", - GetAnimName(animID), animID, m_scenePresence.Name); + { + _logger.LogDebug($"[SCENE PRESENCE ANIMATOR]: Adding animation {GetAnimName(animID)} {animID} for {m_scenePresence.Name}"); + } if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) { @@ -130,9 +127,9 @@ public void RemoveAnimation(UUID animID, bool allowNoDefault) return; if (m_scenePresence.Scene.DebugAnimations) - m_log.DebugFormat( - "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", - GetAnimName(animID), animID, m_scenePresence.Name); + { + _logger.LogDebug($"[SCENE PRESENCE ANIMATOR]: Removing animation {GetAnimName(animID)} {animID} for {m_scenePresence.Name}"); + } if (m_animations.Remove(animID, allowNoDefault)) { @@ -149,12 +146,19 @@ public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack) if (!animID.IsZero()) { if (addRemove) + { m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero); + } else + { m_animations.Remove(animID, false); + } } + if (sendPack) + { SendAnimPack(); + } } // Called from scripts @@ -164,6 +168,7 @@ public void RemoveAnimation(string name) return; UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); + if (animID.IsZero()) return; @@ -173,9 +178,11 @@ public void RemoveAnimation(string name) public void ResetAnimations() { if (m_scenePresence.Scene.DebugAnimations) - m_log.DebugFormat( - "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", - m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); + { + _logger.LogDebug( + $"[SCENE PRESENCE ANIMATOR]: Resetting animations for {m_scenePresence.Name} " + + $"in {m_scenePresence.Scene.RegionInfo.RegionName}"); + } m_animations.Clear(); } @@ -193,9 +200,8 @@ public bool TrySetMovementAnimation(string anim) { if (m_scenePresence.IsChildAgent) { - m_log.WarnFormat( - "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", - anim, m_scenePresence.Name); + _logger.LogWarning($"[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {anim} on child presence {m_scenePresence.Name}"); + return false; } @@ -214,8 +220,10 @@ public bool TrySetMovementAnimation(string anim) if (anim.Equals("SITGROUND")) { UUID defsit = DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"]; + if (defsit.IsZero()) return false; + m_animations.SetDefaultAnimation(defsit, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID); aoSitGndAnim = overridenAnim; avnChangeAnim(overridenAnim, true, false); @@ -224,14 +232,18 @@ public bool TrySetMovementAnimation(string anim) { m_animations.SetDefaultAnimation(overridenAnim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID); } + m_scenePresence.SendScriptChangedEventToAttachments(Changed.ANIMATION); SendAnimPack(); + return true; } // translate sit and sitground state animations if (anim.Equals("SIT") || anim.Equals("SITGROUND")) + { anim = m_scenePresence.sitAnimation; + } if (m_animations.TrySetDefaultAnimation(anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) { diff --git a/Source/OpenSim.Region.Framework/Scenes/AsyncInventorySender.cs b/Source/OpenSim.Region.Framework/Scenes/AsyncInventorySender.cs index 976a205897a..fe48efea7d9 100644 --- a/Source/OpenSim.Region.Framework/Scenes/AsyncInventorySender.cs +++ b/Source/OpenSim.Region.Framework/Scenes/AsyncInventorySender.cs @@ -25,15 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Collections.Concurrent; -//using System.Reflection; -using System.Threading; -using log4net; + using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes { diff --git a/Source/OpenSim.Region.Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/Source/OpenSim.Region.Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 46a44986370..74972832a52 100644 --- a/Source/OpenSim.Region.Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/Source/OpenSim.Region.Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -25,12 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Collections.Concurrent; -//using System.Reflection; -using System.Threading; -using log4net; + using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; diff --git a/Source/OpenSim.Region.Framework/Scenes/CollisionSounds.cs b/Source/OpenSim.Region.Framework/Scenes/CollisionSounds.cs index 365113f3f56..36f04e434b5 100644 --- a/Source/OpenSim.Region.Framework/Scenes/CollisionSounds.cs +++ b/Source/OpenSim.Region.Framework/Scenes/CollisionSounds.cs @@ -26,12 +26,8 @@ */ // Ubit 2012 -using System; using System.Reflection; -using System.Collections.Generic; using OpenMetaverse; -using OpenSim.Framework; -using log4net; namespace OpenSim.Region.Framework.Scenes { @@ -44,8 +40,6 @@ public struct CollisionForSoundInfo public static class CollisionSounds { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private const int MaxMaterials = 7; // part part diff --git a/Source/OpenSim.Region.Framework/Scenes/EntityBase.cs b/Source/OpenSim.Region.Framework/Scenes/EntityBase.cs index da6ef773029..f157bf8a682 100644 --- a/Source/OpenSim.Region.Framework/Scenes/EntityBase.cs +++ b/Source/OpenSim.Region.Framework/Scenes/EntityBase.cs @@ -25,11 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; -using System.Runtime.Serialization; -using System.Security.Permissions; -using log4net; using OpenSim.Framework; using OpenMetaverse; @@ -37,8 +32,6 @@ namespace OpenSim.Region.Framework.Scenes { public abstract class EntityBase : ISceneEntity { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// The scene to which this entity belongs /// diff --git a/Source/OpenSim.Region.Framework/Scenes/EntityManager.cs b/Source/OpenSim.Region.Framework/Scenes/EntityManager.cs index f034de898f0..00e005af68e 100644 --- a/Source/OpenSim.Region.Framework/Scenes/EntityManager.cs +++ b/Source/OpenSim.Region.Framework/Scenes/EntityManager.cs @@ -25,11 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -37,8 +32,6 @@ namespace OpenSim.Region.Framework.Scenes { public class EntityManager { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly DoubleDictionaryThreadAbortSafe m_entities = new DoubleDictionaryThreadAbortSafe(); diff --git a/Source/OpenSim.Region.Framework/Scenes/EventManager.cs b/Source/OpenSim.Region.Framework/Scenes/EventManager.cs index cb3eeb3f052..c47adb51e4e 100644 --- a/Source/OpenSim.Region.Framework/Scenes/EventManager.cs +++ b/Source/OpenSim.Region.Framework/Scenes/EventManager.cs @@ -25,14 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; +using Microsoft.Extensions.Logging; + using OpenMetaverse; + using OpenSim.Framework; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; + using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -43,7 +43,12 @@ namespace OpenSim.Region.Framework.Scenes /// public class EventManager { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILogger _logger; + + public EventManager(ILogger logger) + { + _logger = logger; + } /// /// Triggered on each sim frame. @@ -451,9 +456,7 @@ public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID i } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing."); } } } @@ -486,9 +489,7 @@ public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing."); } } } @@ -1071,9 +1072,7 @@ public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing."); } } } @@ -1092,9 +1091,7 @@ public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing."); } } } @@ -1113,9 +1110,7 @@ public void TriggerOnScriptChangedEvent(uint localID, uint change, object parame } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing."); } } } @@ -1134,9 +1129,7 @@ public void TriggerOnClientMovement(ScenePresence avatar) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing."); } } } @@ -1155,9 +1148,7 @@ public void TriggerPermissionError(UUID user, string reason) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing."); } } } @@ -1176,9 +1167,7 @@ public void TriggerOnPluginConsole(string[] args) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing."); } } } @@ -1197,9 +1186,7 @@ public void TriggerOnFrame() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing."); } } } @@ -1218,9 +1205,7 @@ public void TriggerOnNewClient(IClientAPI client) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing."); } } } @@ -1239,9 +1224,7 @@ public void TriggerOnNewClient(IClientAPI client) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing."); } } } @@ -1261,9 +1244,7 @@ public void TriggerOnClientLogin(IClientAPI client) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing."); } } } @@ -1283,9 +1264,7 @@ public void TriggerOnNewPresence(ScenePresence presence) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing."); } } } @@ -1300,15 +1279,11 @@ public void TriggerOnRemovePresence(UUID agentId) { try { -// m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString()); d(agentId); -// m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done "); } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing."); } } } @@ -1327,9 +1302,7 @@ public void TriggerOnBackup(ISimulationDataService dstore, bool forced) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing."); } } } @@ -1348,9 +1321,7 @@ public void TriggerParcelPrimCountUpdate() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing."); } } } @@ -1369,9 +1340,7 @@ public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing."); } } } @@ -1389,9 +1358,7 @@ public void TriggerTerrainUpdate() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing."); } } } @@ -1410,9 +1377,7 @@ public void TriggerTerrainTick() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing."); } } } @@ -1431,9 +1396,7 @@ public void TriggerTerrainCheckUpdates() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing."); } } } @@ -1452,9 +1415,7 @@ public void TriggerTerrainTainted() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing."); } } } @@ -1473,9 +1434,7 @@ public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing."); } } } @@ -1494,9 +1453,8 @@ public void TriggerObjectAddedToScene(SceneObjectGroup obj) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing." +); } } } @@ -1517,9 +1475,7 @@ public bool TriggerDeRezRequested(IClientAPI client, List objs } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing."); } } } @@ -1540,9 +1496,7 @@ public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing."); } } } @@ -1561,9 +1515,7 @@ public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing."); } } } @@ -1582,9 +1534,7 @@ public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing."); } } } @@ -1603,9 +1553,7 @@ public void TriggerShutdown() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing."); } } } @@ -1624,9 +1572,7 @@ public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing."); } } } @@ -1645,9 +1591,7 @@ public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetP } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing."); } } } @@ -1666,9 +1610,7 @@ public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remote } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing."); } } } @@ -1687,9 +1629,7 @@ public void TriggerScriptReset(uint localID, UUID itemID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing."); } } } @@ -1708,9 +1648,7 @@ public void TriggerRezScript(uint localID, UUID itemID, string script, int start } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing."); } } } @@ -1729,9 +1667,7 @@ public void TriggerStartScript(uint localID, UUID itemID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing."); } } } @@ -1750,9 +1686,7 @@ public void TriggerStopScript(uint localID, UUID itemID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing."); } } } @@ -1771,10 +1705,7 @@ public void TriggerRemoveScript(uint localID, UUID itemID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}", - e.Message, e.StackTrace); - m_log.ErrorFormat(Environment.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing."); } } } @@ -1796,9 +1727,7 @@ public bool TriggerGroupMove(UUID groupID, Vector3 delta) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing."); } } } @@ -1822,9 +1751,7 @@ public bool TriggerGroupSpinStart(UUID groupID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing."); } } } @@ -1848,9 +1775,7 @@ public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing."); } } } @@ -1871,9 +1796,7 @@ public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing."); } } } @@ -1892,9 +1815,7 @@ public void TriggerLandObjectAdded(ILandObject newParcel) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing."); } } } @@ -1913,9 +1834,7 @@ public void TriggerLandObjectRemoved(UUID globalID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing."); } } } @@ -1939,9 +1858,7 @@ public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing."); } } } @@ -1960,9 +1877,7 @@ public void TriggerAvatarAppearanceChanged(ScenePresence avatar) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing."); } } } @@ -1981,9 +1896,7 @@ public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying, Gri } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing."); } } } @@ -2002,9 +1915,7 @@ public void TriggerIncomingInstantMessage(GridInstantMessage message) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing."); } } } @@ -2023,9 +1934,7 @@ public void TriggerUnhandledInstantMessage(GridInstantMessage message) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing."); } } } @@ -2040,16 +1949,11 @@ public void TriggerClientClosed(UUID ClientID, Scene scene) { try { -// m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString()); d(ClientID, scene); -// m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done "); - } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing."); } } } @@ -2068,9 +1972,7 @@ public void TriggerOnMakeChildAgent(ScenePresence presence) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing."); } } } @@ -2089,9 +1991,7 @@ public void TriggerOnMakeRootAgent(ScenePresence presence) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing."); } } } @@ -2110,9 +2010,7 @@ public void TriggerOnIncomingSceneObject(SceneObjectGroup so) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing."); } } } @@ -2131,9 +2029,7 @@ public void TriggerOnRegisterCaps(UUID agentID, Caps caps) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing."); } } } @@ -2152,9 +2048,7 @@ public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing."); } } } @@ -2173,9 +2067,7 @@ public void TriggerOnNewInventoryItemUploadComplete(InventoryItemBase item, int } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing."); } } } @@ -2194,9 +2086,7 @@ public void TriggerLandBuy(Object sender, LandBuyArgs args) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing."); } } } @@ -2215,9 +2105,7 @@ public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing."); } } } @@ -2236,9 +2124,7 @@ public void TriggerAtTargetEvent(UUID scriptID, uint handle, Vector3 targetpos, } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing."); } } } @@ -2257,9 +2143,7 @@ public void TriggerNotAtTargetEvent(UUID scriptID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing."); } } } @@ -2278,9 +2162,7 @@ public void TriggerAtRotTargetEvent(UUID scriptID, uint handle, Quaternion targe } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing."); } } } @@ -2299,9 +2181,7 @@ public void TriggerNotAtRotTargetEvent(UUID scriptID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing."); } } } @@ -2320,9 +2200,7 @@ public void TriggerMovingStartEvent(uint localID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing."); } } } @@ -2341,9 +2219,7 @@ public void TriggerMovingEndEvent(uint localID) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing."); } } } @@ -2368,9 +2244,7 @@ public void TriggerRequestChangeWaterHeight(float height) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing."); } } } @@ -2389,9 +2263,7 @@ public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing."); } } } @@ -2410,9 +2282,7 @@ public void TriggerSignificantClientMovement(ScenePresence presence) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing."); } } } @@ -2431,9 +2301,7 @@ public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing."); } } } @@ -2452,9 +2320,7 @@ public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing."); } } } @@ -2473,9 +2339,7 @@ public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing."); } } } @@ -2494,9 +2358,7 @@ internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uin } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing."); } } } @@ -2515,9 +2377,7 @@ public void TriggerNoticeNoLandDataFromStorage() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing."); } } } @@ -2536,9 +2396,7 @@ public void TriggerIncomingLandDataFromStorage(List landData) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing."); } } } @@ -2557,9 +2415,7 @@ public void TriggerSetAllowForcefulBan(bool allow) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing."); } } } @@ -2578,9 +2434,7 @@ public void TriggerRequestParcelPrimCountUpdate() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing."); } } } @@ -2599,9 +2453,7 @@ public void TriggerParcelPrimCountTainted() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing."); } } } @@ -2639,9 +2491,7 @@ public void TriggerEstateToolsSunUpdate(ulong regionHandle) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing."); } } } @@ -2660,9 +2510,7 @@ public float GetCurrentTimeAsSunLindenHour() } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing."); } } } @@ -2683,9 +2531,7 @@ public void TriggerOarFileLoaded(Guid requestId, List loadedScenes, string } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing."); } } } @@ -2704,9 +2550,7 @@ public void TriggerOarFileSaved(Guid requestId, string message) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing."); } } } @@ -2725,9 +2569,7 @@ public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing."); } } } @@ -2746,9 +2588,7 @@ public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing."); } } } @@ -2767,9 +2607,7 @@ public void TriggerScriptColliding(uint localId, ColliderArgs colliders) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing."); } } } @@ -2788,9 +2626,7 @@ public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing."); } } } @@ -2809,9 +2645,7 @@ public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing."); } } } @@ -2830,9 +2664,7 @@ public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing."); } } } @@ -2851,9 +2683,7 @@ public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing."); } } } @@ -2872,9 +2702,7 @@ public void TriggerSetRootAgentScene(UUID agentID, Scene scene) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing."); } } } @@ -2893,9 +2721,7 @@ public void TriggerOnRegionUp(GridRegion otherRegion) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing."); } } } @@ -2914,9 +2740,7 @@ public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing."); } } } @@ -2935,9 +2759,7 @@ public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObje } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing."); } } } @@ -2956,9 +2778,7 @@ public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart o } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing."); } } } @@ -2977,9 +2797,7 @@ public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing."); } } } @@ -2998,9 +2816,7 @@ public void TriggerScenePresenceUpdated(ScenePresence sp) } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing."); } } } @@ -3020,9 +2836,7 @@ public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing."); } } } @@ -3035,20 +2849,16 @@ public void TriggerSceneShuttingDown(Scene s) { foreach (Action d in handler.GetInvocationList()) { - m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString()); try { d(s); } catch (Exception e) { - m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}", - e.Message, e.StackTrace); + _logger.LogError($"[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing."); } } } - m_log.Info("[EVENT MANAGER]: TriggerSceneShuttingDown done"); } public void TriggerOnRegionStarted(Scene scene) @@ -3065,8 +2875,7 @@ public void TriggerOnRegionStarted(Scene scene) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for RegionStarted failed - continuing."); } } } @@ -3086,8 +2895,7 @@ public void TriggerRegionHeartbeatStart(Scene scene) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing."); } } } @@ -3107,8 +2915,7 @@ public void TriggerRegionHeartbeatEnd(Scene scene) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing."); } } } @@ -3128,8 +2935,7 @@ public void TriggerRegionLoginsStatusChange(IScene scene) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing."); } } } @@ -3149,8 +2955,7 @@ public void TriggerRegionReadyStatusChange(IScene scene) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing."); } } } @@ -3170,8 +2975,7 @@ public void TriggerPrimsLoaded(Scene s) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing."); } } } @@ -3191,8 +2995,7 @@ public void TriggerTeleportStart(IClientAPI client, GridRegion destination, Grid } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TeleportStart failed - continuing."); } } } @@ -3212,8 +3015,7 @@ public void TriggerTeleportFail(IClientAPI client, bool gridLogout) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TeleportFail failed - continuing."); } } } @@ -3235,8 +3037,7 @@ public void TriggerExtraSettingChanged(Scene scene, string name, string val) } catch (Exception e) { - m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}", - e.Message, e.StackTrace); + _logger.LogError(e, $"[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing."); } } } @@ -3261,8 +3062,8 @@ public void TriggerThrottleUpdate(ScenePresence scenePresence) // } // catch (Exception e) // { - // m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", - // e.Message, e.StackTrace); + // _logger.LogError(e, $"[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}", + //); // } // } // } diff --git a/Source/OpenSim.Region.Framework/Scenes/GodController.cs b/Source/OpenSim.Region.Framework/Scenes/GodController.cs index 10b2756b7c1..4e7bcb097c8 100644 --- a/Source/OpenSim.Region.Framework/Scenes/GodController.cs +++ b/Source/OpenSim.Region.Framework/Scenes/GodController.cs @@ -25,23 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Xml; -using System.Collections.Generic; -using System.Reflection; -using System.Threading; -using System.Timers; -using Timer = System.Timers.Timer; using OpenMetaverse; using OpenMetaverse.StructuredData; -using log4net; -using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Client; -using OpenSim.Framework.Monitoring; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Services.Interfaces; + using Microsoft.Extensions.Configuration; namespace OpenSim.Region.Framework.Scenes diff --git a/Source/OpenSim.Region.Framework/Scenes/KeyframeMotion.cs b/Source/OpenSim.Region.Framework/Scenes/KeyframeMotion.cs index 42a640ba826..3234719b2c6 100644 --- a/Source/OpenSim.Region.Framework/Scenes/KeyframeMotion.cs +++ b/Source/OpenSim.Region.Framework/Scenes/KeyframeMotion.cs @@ -25,35 +25,25 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Timers; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Diagnostics; -using System.Reflection; -using System.Threading; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.PhysicsModule.SharedBase; -using OpenSim.Region.Framework.Scenes.Serialization; using System.Runtime.Serialization.Formatters.Binary; -using System.Runtime.Serialization; + using Timer = System.Timers.Timer; -using log4net; namespace OpenSim.Region.Framework.Scenes { public class KeyframeTimer { - private static Dictionary m_timers = - new Dictionary(); + private static Dictionary m_timers = new(); private Timer m_timer; - private Dictionary m_motions = new Dictionary(); + private Dictionary m_motions = new(); + private object m_lockObject = new object(); private object m_timerLock = new object(); + private const double m_tickDuration = 50.0; public double TickDuration diff --git a/Source/OpenSim.Region.Framework/Scenes/Prioritizer.cs b/Source/OpenSim.Region.Framework/Scenes/Prioritizer.cs index a8f0a95fad8..6ba46e00492 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Prioritizer.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Prioritizer.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using log4net; -using Nini.Config; using OpenSim.Framework; using OpenMetaverse; using OpenSim.Region.PhysicsModule.SharedBase; @@ -43,8 +39,6 @@ public enum UpdatePrioritizationSchemes public class Prioritizer { - private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private Scene m_scene; public Prioritizer(Scene scene) @@ -60,7 +54,6 @@ public int GetUpdatePriority(IClientAPI client, ISceneEntity entity) // If entity is null we have a serious problem if (entity == null) { - m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); throw new InvalidOperationException("Prioritization entity not defined"); } diff --git a/Source/OpenSim.Region.Framework/Scenes/RegionStatsHandler.cs b/Source/OpenSim.Region.Framework/Scenes/RegionStatsHandler.cs index ca0e2e78699..7435aaba4ef 100644 --- a/Source/OpenSim.Region.Framework/Scenes/RegionStatsHandler.cs +++ b/Source/OpenSim.Region.Framework/Scenes/RegionStatsHandler.cs @@ -25,30 +25,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; using System.Net; -using System.Reflection; -using System.Text; -using log4net; -using Nini.Config; -using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Monitoring; -using OpenSim.Region.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Scenes { public class RegionStatsSimpleHandler : SimpleStreamHandler { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private string osXStatsURI = String.Empty; //private string osSecret = String.Empty; private OpenSim.Framework.RegionInfo regionInfo; diff --git a/Source/OpenSim.Region.Framework/Scenes/Scene.Inventory.cs b/Source/OpenSim.Region.Framework/Scenes/Scene.Inventory.cs index 1abf0167d39..80291ae4e16 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Scene.Inventory.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Scene.Inventory.cs @@ -25,25 +25,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Collections; using System.Reflection; using System.Text; using System.Xml; using OpenMetaverse; -using log4net; using OpenSim.Framework; using OpenSim.Framework.Serialization.External; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Serialization; using PermissionMask = OpenSim.Framework.PermissionMask; +using Microsoft.Extensions.Logging; + + namespace OpenSim.Region.Framework.Scenes { public partial class Scene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly string LogHeader = "[SCENE INVENTORY]"; /// @@ -65,7 +64,7 @@ public partial class Scene /// public int CreateScriptInstances() { - m_log.InfoFormat("[SCENE]: Initializing script instances in {0}", RegionInfo.RegionName); + Logger?.LogInformation($"[SCENE]: Initializing script instances in {RegionInfo.RegionName}"); int scriptsValidForStarting = 0; @@ -79,9 +78,7 @@ public int CreateScriptInstances() } } - m_log.InfoFormat( - "[SCENE]: Initialized {0} script instances in {1}", - scriptsValidForStarting, RegionInfo.RegionName); + Logger?.LogInformation($"[SCENE]: Initialized {scriptsValidForStarting} script instances in {RegionInfo.RegionName}"); return scriptsValidForStarting; } @@ -110,12 +107,12 @@ public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item, uint public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) { if (AddInventoryItem(item)) + { return true; + } else { - m_log.WarnFormat( - "[AGENT INVENTORY]: Unable to add item {1} to agent {2} inventory", item.Name, AgentId); - + Logger?.LogWarning($"[AGENT INVENTORY]: Unable to add item {item.Name} to agent {AgentId} inventory"); return false; } } @@ -135,36 +132,38 @@ public bool AddInventoryItem(InventoryItemBase item, bool trigger) { int userlevel = Permissions.IsGod(item.Owner) ? 1 : 0; if (trigger) + { EventManager.TriggerOnNewInventoryItemUploadComplete(item, userlevel); + } return true; } // OK so either the viewer didn't send a folderID or AddItem failed UUID originalFolder = item.Folder; - InventoryFolderBase f = null; + InventoryFolderBase? f = null; if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) + { f = InventoryService.GetFolderForType(item.Owner, (FolderType)item.AssetType); + } + if (f is not null) { - m_log.DebugFormat( - "[AGENT INVENTORY]: Found folder {0} type {1} for item {2}", - f.Name, (AssetType)f.Type, item.Name); + Logger?.LogDebug($"[AGENT INVENTORY]: Found folder {f.Name} type {(AssetType)f.Type} for item {item.Name}"); item.Folder = f.ID; } else { f = InventoryService.GetRootFolder(item.Owner); + if (f is not null) { item.Folder = f.ID; } else { - m_log.WarnFormat( - "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); + Logger?.LogWarning($"[AGENT INVENTORY]: Could not find root folder for {item.Owner} when trying to add item {item.Name} with no parent folder specified"); return false; } } @@ -173,7 +172,9 @@ public bool AddInventoryItem(InventoryItemBase item, bool trigger) { int userlevel = Permissions.IsGod(item.Owner) ? 1 : 0; if (trigger) + { EventManager.TriggerOnNewInventoryItemUploadComplete(item, userlevel); + } if (originalFolder.IsNotZero()) { @@ -185,9 +186,7 @@ public bool AddInventoryItem(InventoryItemBase item, bool trigger) } else { - m_log.WarnFormat( - "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", - item.Owner, item.Name, item.ID); + Logger?.LogWarning($"[AGENT INVENTORY]: Agent {item.Owner} could not add item {item.Name} {item.ID}"); return false; } @@ -243,7 +242,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ { if (!TryGetScenePresence(avatarId, out ScenePresence avatar)) { - m_log.ErrorFormat("[CapsUpdateItemAsset]: Avatar {0} cannot be found to update item asset", avatarId); + Logger?.LogError($"[CapsUpdateItemAsset]: Avatar {avatarId} cannot be found to update item asset"); return UUID.Zero; } @@ -254,23 +253,28 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ } SceneObjectPart sop = GetSceneObjectPart(objectID); + if(sop is null || sop.ParentGroup.IsDeleted) { - m_log.ErrorFormat("[CapsUpdateItemAsset]: Object {0} cannot be found to update item asset", objectID); + Logger?.LogError($"[CapsUpdateItemAsset]: Object {objectID} cannot be found to update item asset"); return UUID.Zero; } TaskInventoryItem item = sop.Inventory.GetInventoryItem(itemID); + if (item is null) { - m_log.ErrorFormat("[CapsUpdateItemAsset]: Could not find item {0} for asset update", itemID); + Logger?.LogError($"[CapsUpdateItemAsset]: Could not find item {itemID} for asset update"); return UUID.Zero; } if (item.OwnerID.NotEqual(avatarId)) + { return UUID.Zero; + } InventoryType itemType = (InventoryType)item.InvType; + switch (itemType) { case InventoryType.Notecard: @@ -284,6 +288,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ avatar.ControllingClient.SendAlertMessage("Notecard updated"); break; } + case (InventoryType)CustomInventoryType.AnimationSet: { AnimationSet animSet = new(data); @@ -302,6 +307,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ } break; } + case InventoryType.Gesture: { if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) @@ -313,6 +319,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ avatar.ControllingClient.SendAlertMessage("Gesture updated"); break; } + case InventoryType.Settings: { if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) @@ -324,6 +331,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ avatar.ControllingClient.SendAlertMessage("Setting updated"); break; } + case InventoryType.Material: { if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) @@ -353,8 +361,7 @@ public UUID CapsUpdateItemAsset(UUID avatarId, UUID itemID, UUID objectID, byte[ /// The prim which contains the item to update /// Indicates whether the script to update is currently running /// - public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, - UUID primId, bool isScriptRunning, byte[] data) + public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, UUID primId, bool isScriptRunning, byte[] data) { if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) { @@ -365,7 +372,9 @@ public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUI // Retrieve group SceneObjectPart part = GetSceneObjectPart(primId); if (part is null) + { return new ArrayList(); + } SceneObjectGroup group = part.ParentGroup; @@ -373,10 +382,9 @@ public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUI TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); if (item is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for caps script update " - + " but the item does not exist in this inventory", - itemId, part.Name, part.UUID); + Logger?.LogError( + $"[PRIM INVENTORY]: Tried to retrieve item ID {itemId} from prim {part.Name}, {part.UUID} " + + $"for caps script update but the item does not exist in this inventory"); return new ArrayList(); } @@ -385,10 +393,6 @@ public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUI AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId); AssetService.Store(asset); - //m_log.DebugFormat( - // "[PRIM INVENTORY]: Stored asset {0} when updating item {1} in prim {2} for {3}", - // asset.ID, item.Name, part.Name, remoteClient.Name); - part.Inventory.RemoveScriptInstance(item.ItemID, false); // Update item with new asset @@ -417,12 +421,11 @@ public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, { if (TryGetScenePresence(avatarId, out ScenePresence avatar)) { - return CapsUpdateTaskInventoryScriptAsset( - avatar.ControllingClient, itemId, primId, isScriptRunning, data); + return CapsUpdateTaskInventoryScriptAsset(avatar.ControllingClient, itemId, primId, isScriptRunning, data); } else { - m_log.ErrorFormat("[PRIM INVENTORY]: Avatar {0} cannot be found to update its prim item asset", avatarId); + Logger?.LogError($"[PRIM INVENTORY]: Avatar {avatarId} cannot be found to update its prim item asset"); return new ArrayList(); } } @@ -441,13 +444,8 @@ public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, /* public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, UUID itemID, string name, string description, uint nextOwnerMask)*/ - public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, - UUID itemID, InventoryItemBase itemUpd) + public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID itemID, InventoryItemBase itemUpd) { - //m_log.DebugFormat( - // "[USER INVENTORY]: Updating asset for item {0} {1}, transaction ID {2} for {3}", - // itemID, itemUpd.Name, transactionID, remoteClient.Name); - // This one will let people set next perms on items in agent // inventory. Rut-Roh. Whatever. Make this secure. Yeah. // @@ -461,18 +459,18 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, bool sendUpdate = false; item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); - if(item.AssetType == (int)AssetType.Landmark) + if (item.AssetType == (int)AssetType.Landmark) { - if(item.Name.StartsWith("HG ") && !itemUpd.Name.StartsWith("HG ")) + if (item.Name.StartsWith("HG ") && !itemUpd.Name.StartsWith("HG ")) { itemUpd.Name = "HG " + itemUpd.Name; sendUpdate = true; } int origIndx = item.Description.LastIndexOf("@ htt"); - if(origIndx >= 0) + if (origIndx >= 0) { - if(itemUpd.Description.LastIndexOf('@') < 0) + if (itemUpd.Description.LastIndexOf('@') < 0) { itemUpd.Description += string.Concat(" ", item.Description.AsSpan(origIndx)); sendUpdate = true; @@ -482,19 +480,12 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, item.Name = itemUpd.Name; item.Description = itemUpd.Description; - //m_log.DebugFormat( - // "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}", - // itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags, - // item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions); - if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid { // Create a set of base permissions that will not include export if the user // is not allowed to change the export flag. bool denyExportChange = false; - //m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); - // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner) denyExportChange = true; @@ -530,21 +521,24 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; + item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; + item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; + item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; item.GroupID = itemUpd.GroupID; item.GroupOwned = itemUpd.GroupOwned; item.CreationDate = itemUpd.CreationDate; - // The client sends zero if its newly created? + // The client sends zero if its newly created? if (itemUpd.CreationDate == 0) item.CreationDate = Util.UnixTimeSinceEpoch(); else @@ -557,6 +551,7 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, if (item.SalePrice != itemUpd.SalePrice || item.SaleType != itemUpd.SaleType) item.Flags |= (uint)InventoryItemFlags.ObjectSlamSale; + item.SalePrice = itemUpd.SalePrice; item.SaleType = itemUpd.SaleType; @@ -587,9 +582,7 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, } else { - m_log.ErrorFormat( - "[AGENTINVENTORY]: Item id {0} not found for an inventory item update for {1}.", - itemID, remoteClient.Name); + Logger?.LogError($"[AGENTINVENTORY]: Item id {itemID} not found for an inventory item update for {remoteClient.Name}."); } } @@ -602,6 +595,7 @@ public void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message) { InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message); + if (itemCopy is not null) recipientClient.SendBulkUpdateInventory(itemCopy); } @@ -645,9 +639,9 @@ public virtual InventoryItemBase GiveInventoryItem( InventoryItemBase item = InventoryService.GetItem(senderId, itemId); if (item is null) { - m_log.WarnFormat( - "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); + Logger?.LogWarning($"[AGENT INVENTORY]: Failed to find item {itemId} sent by {senderId} to {recipient}"); message = string.Format("Item not found: {0}.", itemId); + return null; } @@ -659,9 +653,7 @@ public virtual InventoryItemBase GiveInventoryItem( if (item.Owner.NotEqual(senderId)) { - m_log.WarnFormat( - "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", - item.Name, item.ID, recipient, senderId, item.Owner); + Logger?.LogWarning($"[AGENT INVENTORY]: Attempt to send item {item.Name} {item.ID} to {recipient} failed because sender {senderId} did not match item owner {item.Owner}"); message = "Sender did not match item owner."; return null; } @@ -901,13 +893,13 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, InventoryFolderBase folder = InventoryService.GetFolder(senderId, folderId); if (folder is null) { - m_log.ErrorFormat("[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId); + Logger?.LogError($"[AGENT INVENTORY]: Could not find inventory folder {folderId} to give"); return null; } if (denyGiveFolderTypes.Contains(folder.Type)) { - m_log.ErrorFormat("[AGENT INVENTORY]: can not give inventory folder {0}", folderId); + Logger?.LogError($"[AGENT INVENTORY]: can not give inventory folder {folderId}"); return null; } @@ -918,7 +910,7 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, recipientParentFolderId = recipientRootFolder.ID; else { - m_log.WarnFormat("[AGENT INVENTORY]: Unable to find root folder for receiving agent"); + Logger?.LogWarning($"[AGENT INVENTORY]: Unable to find root folder for receiving agent"); return null; } } @@ -956,7 +948,7 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, InventoryFolderBase folder = InventoryService.GetFolder(senderId, folderId); if (folder is null) { - m_log.ErrorFormat("[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId); + Logger?.LogError($"[AGENT INVENTORY]: Could not find inventory folder {folderId} to give"); return null; } @@ -965,7 +957,7 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, if (denyGiveFolderTypes.Contains(folder.Type)) { - m_log.ErrorFormat("[AGENT INVENTORY]: can not give inventory folder {0}", folderId); + Logger?.LogError($"[AGENT INVENTORY]: can not give inventory folder {folderId}"); return null; } @@ -973,11 +965,8 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, { InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId); if (recipientRootFolder is not null) - recipientParentFolderId = recipientRootFolder.ID; - else { - m_log.WarnFormat("[AGENT INVENTORY]: Unable to find root folder for receiving agent"); - return null; + recipientParentFolderId = recipientRootFolder.ID; } } @@ -1019,9 +1008,9 @@ public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, UUID newFolderID, string newName) { - m_log.DebugFormat( - "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", - remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); + Logger?.LogDebug( + $"[AGENT INVENTORY]: CopyInventoryItem received by {remoteClient.AgentId} with oldAgentID {oldAgentID}, " + + $"oldItemID {oldItemID}, new FolderID {newFolderID}, newName {newName}"); InventoryItemBase item = null; if (LibraryService is not null && LibraryService.LibraryRootFolder is not null) @@ -1033,7 +1022,7 @@ public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID old if (item is null) { - m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); + Logger.LogError($"[AGENT INVENTORY]: Failed to find item {oldItemID}"); return; } @@ -1112,16 +1101,17 @@ public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List items) { UUID agentId = remoteClient.AgentId; - m_log.DebugFormat( - "[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, agentId); + Logger?.LogDebug($"[AGENT INVENTORY]: Moving {items.Count} items for user {agentId}"); if (!InventoryService.MoveItems(agentId, items)) - m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + agentId); + { + Logger?.LogWarning($"[AGENT INVENTORY]: Failed to move items for user {agentId}"); + } foreach (InventoryItemBase it in items) { InventoryItemBase n = InventoryService.GetItem(agentId, it.ID); - if(n is not null) + if (n is not null) remoteClient.SendBulkUpdateInventory(n); } } @@ -1193,9 +1183,7 @@ public void CreateNewInventoryItem( else { m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); - m_log.WarnFormat( - "Failed to add item for {0} in CreateNewInventoryItem!", - remoteClient.Name); + Logger?.LogWarning($"Failed to add item for {remoteClient.Name} in CreateNewInventoryItem!"); } } @@ -1257,9 +1245,7 @@ private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID } else { - m_log.ErrorFormat( - "ScenePresence for agent uuid {0} unexpectedly not found in HandleLinkInventoryItem", - remoteClient.AgentId); + Logger.LogError($"ScenePresence for agent uuid {remoteClient.AgentId} unexpectedly not found in HandleLinkInventoryItem"); } } @@ -1286,7 +1272,7 @@ private void RemoveInventoryItem(IClientAPI remoteClient, List itemIDs) /// private void RemoveInventoryFolder(IClientAPI remoteClient, List folderIDs) { - m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count); + Logger.LogDebug($"[SCENE INVENTORY]: RemoveInventoryFolders count {folderIDs.Count}"); InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs); } @@ -1339,7 +1325,7 @@ public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint local if (item2 is null) { - m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message); + Logger?.LogWarning($"[SCENE INVENTORY]: RemoveTaskInventory of item {itemID} failed: {message}"); remoteClient.SendAgentAlertMessage(message, false); return; } @@ -1368,11 +1354,10 @@ private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, Scene TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (taskItem is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for creating an avatar" - + " inventory item from a prim's inventory item " - + " but the required item does not exist in the prim's inventory", - itemId, part.Name, part.UUID); + Logger?.LogError( + $"[PRIM INVENTORY]: Tried to retrieve item ID {itemId} from prim {part.Name}, {part.UUID} for creating an avatar" + + " inventory item from a prim's inventory item but the required item does not exist in the prim's inventory"); + message = "Item not found: " + itemId; return null; } @@ -1470,9 +1455,7 @@ private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId) /// public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message) { - m_log.DebugFormat( - "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", - itemId, part.Name, folderId, remoteClient.Name); + Logger?.LogDebug($"[PRIM INVENTORY]: Adding item {itemId} from {part.Name} to folder {folderId} for {remoteClient.Name}"); InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message); if (agentItem is null) @@ -1502,30 +1485,27 @@ public void ClientMoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part = GetSceneObjectPart(primLocalId); if (part is null) { - m_log.WarnFormat( - "[PRIM INVENTORY]: " + - "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found", - itemId, primLocalId); - + Logger.LogWarning($"[PRIM INVENTORY]: Move of inventory item {itemId} from prim with local id {primLocalId} failed because the prim could not be found"); return; } TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (taskItem is null) { - m_log.WarnFormat("[PRIM INVENTORY]: Move of inventory item {0} from prim with local id {1} failed" - + " because the inventory item could not be found", - itemId, primLocalId); - + Logger?.LogWarning($"[PRIM INVENTORY]: Move of inventory item {itemId} from prim with local id {primLocalId} failed because the inventory item could not be found"); return; } if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId)) + { return; + } InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out string message); if (item is null) + { remoteClient.SendAgentAlertMessage(message, false); + } } /// @@ -1572,10 +1552,9 @@ public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); if (srcTaskItem is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for moving" - + " but the item does not exist in this inventory", - itemId, part.Name, part.UUID); + Logger?.LogError( + $"[PRIM INVENTORY]: Tried to retrieve item ID {itemId} from prim {part.Name}, {part.UUID} for moving" + + $" but the item does not exist in this inventory"); return; } @@ -1583,10 +1562,7 @@ public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId SceneObjectPart destPart = GetSceneObjectPart(destId); if (destPart is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Could not find prim for ID {0}", - destId); + Logger?.LogError($"[PRIM INVENTORY]: Could not find prim for ID {0}", destId); return; } @@ -1779,7 +1755,7 @@ public void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, Tas UUID itemID = itemInfo.ItemID; if (itemID.IsZero()) { - m_log.ErrorFormat( + Logger?.LogError( "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!", remoteClient.Name); return; @@ -1789,11 +1765,8 @@ public void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, Tas SceneObjectPart part = GetSceneObjectPart(primLocalID); if(part is null) { - m_log.WarnFormat( - "[PRIM INVENTORY]: " + - "Update with item {0} requested of prim {1} for {2} but this prim does not exist", - itemID, primLocalID, remoteClient.Name); - return; + Logger?.LogWarning($"[PRIM INVENTORY]: Update with item {itemID} requested of prim {primLocalID} for {remoteClient.Name} but this prim does not exist"); + return; } TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); @@ -1808,9 +1781,7 @@ public void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, Tas if(item is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", - itemID, remoteClient.Name); + Logger?.LogError($"[PRIM INVENTORY]: Could not find inventory item {itemID} to update for {remoteClient.Name}!"); return; } @@ -1820,9 +1791,9 @@ public void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, Tas UUID copyID = UUID.Random(); bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient); part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights); - m_log.InfoFormat( - "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", - item.Name, primLocalID, remoteClient.Name); + + Logger?.LogInformation($"[PRIM INVENTORY]: Update with item {item.Name} requested of prim {primLocalID} for {remoteClient.Name}"); + part.SendPropertiesToClient(remoteClient); if (!Permissions.BypassPermissions()) { @@ -1835,10 +1806,6 @@ public void UpdateTaskInventory(IClientAPI remoteClient, UUID transactionID, Tas } else // Updating existing item with new perms etc { - //m_log.DebugFormat( - // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", - // currentItem.Name, part.Name); - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) return; @@ -1999,18 +1966,14 @@ public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID } else { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Could not rez script {0} into prim local ID {1} for user {2}" - + " because the prim could not be found in the region!", - item.Name, localID, agentID); + Logger?.LogError( + $"[PRIM INVENTORY]: Could not rez script {item.Name} into prim local ID {localID} " + + $"for user {agentID} because the prim could not be found in the region!"); } } else { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", - fromItemID, agentID); + Logger?.LogError($"[PRIM INVENTORY]: Could not find script inventory item {fromItemID} to rez for {agentID}!"); } return null; @@ -2124,10 +2087,9 @@ public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); if (srcTaskItem is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for rezzing a script but the " - + " item does not exist in this inventory", - srcId, srcPart.Name, srcPart.UUID); + Logger?.LogError( + $"[PRIM INVENTORY]: Tried to retrieve item ID {srcId} from prim {srcPart.Name}, {srcPart.UUID} " + + "for rezzing a script but the item does not exist in this inventory"); return; } @@ -2135,9 +2097,7 @@ public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, SceneObjectPart destPart = GetSceneObjectPart(destId); if (destPart is null) { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}", - destId, srcId, srcPart.Name, srcPart.UUID, Name); + Logger?.LogError($"[PRIM INVENTORY]: Could not find part {destId} to insert script item {srcId} from {srcPart.Name} {srcPart.UUID} in {Name}"); return; } @@ -2159,10 +2119,11 @@ public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, if (destPart.ScriptAccessPin == 0 || destPart.ScriptAccessPin != pin) { - m_log.WarnFormat( - "[PRIM INVENTORY]: " + - "Script in object {0} : {1}, attempted to load script {2} : {3} into object {4} : {5} with invalid pin {6}", - srcPart.Name, srcId, srcTaskItem.Name, srcTaskItem.ItemID, destPart.Name, destId, pin); + Logger?.LogWarning( + $"[PRIM INVENTORY]: Script in object {srcPart.Name} : {srcId}, " + + $"attempted to load script {srcTaskItem.Name} : {srcTaskItem.ItemID} " + + $"into object {destPart.Name} : {destId} with invalid pin {pin}"); + // the LSL Wiki says we are supposed to shout on the DEBUG_CHANNEL - // "Object: Task Object trying to illegally load script onto task Other_Object!" // How do we shout from in here? @@ -2523,15 +2484,15 @@ public bool GetObjectsToRez( if (isSingleObject || isAttachment) { - SceneObjectGroup g; + SceneObjectGroup? g; try { g = SceneObjectSerializer.FromOriginalXmlFormat(reader); } catch (Exception e) { - m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed ", e); - Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); + Logger?.LogError(e, "[AGENT INVENTORY]: Deserialization of xml failed."); + //Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); g = null; } @@ -2583,8 +2544,8 @@ public bool GetObjectsToRez( } catch (Exception e) { - m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag ", e); - Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); + Logger?.LogError(e, "\"[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag."); + //Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); } return true; @@ -2630,9 +2591,9 @@ public virtual void RezObject(IClientAPI remoteClient, UUID itemID, UUID rezGrou SceneObjectPart part = GetSceneObjectPart(fromTaskID); if (part is null) { - m_log.ErrorFormat( - "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object", - remoteClient.Name, itemID, fromTaskID); + Logger?.LogError( + $"[TASK INVENTORY]: {remoteClient.Name} tried to rez item id {itemID} " + + $"from object id {fromTaskID} but there is no such scene object"); return; } @@ -2640,17 +2601,19 @@ public virtual void RezObject(IClientAPI remoteClient, UUID itemID, UUID rezGrou TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); if (item is null) { - m_log.ErrorFormat( - "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item", - remoteClient.Name, itemID, fromTaskID); + Logger?.LogError( + $"[TASK INVENTORY]: {remoteClient.Name} tried to rez item id {itemID} " + + $"from object id {fromTaskID} but there is no such item"); + return; } if(item.InvType != (int)InventoryType.Object) { - m_log.ErrorFormat( - "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but item is not a object", - remoteClient.Name, itemID, fromTaskID); + Logger?.LogError( + $"[TASK INVENTORY]: {remoteClient.Name} tried to rez item id {itemID} " + + $"from object id {fromTaskID} but item is not a object"); + return; } @@ -2967,13 +2930,13 @@ public void LinkObjects(UUID agentId, uint parentPrimId, List childPrimIds if (root is null) { - m_log.DebugFormat("[LINK]: Can't find linkset root prim {0}", parentPrimId); + Logger?.LogDebug($"[LINK]: Can't find linkset root prim {parentPrimId}"); return; } if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID)) { - m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); + Logger?.LogDebug($"[LINK]: Refusing link. No permissions on root prim"); return; } @@ -2995,13 +2958,13 @@ public void LinkObjects(UUID agentId, uint parentPrimId, List childPrimIds // if (owners.Count > 1) { - m_log.DebugFormat("[LINK]: Refusing link. Too many owners"); + Logger?.LogDebug($"[LINK]: Refusing link. Too many owners"); return; } if (children.Count == 0) { - m_log.DebugFormat("[LINK]: Refusing link. No permissions to link any of the children"); + Logger?.LogDebug($"[LINK]: Refusing link. No permissions to link any of the children"); return; } diff --git a/Source/OpenSim.Region.Framework/Scenes/Scene.Permissions.cs b/Source/OpenSim.Region.Framework/Scenes/Scene.Permissions.cs index 48c1f67518a..1a6703065ad 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Scene.Permissions.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Scene.Permissions.cs @@ -25,14 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes { diff --git a/Source/OpenSim.Region.Framework/Scenes/Scene.cs b/Source/OpenSim.Region.Framework/Scenes/Scene.cs index 3d9195323db..55f76dc2f08 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Scene.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Scene.cs @@ -25,15 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Runtime; using System.Text; -using System.Threading; using System.Timers; -using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; @@ -42,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.PhysicsModule.SharedBase; + using Timer = System.Timers.Timer; using TPFlags = OpenSim.Framework.Constants.TeleportFlags; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using PermissionMask = OpenSim.Framework.PermissionMask; + using System.Runtime.CompilerServices; using Microsoft.Extensions.Configuration; diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneBase.cs b/Source/OpenSim.Region.Framework/Scenes/SceneBase.cs index 8b02c5fb2f4..2ab48eae03c 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneBase.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneBase.cs @@ -25,26 +25,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Threading; using OpenMetaverse; -using log4net; -using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Console; - using OpenSim.Region.Framework.Interfaces; + using GridRegion = OpenSim.Services.Interfaces.GridRegion; + using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace OpenSim.Region.Framework.Scenes { public abstract class SceneBase : IScene { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - #pragma warning disable 414 private static readonly string LogHeader = "[SCENE]"; #pragma warning restore 414 @@ -59,12 +52,22 @@ public abstract class SceneBase : IScene public string Name { get { return RegionInfo.RegionName; } } - public IConfiguration Config + public IConfiguration? Config { get { return GetConfig(); } } - protected virtual IConfiguration GetConfig() + protected virtual IConfiguration? GetConfig() + { + return null; + } + + public ILogger? Logger + { + get { return GetLogger(); } + } + + protected virtual ILogger? GetLogger() { return null; } @@ -76,6 +79,7 @@ public Dictionary RegionModules { get { return m_regionModules; } } + private Dictionary m_regionModules = new Dictionary(); /// diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneCommunicationService.cs b/Source/OpenSim.Region.Framework/Scenes/SceneCommunicationService.cs index cf8b2cd999a..b0f5503ced0 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneCommunicationService.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneCommunicationService.cs @@ -25,20 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Net; using System.Reflection; -using System.Threading; +using Microsoft.Extensions.Logging; using OpenMetaverse; -using OpenMetaverse.StructuredData; -using log4net; using OpenSim.Framework; -using OpenSim.Framework.Client; -using OpenSim.Framework.Capabilities; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; -using OSD = OpenMetaverse.StructuredData.OSD; + using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.Framework.Scenes @@ -50,12 +42,17 @@ namespace OpenSim.Region.Framework.Scenes /// public class SceneCommunicationService //one instance per region { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly ILogger _logger; private static readonly string LogHeader = "[SCENE COMM]"; protected RegionInfo m_regionInfo; protected Scene m_scene; + public SceneCommunicationService(ILogger logger) + { + _logger = logger; + } + public void SetScene(Scene s) { m_scene = s; @@ -64,10 +61,9 @@ public void SetScene(Scene s) public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region) { - //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); if (neighbourService == null) { - m_log.ErrorFormat("{0} No neighbour service provided for region {1} to inform neigbhours of status", LogHeader, m_scene.Name); + _logger.LogError($"{LogHeader} No neighbour service provided for region {m_scene.Name} to inform neigbhours of status"); return; } @@ -105,15 +101,12 @@ List neighbours GridRegion neighbour = neighbourService.HelloNeighbour(regionhandle, region); if (neighbour != null) { - m_log.DebugFormat("{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up", - LogHeader, m_scene.Name, neighbour.RegionName, rx, ry); - + _logger.LogDebug($"{LogHeader} Region {m_scene.Name} successfully informed neighbour {neighbour.RegionName} at {rx}-{ry} that it is up"); m_scene.EventManager.TriggerOnRegionUp(neighbour); } else { - m_log.WarnFormat("{0} Region {1} failed to inform neighbour at {2}-{3} that it is up.", - LogHeader, m_scene.Name, rx, ry); + _logger.LogWarning($"{LogHeader} Region {m_scene.Name} failed to inform neighbour at {rx}-{ry} that it is up."); } } }); @@ -182,14 +175,11 @@ public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List< GridRegion destination = m_scene.GridService.GetRegionByHandle(m_regionInfo.ScopeID, regionHandle); if (destination == null) { - m_log.DebugFormat( - "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} FAIL, region with handle {1} not found", agentID, regionHandle); + _logger.LogDebug($"[SCENE COMMUNICATION SERVICE]: Sending close agent ID {agentID} FAIL, region with handle {regionHandle} not found"); return; } - m_log.DebugFormat( - "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); - + _logger.LogDebug($"[SCENE COMMUNICATION SERVICE]: Sending close agent ID {agentID} to {destination.RegionName}"); m_scene.SimulationService.CloseAgent(destination, agentID, auth_code); } }, null, "SCOMM.SendCloseChildAgentConnections"); diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneGraph.cs b/Source/OpenSim.Region.Framework/Scenes/SceneGraph.cs index 9812f584927..d24f7249ca4 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneGraph.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneGraph.cs @@ -25,18 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Threading; -using System.Collections.Generic; -using System.Collections.Concurrent; using System.Reflection; using OpenMetaverse; using OpenMetaverse.Packets; -using log4net; using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes.Types; using OpenSim.Region.PhysicsModule.SharedBase; -using OpenSim.Region.Framework.Interfaces; using System.Runtime.InteropServices; namespace OpenSim.Region.Framework.Scenes @@ -52,8 +45,6 @@ namespace OpenSim.Region.Framework.Scenes /// public class SceneGraph { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - #region Events protected internal event PhysicsCrash UnRecoverableError; diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneManager.cs b/Source/OpenSim.Region.Framework/Scenes/SceneManager.cs index f454908d9ce..07f67918f8a 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneManager.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneManager.cs @@ -25,12 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Net; using System.Reflection; using OpenMetaverse; -using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -43,8 +40,6 @@ namespace OpenSim.Region.Framework.Scenes /// public class SceneManager { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public event RestartSim OnRestartSim; /// diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneObjectGroup.Inventory.cs b/Source/OpenSim.Region.Framework/Scenes/SceneObjectGroup.Inventory.cs index 88605ac4330..93e048c3546 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -25,23 +25,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; using System.Reflection; using OpenMetaverse; -using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using System.Collections.Generic; using System.Xml; + using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes { public partial class SceneObjectGroup : EntityBase { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Force all task inventories of prims in the scene object to persist /// diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneObjectPart.cs b/Source/OpenSim.Region.Framework/Scenes/SceneObjectPart.cs index fe4b1f09253..fca530942a0 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneObjectPart.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneObjectPart.cs @@ -30,7 +30,6 @@ using System.Text; using System.Xml; using System.Xml.Serialization; -using log4net; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -109,8 +108,6 @@ public class SceneObjectPart : EntityBase, IDisposable scriptEvents.collision_start | scriptEvents.collision_end ); - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - /// /// Dynamic attributes can be created and deleted as required. /// diff --git a/Source/OpenSim.Region.Framework/Scenes/SceneObjectPartInventory.cs b/Source/OpenSim.Region.Framework/Scenes/SceneObjectPartInventory.cs index c0dad7ac423..d953adc0d9b 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SceneObjectPartInventory.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SceneObjectPartInventory.cs @@ -25,28 +25,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Text; using System.Xml; -using System.IO; -using System.Collections.Generic; using System.Collections; using System.Reflection; -using System.Threading; using OpenMetaverse; -using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes.Scripting; -using OpenSim.Region.Framework.Scenes.Serialization; + using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes { public class SceneObjectPartInventory : IEntityInventory , IDisposable { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private byte[] m_inventoryFileData = Array.Empty(); private byte[] m_inventoryFileNameBytes = Array.Empty(); private string m_inventoryFileName = ""; diff --git a/Source/OpenSim.Region.Framework/Scenes/ScenePresence.cs b/Source/OpenSim.Region.Framework/Scenes/ScenePresence.cs index 84625b7206b..fdbc5dc7cef 100644 --- a/Source/OpenSim.Region.Framework/Scenes/ScenePresence.cs +++ b/Source/OpenSim.Region.Framework/Scenes/ScenePresence.cs @@ -25,18 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Reflection; -using System.Threading; using OpenMetaverse; -using log4net; -using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Animation; -using OpenSim.Region.Framework.Scenes.Types; using OpenSim.Region.PhysicsModule.SharedBase; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; @@ -83,16 +77,10 @@ enum AgentUpdateFlags: byte public class ScenePresence : EntityBase, IScenePresence, IDisposable { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - //~ScenePresence() - //{ - // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); - //} - public bool GotAttachmentsData = false; public int EnvironmentVersion = -1; private ViewerEnvironment m_environment = null; + public ViewerEnvironment Environment { get diff --git a/Source/OpenSim.Region.Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/Source/OpenSim.Region.Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 6a4a18144a6..cf03edc423a 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -25,18 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Reflection; using System.Text; using System.Xml; -using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Scenes.Serialization { @@ -45,7 +37,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// public class CoalescedSceneObjectsSerializer { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Serialize coalesced objects to Xml diff --git a/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneObjectSerializer.cs b/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneObjectSerializer.cs index f371137f3e6..eb093516e40 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -25,13 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; using System.Drawing; -using System.IO; -using System.Reflection; + using System.Xml; -using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Serialization.External; @@ -45,8 +41,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// right now - hopefully this isn't forever. public class SceneObjectSerializer { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static IUserManagement m_UserManagement; /// diff --git a/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneXmlLoader.cs b/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneXmlLoader.cs index 4fb3e6a0d27..5e10ec793a9 100644 --- a/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/Source/OpenSim.Region.Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -25,16 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.IO; using System.Reflection; using System.Xml; using OpenMetaverse; -using log4net; -using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; namespace OpenSim.Region.Framework.Scenes.Serialization { @@ -43,8 +36,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// public class SceneXmlLoader { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - #region old xml format public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) { diff --git a/Source/OpenSim.Region.Framework/Scenes/SimStatsReporter.cs b/Source/OpenSim.Region.Framework/Scenes/SimStatsReporter.cs index 65df9ef829c..84fa5e052e3 100644 --- a/Source/OpenSim.Region.Framework/Scenes/SimStatsReporter.cs +++ b/Source/OpenSim.Region.Framework/Scenes/SimStatsReporter.cs @@ -25,11 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Timers; -using System.Threading; -using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; @@ -44,8 +39,6 @@ namespace OpenSim.Region.Framework.Scenes /// public class SimStatsReporter { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public delegate void SendStatResult(SimStats stats); public event SendStatResult OnSendStatsResult; diff --git a/Source/OpenSim.Region.Framework/Scenes/TerrainChannel.cs b/Source/OpenSim.Region.Framework/Scenes/TerrainChannel.cs index fc404c2d9cb..c621da4ee42 100644 --- a/Source/OpenSim.Region.Framework/Scenes/TerrainChannel.cs +++ b/Source/OpenSim.Region.Framework/Scenes/TerrainChannel.cs @@ -25,21 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.IO; -using System.Text; -using System.Reflection; using System.Xml; using System.Xml.Serialization; - -using OpenSim.Data; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; -using log4net; - namespace OpenSim.Region.Framework.Scenes { /// @@ -47,7 +39,6 @@ namespace OpenSim.Region.Framework.Scenes /// public class TerrainChannel : ITerrainChannel { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static string LogHeader = "[TERRAIN CHANNEL]"; protected TerrainData m_terrainData; diff --git a/Source/OpenSim.Region.Framework/Scenes/TerrainCompressor.cs b/Source/OpenSim.Region.Framework/Scenes/TerrainCompressor.cs index 0f9c448139d..38c786d2636 100644 --- a/Source/OpenSim.Region.Framework/Scenes/TerrainCompressor.cs +++ b/Source/OpenSim.Region.Framework/Scenes/TerrainCompressor.cs @@ -32,11 +32,6 @@ // terrain patchs must be 16mx16m -using System; -using System.Collections.Generic; - -using log4net; - using OpenSim.Framework; using OpenMetaverse; diff --git a/Source/OpenSim.Region.Framework/Scenes/UndoState.cs b/Source/OpenSim.Region.Framework/Scenes/UndoState.cs index f2a3e5f23c0..efa17b3cb22 100644 --- a/Source/OpenSim.Region.Framework/Scenes/UndoState.cs +++ b/Source/OpenSim.Region.Framework/Scenes/UndoState.cs @@ -25,11 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Reflection; -using System.Collections.Generic; -using log4net; -using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; diff --git a/Source/OpenSim.Region.Framework/Scenes/UuidGatherer.cs b/Source/OpenSim.Region.Framework/Scenes/UuidGatherer.cs index 7c9e7b94d26..b36307b5971 100644 --- a/Source/OpenSim.Region.Framework/Scenes/UuidGatherer.cs +++ b/Source/OpenSim.Region.Framework/Scenes/UuidGatherer.cs @@ -25,12 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; using System.Runtime.CompilerServices; using System.Text; -using log4net; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; @@ -50,8 +46,6 @@ namespace OpenSim.Region.Framework.Scenes /// public class UuidGatherer { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly HashSet ToSkip = new() { new UUID("11111111-1111-0000-0000-000100bba000"), @@ -1315,8 +1309,6 @@ private void RecordMaterialAssetUuids(AssetBase materialAsset) public class HGUuidGatherer : UuidGatherer { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected string m_assetServerURL; public HGUuidGatherer(IAssetService assetService, string assetServerURL) diff --git a/Source/OpenSim.Region.OptionalModules.Currency/OpenSim.Region.OptionalModules.Currency.csproj b/Source/OpenSim.Region.OptionalModules.Currency/OpenSim.Region.OptionalModules.Currency.csproj index ea9e024b438..99e3ae49a37 100644 --- a/Source/OpenSim.Region.OptionalModules.Currency/OpenSim.Region.OptionalModules.Currency.csproj +++ b/Source/OpenSim.Region.OptionalModules.Currency/OpenSim.Region.OptionalModules.Currency.csproj @@ -32,7 +32,6 @@ - diff --git a/Source/OpenSim.Region.OptionalModules/OpenSim.Region.OptionalModules.csproj b/Source/OpenSim.Region.OptionalModules/OpenSim.Region.OptionalModules.csproj index 0da7b218ef4..7b3ca6f2cc9 100644 --- a/Source/OpenSim.Region.OptionalModules/OpenSim.Region.OptionalModules.csproj +++ b/Source/OpenSim.Region.OptionalModules/OpenSim.Region.OptionalModules.csproj @@ -52,10 +52,8 @@ - - - + \ No newline at end of file diff --git a/Source/OpenSim.Region.PhysicsModule.BulletS/BSScene.cs b/Source/OpenSim.Region.PhysicsModule.BulletS/BSScene.cs index 93996fd1b5b..cadce15bb62 100644 --- a/Source/OpenSim.Region.PhysicsModule.BulletS/BSScene.cs +++ b/Source/OpenSim.Region.PhysicsModule.BulletS/BSScene.cs @@ -35,7 +35,6 @@ using OpenMetaverse; using Microsoft.Extensions.Configuration; -using log4net.Core; using Microsoft.Extensions.Logging; namespace OpenSim.Region.PhysicsModule.BulletS @@ -418,20 +417,20 @@ private void GetInitialParameterValues(IConfiguration config) } } - // A helper function that handles a true/false parameter and returns the proper float number encoding - float ParamBoolean(IConfig config, string parmName, float deflt) - { - float ret = deflt; - if (config.Contains(parmName)) - { - ret = ConfigurationParameters.numericFalse; - if (config.GetBoolean(parmName, false)) - { - ret = ConfigurationParameters.numericTrue; - } - } - return ret; - } + //// A helper function that handles a true/false parameter and returns the proper float number encoding + //float ParamBoolean(IConfig config, string parmName, float deflt) + //{ + // float ret = deflt; + // if (config.Contains(parmName)) + // { + // ret = ConfigurationParameters.numericFalse; + // if (config.GetBoolean(parmName, false)) + // { + // ret = ConfigurationParameters.numericTrue; + // } + // } + // return ret; + //} // Select the connection to the actual Bullet implementation. // The main engine selection is the engineName up to the first hypen. diff --git a/Source/OpenSim.Region.PhysicsModule.BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj b/Source/OpenSim.Region.PhysicsModule.BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj index eb43d5b02a9..74cc9f125b8 100644 --- a/Source/OpenSim.Region.PhysicsModule.BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj +++ b/Source/OpenSim.Region.PhysicsModule.BulletS/OpenSim.Region.PhysicsModule.BulletS.csproj @@ -31,7 +31,5 @@ - - diff --git a/Source/OpenSim.Region.PhysicsModule.Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj b/Source/OpenSim.Region.PhysicsModule.Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj index 25937b11acf..df42b21e46d 100644 --- a/Source/OpenSim.Region.PhysicsModule.Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj +++ b/Source/OpenSim.Region.PhysicsModule.Meshing/OpenSim.Region.PhysicsModule.Meshing.csproj @@ -8,7 +8,7 @@ - + diff --git a/Source/OpenSim.Region.PhysicsModule.SharedBase/NullPhysicsScene.cs b/Source/OpenSim.Region.PhysicsModule.SharedBase/NullPhysicsScene.cs index 949b352c536..3b35b787fa3 100644 --- a/Source/OpenSim.Region.PhysicsModule.SharedBase/NullPhysicsScene.cs +++ b/Source/OpenSim.Region.PhysicsModule.SharedBase/NullPhysicsScene.cs @@ -27,7 +27,6 @@ using OpenSim.Framework; using OpenMetaverse; -using log4net.Core; using Microsoft.Extensions.Logging; namespace OpenSim.Region.PhysicsModule.SharedBase diff --git a/Source/OpenSim.Region.PhysicsModule.SharedBase/OpenSim.Region.PhysicsModule.SharedBase.csproj b/Source/OpenSim.Region.PhysicsModule.SharedBase/OpenSim.Region.PhysicsModule.SharedBase.csproj index ad2a121334a..7afb9f9d961 100644 --- a/Source/OpenSim.Region.PhysicsModule.SharedBase/OpenSim.Region.PhysicsModule.SharedBase.csproj +++ b/Source/OpenSim.Region.PhysicsModule.SharedBase/OpenSim.Region.PhysicsModule.SharedBase.csproj @@ -8,8 +8,6 @@ - - diff --git a/Source/OpenSim.Region.PhysicsModule.ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj b/Source/OpenSim.Region.PhysicsModule.ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj index dd3c8c2b12e..834b0edaefa 100644 --- a/Source/OpenSim.Region.PhysicsModule.ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj +++ b/Source/OpenSim.Region.PhysicsModule.ubOdeMeshing/OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj @@ -10,7 +10,7 @@ - + diff --git a/Source/OpenSim.Region.ScriptEngine.Shared/OpenSim.Region.ScriptEngine.Shared.csproj b/Source/OpenSim.Region.ScriptEngine.Shared/OpenSim.Region.ScriptEngine.Shared.csproj index 133dd5029ab..28eca379185 100644 --- a/Source/OpenSim.Region.ScriptEngine.Shared/OpenSim.Region.ScriptEngine.Shared.csproj +++ b/Source/OpenSim.Region.ScriptEngine.Shared/OpenSim.Region.ScriptEngine.Shared.csproj @@ -27,7 +27,6 @@ - diff --git a/Source/OpenSim.Region.ScriptEngine.YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj b/Source/OpenSim.Region.ScriptEngine.YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj index 951a200213d..a0ed42030f7 100644 --- a/Source/OpenSim.Region.ScriptEngine.YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj +++ b/Source/OpenSim.Region.ScriptEngine.YEngine/OpenSim.Region.ScriptEngine.YEngine.csproj @@ -8,9 +8,7 @@ - - - + diff --git a/Source/OpenSim.Server.Base/ServerUtils.cs b/Source/OpenSim.Server.Base/ServerUtils.cs index 5ebd986df78..b4bd40701d7 100644 --- a/Source/OpenSim.Server.Base/ServerUtils.cs +++ b/Source/OpenSim.Server.Base/ServerUtils.cs @@ -29,20 +29,13 @@ using System.Xml; using System.Xml.Serialization; using System.Text; -using log4net; using OpenSim.Framework; using OpenMetaverse; -using OpenSim.Framework.Servers.HttpServer; - -using Microsoft.Extensions.Configuration; -using System.Net; namespace OpenSim.Server.Base { public static class ServerUtils { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static byte[] SerializeResult(XmlSerializer xs, object data) { using (MemoryStream ms = new MemoryStream()) @@ -324,10 +317,10 @@ public static Dictionary ParseXmlResponse(string data) if (!xr.ReadToFollowing("ServerResponse")) return new Dictionary(); return ScanXmlResponse(xr); - } + } catch (Exception e) { - m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0}\n --string:\n{1}\n", e.Message, data); + //m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0}\n --string:\n{1}\n", e.Message, data); } return new Dictionary(); } diff --git a/Source/OpenSim.Server.Common/OpenSim.Server.Common.csproj b/Source/OpenSim.Server.Common/OpenSim.Server.Common.csproj index daa00d52cd7..c658e9467cd 100644 --- a/Source/OpenSim.Server.Common/OpenSim.Server.Common.csproj +++ b/Source/OpenSim.Server.Common/OpenSim.Server.Common.csproj @@ -12,7 +12,7 @@ - + diff --git a/Source/OpenSim.Server.MoneyServer/IMoneyDBService.cs b/Source/OpenSim.Server.MoneyServer/IMoneyDBService.cs index 209cf7e59dc..ba36a5eeb37 100644 --- a/Source/OpenSim.Server.MoneyServer/IMoneyDBService.cs +++ b/Source/OpenSim.Server.MoneyServer/IMoneyDBService.cs @@ -41,7 +41,7 @@ public interface IMoneyDBService bool giveMoney(UUID transactionID, string receiverID, int amount); - bool addTransaction(TransactionData transaction); + bool addTransaction(MoneyTransactionData transaction); bool addUser(string userID, int balance, int status, int type); @@ -51,9 +51,9 @@ public interface IMoneyDBService bool ValidateTransfer(string secureCode, UUID transactionID); - TransactionData FetchTransaction(UUID transactionID); + MoneyTransactionData FetchTransaction(UUID transactionID); - TransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex); + MoneyTransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex); int getTransactionNum(string userID, int startTime, int endTime); diff --git a/Source/OpenSim.Server.MoneyServer/MoneyDBService.cs b/Source/OpenSim.Server.MoneyServer/MoneyDBService.cs index 1e4526566a4..aad7064f3dc 100644 --- a/Source/OpenSim.Server.MoneyServer/MoneyDBService.cs +++ b/Source/OpenSim.Server.MoneyServer/MoneyDBService.cs @@ -207,7 +207,7 @@ public bool giveMoney(UUID transactionID, string receiverID, int amount) } - public bool setTotalSale(TransactionData transaction) + public bool setTotalSale(MoneyTransactionData transaction) { if (transaction.Receiver == transaction.Sender) return false; if (transaction.Sender == UUID.Zero.ToString()) return false; @@ -236,7 +236,7 @@ public bool setTotalSale(TransactionData transaction) } - public bool addTransaction(TransactionData transaction) + public bool addTransaction(MoneyTransactionData transaction) { MySQLSuperManager dbm = GetLockedConnection(); @@ -264,7 +264,7 @@ public bool addTransaction(TransactionData transaction) public bool addUser(string userID, int balance, int status, int type) { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = UUID.Random(); transaction.Sender = UUID.Zero.ToString(); transaction.Receiver = userID; @@ -389,7 +389,7 @@ public bool ValidateTransfer(string secureCode, UUID transactionID) } - public TransactionData FetchTransaction(UUID transactionID) + public MoneyTransactionData FetchTransaction(UUID transactionID) { MySQLSuperManager dbm = GetLockedConnection(); @@ -415,10 +415,10 @@ public TransactionData FetchTransaction(UUID transactionID) } - public TransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex) + public MoneyTransactionData FetchTransaction(string userID, int startTime, int endTime, int lastIndex) { MySQLSuperManager dbm = GetLockedConnection(); - TransactionData[] arrTransaction; + MoneyTransactionData[] arrTransaction; uint index = 0; if (lastIndex >= 0) index = Convert.ToUInt32(lastIndex) + 1; @@ -459,7 +459,7 @@ public bool DoTransfer(UUID transactionUUID) { bool do_trans = false; - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction = FetchTransaction(transactionUUID); if (transaction != null && transaction.Status == (int)Status.PENDING_STATUS) @@ -528,7 +528,7 @@ public bool DoTransfer(UUID transactionUUID) // by Fumi.Iseki public bool DoAddMoney(UUID transactionUUID) { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction = FetchTransaction(transactionUUID); if (transaction != null && transaction.Status == (int)Status.PENDING_STATUS) diff --git a/Source/OpenSim.Server.MoneyServer/MoneyXmlRpcModule.cs b/Source/OpenSim.Server.MoneyServer/MoneyXmlRpcModule.cs index 18203bef3ed..b3c5f273e3e 100644 --- a/Source/OpenSim.Server.MoneyServer/MoneyXmlRpcModule.cs +++ b/Source/OpenSim.Server.MoneyServer/MoneyXmlRpcModule.cs @@ -627,7 +627,7 @@ public XmlRpcResponse handleTransaction(XmlRpcRequest request, IPEndPoint remote int time = (int)((DateTime.UtcNow.Ticks - TicksToEpoch) / 10000000); try { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = transactionUUID; transaction.Sender = senderID; transaction.Receiver = receiverID; @@ -768,7 +768,7 @@ public XmlRpcResponse handleForceTransaction(XmlRpcRequest request, IPEndPoint r try { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = transactionUUID; transaction.Sender = senderID; transaction.Receiver = receiverID; @@ -909,7 +909,7 @@ public XmlRpcResponse handleScriptTransaction(XmlRpcRequest request, IPEndPoint try { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = transactionUUID; transaction.Sender = senderID; transaction.Receiver = receiverID; @@ -1041,7 +1041,7 @@ public XmlRpcResponse handleAddBankerMoney(XmlRpcRequest request, IPEndPoint rem try { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = transactionUUID; transaction.Sender = senderID; transaction.Receiver = bankerID; @@ -1159,7 +1159,7 @@ public XmlRpcResponse handlePayMoneyCharge(XmlRpcRequest request, IPEndPoint rem int time = (int)((DateTime.UtcNow.Ticks - TicksToEpoch) / 10000000); try { - TransactionData transaction = new TransactionData(); + MoneyTransactionData transaction = new MoneyTransactionData(); transaction.TransUUID = transactionUUID; transaction.Sender = senderID; transaction.Receiver = receiverID; @@ -1232,7 +1232,7 @@ public bool NotifyTransfer(UUID transactionUUID, string msg2sender, string msg2r { if (m_moneyDBService.DoTransfer(transactionUUID)) { - TransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); + MoneyTransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); if (transaction != null && transaction.Status == (int)Status.SUCCESS_STATUS) { _logger.LogInformation("[MONEY RPC]: NotifyTransfer: Transaction Type = {0}", transaction.Type); @@ -1496,7 +1496,7 @@ private void UpdateBalance(string userID, string message) /// /// /// - protected bool RollBackTransaction(TransactionData transaction) + protected bool RollBackTransaction(MoneyTransactionData transaction) { //m_logger.LogInformation("[MONEY RPC]: RollBackTransaction:"); @@ -1557,7 +1557,7 @@ public XmlRpcResponse handleCancelTransfer(XmlRpcRequest request, IPEndPoint rem return response; } - TransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); + MoneyTransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); UserInfo user = m_moneyDBService.FetchUserInfo(transaction.Sender); try @@ -1623,7 +1623,7 @@ public XmlRpcResponse handleGetTransaction(XmlRpcRequest request, IPEndPoint rem try { - TransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); + MoneyTransactionData transaction = m_moneyDBService.FetchTransaction(transactionUUID); if (transaction != null) { responseData["success"] = true; @@ -1854,7 +1854,7 @@ public XmlRpcResponse handleWebGetTransaction(XmlRpcRequest request, IPEndPoint try { int total = m_moneyDBService.getTransactionNum(userID, startTime, endTime); - TransactionData tran = null; + MoneyTransactionData tran = null; _logger.LogInformation("[MONEY RPC]: handleWebGetTransaction: Getting transation[{0}] for user {1}", lastIndex + 1, userID); if (total > lastIndex + 2) { diff --git a/Source/OpenSim.Server.MoneyServer/OpenSim.Server.MoneyServer.csproj b/Source/OpenSim.Server.MoneyServer/OpenSim.Server.MoneyServer.csproj index b97ac39951c..8541e587da1 100644 --- a/Source/OpenSim.Server.MoneyServer/OpenSim.Server.MoneyServer.csproj +++ b/Source/OpenSim.Server.MoneyServer/OpenSim.Server.MoneyServer.csproj @@ -29,7 +29,6 @@ - @@ -48,7 +47,7 @@ - + diff --git a/Source/OpenSim.Services.Interfaces/IAttachmentsService.cs b/Source/OpenSim.Services.Interfaces/IAttachmentsService.cs index 7d3366289c4..71793e0111f 100644 --- a/Source/OpenSim.Services.Interfaces/IAttachmentsService.cs +++ b/Source/OpenSim.Services.Interfaces/IAttachmentsService.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using Nini.Config; - namespace OpenSim.Services.Interfaces { public interface IAttachmentsService diff --git a/Source/OpenSim.Services.Interfaces/IBakedTextureService.cs b/Source/OpenSim.Services.Interfaces/IBakedTextureService.cs index 50e0ed9a3da..49544255d92 100644 --- a/Source/OpenSim.Services.Interfaces/IBakedTextureService.cs +++ b/Source/OpenSim.Services.Interfaces/IBakedTextureService.cs @@ -25,9 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using Nini.Config; - namespace OpenSim.Services.Interfaces { public interface IBakedTextureService diff --git a/Source/OpenSim.Services.Interfaces/IGridService.cs b/Source/OpenSim.Services.Interfaces/IGridService.cs index 89828102018..5803faaffb4 100644 --- a/Source/OpenSim.Services.Interfaces/IGridService.cs +++ b/Source/OpenSim.Services.Interfaces/IGridService.cs @@ -25,18 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections; -using System.Collections.Generic; using System.Net; -using System.Net.Sockets; -using System.Reflection; using OpenSim.Framework; using OpenMetaverse; -using log4net; - namespace OpenSim.Services.Interfaces { public interface IGridService diff --git a/Source/OpenSim.Services.Interfaces/OpenProfileClient.cs b/Source/OpenSim.Services.Interfaces/OpenProfileClient.cs index 8c4d14b8378..894570591a8 100644 --- a/Source/OpenSim.Services.Interfaces/OpenProfileClient.cs +++ b/Source/OpenSim.Services.Interfaces/OpenProfileClient.cs @@ -25,16 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Text; -using System.Xml; -using log4net; + using OpenMetaverse; + using OpenSim.Framework; namespace OpenSim.Services.UserProfilesService diff --git a/Source/OpenSim.Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs b/Source/OpenSim.Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs index 692e651afdb..51757ac293f 100644 --- a/Source/OpenSim.Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs +++ b/Source/OpenSim.Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs @@ -25,28 +25,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using log4net; -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; -using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; using OpenSim.Server.Base; using OpenMetaverse; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace OpenSim.Services.Connectors { public class AgentPreferencesServicesConnector : BaseServiceConnector, IAgentPreferencesService { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private string m_ServerURI = String.Empty; + private ILogger m_logger; public AgentPreferencesServicesConnector() { @@ -57,9 +48,11 @@ public AgentPreferencesServicesConnector(string serverURI) m_ServerURI = serverURI.TrimEnd('/'); } - public AgentPreferencesServicesConnector(IConfiguration source) + public AgentPreferencesServicesConnector(IConfiguration source, ILogger logger) : base(source, "AgentPreferencesService") { + m_logger = logger; + Initialise(source); } @@ -68,7 +61,7 @@ public void Initialise(IConfiguration source) var gridConfig = source.GetSection("AgentPreferencesService"); if (!gridConfig.Exists()) { - m_log.Error("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini"); + m_logger.LogError("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini"); throw new Exception("Agent Preferences connector init error"); } @@ -76,7 +69,7 @@ public void Initialise(IConfiguration source) if (string.IsNullOrEmpty(serviceURI)) { - m_log.Error("[AGENT PREFERENCES CONNECTOR]: No Server URI named in section AgentPreferences"); + m_logger.LogError("[AGENT PREFERENCES CONNECTOR]: No Server URI named in section AgentPreferences"); throw new Exception("Agent Preferences connector init error"); } @@ -104,13 +97,13 @@ public AgentPrefs GetAgentPreferences(UUID principalID) reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (string.IsNullOrEmpty(reply)) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null or empty reply"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null or empty reply"); return null; } } catch (Exception e) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); + m_logger.LogDebug(e, $"[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {uri}"); } Dictionary replyData = ServerUtils.ParseXmlResponse(reply); @@ -119,15 +112,16 @@ public AgentPrefs GetAgentPreferences(UUID principalID) if (replyData.ContainsKey("result") && (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received Failure response"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received Failure response"); return null; } } else { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null response"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null response"); return null; } + AgentPrefs prefs = new AgentPrefs(replyData); return prefs; } @@ -162,11 +156,13 @@ public bool StoreAgentPreferences(AgentPrefs data) return false; } else - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences received empty reply"); + { + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences received empty reply"); + } } catch (Exception e) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); + m_logger.LogDebug(e, $"[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {uri}"); } return false; @@ -188,13 +184,13 @@ public string GetLang(UUID principalID) reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); if (string.IsNullOrEmpty(reply)) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null or empty reply"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetLang received null or empty reply"); return "en-us"; // I guess? Gotta return somethin'! } } catch (Exception e) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); + m_logger.LogDebug(e, $"[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {uri}"); } Dictionary replyData = ServerUtils.ParseXmlResponse(reply); @@ -203,7 +199,7 @@ public string GetLang(UUID principalID) if (replyData.ContainsKey("result") && (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received Failure response"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetLang received Failure response"); return "en-us"; } if (replyData.ContainsKey("Language")) @@ -211,9 +207,10 @@ public string GetLang(UUID principalID) } else { - m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null response"); + m_logger.LogDebug($"[AGENT PREFERENCES CONNECTOR]: GetLang received null response"); } + return "en-us"; } diff --git a/Source/OpenSim.Services/Connectors/Asset/AssetServicesConnector.cs b/Source/OpenSim.Services/Connectors/Asset/AssetServicesConnector.cs index 7c752c6a72b..06e19b37aef 100644 --- a/Source/OpenSim.Services/Connectors/Asset/AssetServicesConnector.cs +++ b/Source/OpenSim.Services/Connectors/Asset/AssetServicesConnector.cs @@ -25,30 +25,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using log4net; -using System; -using System.Threading; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.IO; using System.Reflection; -using System.Timers; -using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Monitoring; -using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using OpenMetaverse; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace OpenSim.Services.Connectors { public class AssetServicesConnector : BaseServiceConnector, IAssetService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + { public readonly object ConnectorLock = new object(); + private readonly ILogger _logger; + protected IAssetCache m_Cache = null; private string m_ServerURI = string.Empty; @@ -60,18 +51,16 @@ public class AssetServicesConnector : BaseServiceConnector, IAssetService private Dictionary> m_AssetHandlers = new Dictionary>(); - public AssetServicesConnector() - { - } - public AssetServicesConnector(string serverURI) { OSHHTPHost tmp = new OSHHTPHost(serverURI, true); m_ServerURI = tmp.IsResolvedHost ? tmp.URI : null; } - public AssetServicesConnector(IConfiguration source) + public AssetServicesConnector(IConfiguration source, ILogger logger) { + _logger = logger; + Initialise(source); } @@ -82,7 +71,7 @@ public virtual void Initialise(IConfiguration source) var assetConfig = source.GetSection("AssetService"); if (!assetConfig.Exists()) { - m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); + _logger.LogError("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); throw new Exception("Asset connector init error"); } @@ -95,7 +84,7 @@ public virtual void Initialise(IConfiguration source) if (string.IsNullOrEmpty(m_ServerURI)) { - m_log.Error("[ASSET CONNECTOR]: AssetServerURI not defined in section AssetService"); + _logger.LogError("[ASSET CONNECTOR]: AssetServerURI not defined in section AssetService"); throw new Exception("Asset connector init error"); } diff --git a/Source/OpenSim.Services/MapImageService/MapImageService.cs b/Source/OpenSim.Services/MapImageService/MapImageService.cs index e9637bf5691..ad3e2823f35 100644 --- a/Source/OpenSim.Services/MapImageService/MapImageService.cs +++ b/Source/OpenSim.Services/MapImageService/MapImageService.cs @@ -29,24 +29,13 @@ * https://github.com/openmetaversefoundation/simiangrid/ */ -using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; -using System.IO; -using System.Net; -using System.Reflection; -using System.Threading; - -using Nini.Config; -using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Console; using OpenSim.Services.Interfaces; using Microsoft.Extensions.Configuration; -using log4net.Core; using Microsoft.Extensions.Logging; diff --git a/Source/OpenSim.Services/OpenSim.Services.csproj b/Source/OpenSim.Services/OpenSim.Services.csproj index 07e86bf375d..8409985f9d2 100644 --- a/Source/OpenSim.Services/OpenSim.Services.csproj +++ b/Source/OpenSim.Services/OpenSim.Services.csproj @@ -49,6 +49,7 @@ + diff --git a/Source/OpenSim.Services/UserProfilesService/UserProfilesService.cs b/Source/OpenSim.Services/UserProfilesService/UserProfilesService.cs index a437276e939..df8bff2c41d 100644 --- a/Source/OpenSim.Services/UserProfilesService/UserProfilesService.cs +++ b/Source/OpenSim.Services/UserProfilesService/UserProfilesService.cs @@ -29,7 +29,6 @@ using OpenSim.Framework; using OpenSim.Data; -using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenMetaverse; @@ -37,7 +36,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Nini.Config; namespace OpenSim.Services.ProfilesService { diff --git a/Tests/OpenSim.Capabilities.Handlers.Tests/OpenSim.Capabilities.Handlers.Tests.csproj b/Tests/OpenSim.Capabilities.Handlers.Tests/OpenSim.Capabilities.Handlers.Tests.csproj index 6f4a9ccdd83..2a33491742b 100644 --- a/Tests/OpenSim.Capabilities.Handlers.Tests/OpenSim.Capabilities.Handlers.Tests.csproj +++ b/Tests/OpenSim.Capabilities.Handlers.Tests/OpenSim.Capabilities.Handlers.Tests.csproj @@ -33,10 +33,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Clients.Assets.Tests/OpenSim.Tests.Clients.AssetClient.csproj b/Tests/OpenSim.Clients.Assets.Tests/OpenSim.Tests.Clients.AssetClient.csproj index a19fb3d92e7..9a9ca721e8f 100644 --- a/Tests/OpenSim.Clients.Assets.Tests/OpenSim.Tests.Clients.AssetClient.csproj +++ b/Tests/OpenSim.Clients.Assets.Tests/OpenSim.Tests.Clients.AssetClient.csproj @@ -22,10 +22,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Data.Tests/OpenSim.Data.Tests.csproj b/Tests/OpenSim.Data.Tests/OpenSim.Data.Tests.csproj index 68ce3f5b6f1..08a189e11a0 100644 --- a/Tests/OpenSim.Data.Tests/OpenSim.Data.Tests.csproj +++ b/Tests/OpenSim.Data.Tests/OpenSim.Data.Tests.csproj @@ -29,10 +29,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Framework.Serialization.Tests/OpenSim.Framework.Serialization.Tests.csproj b/Tests/OpenSim.Framework.Serialization.Tests/OpenSim.Framework.Serialization.Tests.csproj index 0440e724b28..36462871ea6 100644 --- a/Tests/OpenSim.Framework.Serialization.Tests/OpenSim.Framework.Serialization.Tests.csproj +++ b/Tests/OpenSim.Framework.Serialization.Tests/OpenSim.Framework.Serialization.Tests.csproj @@ -28,10 +28,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Framework.Servers.Tests/OpenSim.Framework.Servers.Tests.csproj b/Tests/OpenSim.Framework.Servers.Tests/OpenSim.Framework.Servers.Tests.csproj index 8bbf9b176b9..f83046226fe 100644 --- a/Tests/OpenSim.Framework.Servers.Tests/OpenSim.Framework.Servers.Tests.csproj +++ b/Tests/OpenSim.Framework.Servers.Tests/OpenSim.Framework.Servers.Tests.csproj @@ -15,10 +15,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Framework.Tests/AgentCircuitDataTest.cs b/Tests/OpenSim.Framework.Tests/AgentCircuitDataTest.cs index ccec95bb1d5..0e25d189bd7 100644 --- a/Tests/OpenSim.Framework.Tests/AgentCircuitDataTest.cs +++ b/Tests/OpenSim.Framework.Tests/AgentCircuitDataTest.cs @@ -259,24 +259,24 @@ public void HistoricalAgentCircuitDataOSDConversion() AgentCircuitData Agent2Data = new AgentCircuitData(); Agent2Data.UnpackAgentCircuitData(map2); - Assert.True((Agent1Data.AgentID == Agent2Data.AgentID)); - Assert.True((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); - - Assert.True((Agent1Data.CapsPath == Agent2Data.CapsPath)); - Assert.True((Agent1Data.child == Agent2Data.child)); - Assert.True((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); - Assert.True((Agent1Data.circuitcode == Agent2Data.circuitcode)); - Assert.True((Agent1Data.firstname == Agent2Data.firstname)); - Assert.True((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); - Assert.True((Agent1Data.lastname == Agent2Data.lastname)); - Assert.True((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); - Assert.True((Agent1Data.SessionID == Agent2Data.SessionID)); - Assert.True((Agent1Data.startpos == Agent2Data.startpos)); + Assert.Equals(Agent1Data.AgentID, Agent2Data.AgentID); + Assert.Equals(Agent1Data.BaseFolder, Agent2Data.BaseFolder); + + Assert.Equals(Agent1Data.CapsPath, Agent2Data.CapsPath); + Assert.Equals(Agent1Data.child, Agent2Data.child); + Assert.Equals(Agent1Data.ChildrenCapSeeds.Count, Agent2Data.ChildrenCapSeeds.Count); + Assert.Equals(Agent1Data.circuitcode, Agent2Data.circuitcode); + Assert.Equals(Agent1Data.firstname, Agent2Data.firstname); + Assert.Equals(Agent1Data.InventoryFolder, Agent2Data.InventoryFolder); + Assert.Equals(Agent1Data.lastname, Agent2Data.lastname); + Assert.Equals(Agent1Data.SecureSessionID, Agent2Data.SecureSessionID); + Assert.Equals(Agent1Data.SessionID, Agent2Data.SessionID); + Assert.Equals(Agent1Data.startpos, Agent2Data.startpos); } catch (LitJson.JsonException) { //intermittant litjson errors :P - Assert.True(1 == 1); + Assert.Equals(1,1); } /* Enable this once VisualParams go in the packing method @@ -319,26 +319,26 @@ public void TestAgentCircuitDataOSDConversion() { //spurious litjson errors :P map2 = map; - Assert.True(1==1); + Assert.Equals(1,1); return; } AgentCircuitData Agent2Data = new AgentCircuitData(); Agent2Data.UnpackAgentCircuitData(map2); - Assert.True((Agent1Data.AgentID == Agent2Data.AgentID)); - Assert.True((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); - - Assert.True((Agent1Data.CapsPath == Agent2Data.CapsPath)); - Assert.True((Agent1Data.child == Agent2Data.child)); - Assert.True((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); - Assert.True((Agent1Data.circuitcode == Agent2Data.circuitcode)); - Assert.True((Agent1Data.firstname == Agent2Data.firstname)); - Assert.True((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); - Assert.True((Agent1Data.lastname == Agent2Data.lastname)); - Assert.True((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); - Assert.True((Agent1Data.SessionID == Agent2Data.SessionID)); - Assert.True((Agent1Data.startpos == Agent2Data.startpos)); + Assert.Equals(Agent1Data.AgentID, Agent2Data.AgentID); + Assert.Equals(Agent1Data.BaseFolder, Agent2Data.BaseFolder); + + Assert.Equals(Agent1Data.CapsPath, Agent2Data.CapsPath); + Assert.Equals(Agent1Data.child, Agent2Data.child); + Assert.Equals(Agent1Data.ChildrenCapSeeds.Count, Agent2Data.ChildrenCapSeeds.Count); + Assert.Equals(Agent1Data.circuitcode, Agent2Data.circuitcode); + Assert.Equals(Agent1Data.firstname, Agent2Data.firstname); + Assert.Equals(Agent1Data.InventoryFolder, Agent2Data.InventoryFolder); + Assert.Equals(Agent1Data.lastname, Agent2Data.lastname); + Assert.Equals(Agent1Data.SecureSessionID, Agent2Data.SecureSessionID); + Assert.Equals(Agent1Data.SessionID, Agent2Data.SessionID); + Assert.Equals(Agent1Data.startpos, Agent2Data.startpos); /* Enable this once VisualParams go in the packing method diff --git a/Tests/OpenSim.Framework.Tests/AgentCircuitManagerTests.cs b/Tests/OpenSim.Framework.Tests/AgentCircuitManagerTests.cs index de627d33165..419173a8a11 100644 --- a/Tests/OpenSim.Framework.Tests/AgentCircuitManagerTests.cs +++ b/Tests/OpenSim.Framework.Tests/AgentCircuitManagerTests.cs @@ -113,19 +113,19 @@ public void AddAgentCircuitTest() agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode1); - Assert.True((m_agentCircuitData1.AgentID == agent.AgentID)); - Assert.True((m_agentCircuitData1.BaseFolder == agent.BaseFolder)); - - Assert.True((m_agentCircuitData1.CapsPath == agent.CapsPath)); - Assert.True((m_agentCircuitData1.child == agent.child)); - Assert.True((m_agentCircuitData1.ChildrenCapSeeds.Count == agent.ChildrenCapSeeds.Count)); - Assert.True((m_agentCircuitData1.circuitcode == agent.circuitcode)); - Assert.True((m_agentCircuitData1.firstname == agent.firstname)); - Assert.True((m_agentCircuitData1.InventoryFolder == agent.InventoryFolder)); - Assert.True((m_agentCircuitData1.lastname == agent.lastname)); - Assert.True((m_agentCircuitData1.SecureSessionID == agent.SecureSessionID)); - Assert.True((m_agentCircuitData1.SessionID == agent.SessionID)); - Assert.True((m_agentCircuitData1.startpos == agent.startpos)); + Assert.That(m_agentCircuitData1.AgentID, Is.EqualTo(agent.AgentID)); + Assert.That(m_agentCircuitData1.BaseFolder, Is.EqualTo(agent.BaseFolder)); + + Assert.That(m_agentCircuitData1.CapsPath, Is.EqualTo(agent.CapsPath)); + Assert.That(m_agentCircuitData1.child, Is.EqualTo(agent.child)); + Assert.That(m_agentCircuitData1.ChildrenCapSeeds, Is.EqualTo(agent.ChildrenCapSeeds)); + Assert.That(m_agentCircuitData1.circuitcode, Is.EqualTo(agent.circuitcode)); + Assert.That(m_agentCircuitData1.firstname, Is.EqualTo(agent.firstname)); + Assert.That(m_agentCircuitData1.InventoryFolder, Is.EqualTo(agent.InventoryFolder)); + Assert.That(m_agentCircuitData1.lastname, Is.EqualTo(agent.lastname)); + Assert.That(m_agentCircuitData1.SecureSessionID, Is.EqualTo(agent.SecureSessionID)); + Assert.That(m_agentCircuitData1.SessionID, Is.EqualTo(agent.SessionID)); + Assert.That(m_agentCircuitData1.startpos, Is.EqualTo(agent.startpos)); } /// @@ -135,12 +135,13 @@ public void AddAgentCircuitTest() public void RemoveAgentCircuitTest() { AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); + agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); agentCircuitManager.RemoveCircuit(circuitcode2); AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode2); - Assert.True(agent == null); + Assert.That(agent, Is.EqualTo(null)); } @@ -160,9 +161,9 @@ public void ChangeAgentCircuitCodeTest() AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(393930); AgentCircuitData agent2 = agentCircuitManager.GetAgentCircuitData(circuitcode1); - Assert.True(agent != null); - Assert.True(agent2 == null); - Assert.True(result); + Assert.That(agent != null); + Assert.That(agent2 == null); + Assert.That(result); } @@ -180,25 +181,25 @@ public void ValidateLoginTest() // should be authorized AuthenticateResponse resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode1); - Assert.True(resp.Authorised); + Assert.That(resp.Authorised); //should not be authorized resp = agentCircuitManager.AuthenticateSession(SessionId1, UUID.Random(), circuitcode1); - Assert.True(!resp.Authorised); + Assert.That(!resp.Authorised); resp = agentCircuitManager.AuthenticateSession(UUID.Random(), AgentId1, circuitcode1); - Assert.True(!resp.Authorised); + Assert.That(!resp.Authorised); resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode2); - Assert.True(!resp.Authorised); + Assert.That(!resp.Authorised); resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId1, circuitcode2); - Assert.True(!resp.Authorised); + Assert.That(!resp.Authorised); agentCircuitManager.RemoveCircuit(circuitcode2); resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); - Assert.True(!resp.Authorised); + Assert.That(!resp.Authorised); } } } diff --git a/Tests/OpenSim.Framework.Tests/AnimationTests.cs b/Tests/OpenSim.Framework.Tests/AnimationTests.cs index 759120366ff..23e9cb764de 100644 --- a/Tests/OpenSim.Framework.Tests/AnimationTests.cs +++ b/Tests/OpenSim.Framework.Tests/AnimationTests.cs @@ -63,31 +63,31 @@ public void Dispose() [Test] public void AnimationOSDTest() { - Assert.True(anim1.AnimID==animUUID1 && anim1.ObjectID == objUUID1 && anim1.SequenceNum ==1, "The Animation Constructor didn't set the fields correctly"); + Assert.That(anim1.AnimID==animUUID1 && anim1.ObjectID == objUUID1 && anim1.SequenceNum ==1, "The Animation Constructor didn't set the fields correctly"); OSD updateMessage = anim1.PackUpdateMessage(); - Assert.True(updateMessage is OSDMap, "Packed UpdateMessage isn't an OSDMap"); + Assert.That(updateMessage is OSDMap, "Packed UpdateMessage isn't an OSDMap"); OSDMap updateMap = (OSDMap) updateMessage; - Assert.True(updateMap.ContainsKey("animation"), "Packed Message doesn't contain an animation element"); - Assert.True(updateMap.ContainsKey("object_id"), "Packed Message doesn't contain an object_id element"); - Assert.True(updateMap.ContainsKey("seq_num"), "Packed Message doesn't contain a seq_num element"); - Assert.True(updateMap["animation"].AsUUID() == animUUID1); - Assert.True(updateMap["object_id"].AsUUID() == objUUID1); - Assert.True(updateMap["seq_num"].AsInteger() == 1); + Assert.That(updateMap.ContainsKey("animation"), "Packed Message doesn't contain an animation element"); + Assert.That(updateMap.ContainsKey("object_id"), "Packed Message doesn't contain an object_id element"); + Assert.That(updateMap.ContainsKey("seq_num"), "Packed Message doesn't contain a seq_num element"); + Assert.That(updateMap["animation"].AsUUID() == animUUID1); + Assert.That(updateMap["object_id"].AsUUID() == objUUID1); + Assert.That(updateMap["seq_num"].AsInteger() == 1); Animation anim3 = new Animation(updateMap); - Assert.True(anim3.ObjectID == anim1.ObjectID && anim3.AnimID == anim1.AnimID && anim3.SequenceNum == anim1.SequenceNum, "OSDMap Constructor failed to set the properties correctly."); + Assert.That(anim3.ObjectID == anim1.ObjectID && anim3.AnimID == anim1.AnimID && anim3.SequenceNum == anim1.SequenceNum, "OSDMap Constructor failed to set the properties correctly."); anim3.UnpackUpdateMessage(anim2.PackUpdateMessage()); - Assert.True(anim3.ObjectID == objUUID2 && anim3.AnimID == animUUID2 && anim3.SequenceNum == 1, "Animation.UnpackUpdateMessage failed to set the properties correctly."); + Assert.That(anim3.ObjectID == objUUID2 && anim3.AnimID == animUUID2 && anim3.SequenceNum == 1, "Animation.UnpackUpdateMessage failed to set the properties correctly."); Animation anim4 = new Animation(); anim4.AnimID = anim2.AnimID; anim4.ObjectID = anim2.ObjectID; anim4.SequenceNum = anim2.SequenceNum; - Assert.True(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); + Assert.That(anim4.ObjectID == objUUID2 && anim4.AnimID == animUUID2 && anim4.SequenceNum == 1, "void constructor and manual field population failed to set the properties correctly."); } } } \ No newline at end of file diff --git a/Tests/OpenSim.Framework.Tests/AssetBaseTest.cs b/Tests/OpenSim.Framework.Tests/AssetBaseTest.cs index 029af9cabb9..5fa885a3f75 100644 --- a/Tests/OpenSim.Framework.Tests/AssetBaseTest.cs +++ b/Tests/OpenSim.Framework.Tests/AssetBaseTest.cs @@ -69,7 +69,7 @@ private void CheckContainsReferences(AssetType assetType, bool expected) { AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero.ToString()); bool actual = asset.ContainsReferences; - Assert.True(expected == actual, $"Expected {assetType}.ContainsReferences to be {expected} but was {actual}."); + Assert.That(expected == actual, $"Expected {assetType}.ContainsReferences to be {expected} but was {actual}."); } } } diff --git a/Tests/OpenSim.Framework.Tests/CacheTests.cs b/Tests/OpenSim.Framework.Tests/CacheTests.cs index f879c13aa36..043e3821226 100644 --- a/Tests/OpenSim.Framework.Tests/CacheTests.cs +++ b/Tests/OpenSim.Framework.Tests/CacheTests.cs @@ -62,8 +62,8 @@ public void TestRetreive() { CacheItemBase citem = (CacheItemBase)cache.Get(cacheItemUUID.ToString()); byte[] data = (byte[]) citem.Retrieve(); - Assert.True(data.Length == 1, "Cached Item should have one byte element"); - Assert.True(data[0] == 255, "Cached Item element should be 255"); + Assert.That(data.Length == 1, "Cached Item should have one byte element"); + Assert.That(data[0] == 255, "Cached Item element should be 255"); } [Test] @@ -75,7 +75,7 @@ public void TestNotInCache() randomNotIn = UUID.Random(); } object citem = cache.Get(randomNotIn.ToString()); - Assert.True(citem == null, "Item should not be in Cache"); + Assert.That(citem == null, "Item should not be in Cache"); } @@ -91,7 +91,7 @@ public void ExpireItemManually() cache.Invalidate(cacheItemUUID.ToString()); cache.Get(cacheItemUUID.ToString()); object citem = cache.Get(cacheItemUUID.ToString()); - Assert.True(citem == null, "Item should not be in Cache because we manually invalidated it"); + Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); } [Test] @@ -106,7 +106,7 @@ public void ClearCacheTest() cache.Clear(); object citem = cache.Get(cacheItemUUID.ToString()); - Assert.True(citem == null, "Item should not be in Cache because we manually invalidated it"); + Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); } [Test] @@ -121,10 +121,10 @@ public void CacheItemMundane() cb1.Store(data); - Assert.True(cb1.Equals(cb3), "cb1 should equal cb3, their uuids are the same"); - Assert.True(!cb2.Equals(cb1), "cb2 should not equal cb1, their uuids are NOT the same"); - Assert.True(cb1.IsLocked() == false, "CacheItemBase default is false"); - Assert.True(cb1.Retrieve() == null, "Virtual Retrieve method should return null"); + Assert.That(cb1.Equals(cb3), "cb1 should equal cb3, their uuids are the same"); + Assert.That(!cb2.Equals(cb1), "cb2 should not equal cb1, their uuids are NOT the same"); + Assert.That(cb1.IsLocked() == false, "CacheItemBase default is false"); + Assert.That(cb1.Retrieve() == null, "Virtual Retrieve method should return null"); } } } diff --git a/Tests/OpenSim.Framework.Tests/LocationTest.cs b/Tests/OpenSim.Framework.Tests/LocationTest.cs index b8e6632967e..9ba52468245 100644 --- a/Tests/OpenSim.Framework.Tests/LocationTest.cs +++ b/Tests/OpenSim.Framework.Tests/LocationTest.cs @@ -37,11 +37,11 @@ public void locationRegionHandleRegionHandle() // 256000 Location TestLocation1 = new Location(1099511628032000); Location TestLocation2 = new Location(1099511628032000); - Assert.True(TestLocation1 == TestLocation2); + Assert.That(TestLocation1 == TestLocation2); TestLocation1 = new Location(1099511628032001); TestLocation2 = new Location(1099511628032000); - Assert.True(TestLocation1 != TestLocation2); + Assert.That(TestLocation1 != TestLocation2); } [Test] @@ -49,36 +49,36 @@ public void locationXYRegionHandle() { Location TestLocation1 = new Location(255000,256000); Location TestLocation2 = new Location(1095216660736000); - Assert.True(TestLocation1 == TestLocation2); + Assert.That(TestLocation1 == TestLocation2); - Assert.True(TestLocation1.X == 255000 && TestLocation1.Y == 256000, "Test xy location doesn't match position in the constructor"); - Assert.True(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); + Assert.That(TestLocation1.X == 255000 && TestLocation1.Y == 256000, "Test xy location doesn't match position in the constructor"); + Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); - Assert.True(TestLocation2.RegionHandle == 1095216660736000, + Assert.That(TestLocation2.RegionHandle == 1095216660736000, "Location RegionHandle Property didn't match regionhandle provided in constructor"); ulong RegionHandle = TestLocation1.RegionHandle; - Assert.True(RegionHandle.Equals(1095216660736000), "Equals(regionhandle) failed to match the position in the constructor"); + Assert.That(RegionHandle.Equals(1095216660736000), "Equals(regionhandle) failed to match the position in the constructor"); TestLocation2 = new Location(RegionHandle); - Assert.True(TestLocation2.Equals(255000, 256000), "Decoded regionhandle failed to match the original position in the constructor"); + Assert.That(TestLocation2.Equals(255000, 256000), "Decoded regionhandle failed to match the original position in the constructor"); TestLocation1 = new Location(255001, 256001); TestLocation2 = new Location(1095216660736000); - Assert.True(TestLocation1 != TestLocation2); + Assert.That(TestLocation1 != TestLocation2); - Assert.True(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor"); + Assert.That(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor"); - Assert.True(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); + Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); Location TestLocation3; object cln = TestLocation2.Clone(); TestLocation3 = (Location) cln; - Assert.True(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y, + Assert.That(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y, "Cloned Location values do not match"); - Assert.True(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test"); + Assert.That(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test"); } } diff --git a/Tests/OpenSim.Framework.Tests/MundaneFrameworkTests.cs b/Tests/OpenSim.Framework.Tests/MundaneFrameworkTests.cs index dddc7023928..d35e10f4337 100644 --- a/Tests/OpenSim.Framework.Tests/MundaneFrameworkTests.cs +++ b/Tests/OpenSim.Framework.Tests/MundaneFrameworkTests.cs @@ -39,7 +39,7 @@ public void ChildAgentDataUpdate01() { // code coverage ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); - Assert.False(cadu.alwaysrun, "Default is false"); + Assert.That(cadu.alwaysrun is false, "Default is false"); } [Test] @@ -93,7 +93,7 @@ public void AgentPositionTest01() AgentPosition position2 = new AgentPosition(); position2.CopyFrom(cadu, position1.SessionID); - Assert.True( + Assert.That( position2.AgentID == position1.AgentID && position2.Size == position1.Size && position2.Position == position1.Position @@ -105,22 +105,22 @@ public void AgentPositionTest01() position2 = new AgentPosition(); - Assert.False(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition"); + Assert.That((position2.AgentID == position1.AgentID) is false, "Test Error, position2 should be a blank uninitialized AgentPosition"); EntityTransferContext ctx = new EntityTransferContext(); position2.Unpack(position1.Pack(ctx), null, ctx); - Assert.True(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed"); - Assert.True(position2.Position == position1.Position, "Position didn't unpack the same way it packed"); - Assert.True(position2.Velocity == position1.Velocity, "Velocity didn't unpack the same way it packed"); - Assert.True(position2.SessionID == position1.SessionID, "SessionID didn't unpack the same way it packed"); - Assert.True(position2.CircuitCode == position1.CircuitCode, "CircuitCode didn't unpack the same way it packed"); - Assert.True(position2.LeftAxis == position1.LeftAxis, "LeftAxis didn't unpack the same way it packed"); - Assert.True(position2.UpAxis == position1.UpAxis, "UpAxis didn't unpack the same way it packed"); - Assert.True(position2.AtAxis == position1.AtAxis, "AtAxis didn't unpack the same way it packed"); - Assert.True(position2.RegionHandle == position1.RegionHandle, "RegionHandle didn't unpack the same way it packed"); - Assert.True(position2.ChangedGrid == position1.ChangedGrid, "ChangedGrid didn't unpack the same way it packed"); - Assert.True(position2.Center == position1.Center, "Center didn't unpack the same way it packed"); - Assert.True(position2.Size == position1.Size, "Size didn't unpack the same way it packed"); + Assert.That(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed"); + Assert.That(position2.Position == position1.Position, "Position didn't unpack the same way it packed"); + Assert.That(position2.Velocity == position1.Velocity, "Velocity didn't unpack the same way it packed"); + Assert.That(position2.SessionID == position1.SessionID, "SessionID didn't unpack the same way it packed"); + Assert.That(position2.CircuitCode == position1.CircuitCode, "CircuitCode didn't unpack the same way it packed"); + Assert.That(position2.LeftAxis == position1.LeftAxis, "LeftAxis didn't unpack the same way it packed"); + Assert.That(position2.UpAxis == position1.UpAxis, "UpAxis didn't unpack the same way it packed"); + Assert.That(position2.AtAxis == position1.AtAxis, "AtAxis didn't unpack the same way it packed"); + Assert.That(position2.RegionHandle == position1.RegionHandle, "RegionHandle didn't unpack the same way it packed"); + Assert.That(position2.ChangedGrid == position1.ChangedGrid, "ChangedGrid didn't unpack the same way it packed"); + Assert.That(position2.Center == position1.Center, "Center didn't unpack the same way it packed"); + Assert.That(position2.Size == position1.Size, "Size didn't unpack the same way it packed"); } [Test] @@ -136,7 +136,7 @@ public void RegionSettingsTest01() // string id = settings.LoadedCreationID; // string time = settings.LoadedCreationTime; - Assert.True(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire"); + Assert.That(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire"); } @@ -149,19 +149,19 @@ internal void RegionSaveFired(RegionSettings settings) public void InventoryItemBaseConstructorTest01() { InventoryItemBase b1 = new InventoryItemBase(); - Assert.True(b1.ID == UUID.Zero, "void constructor should create an inventory item with ID = UUID.Zero"); - Assert.True(b1.Owner == UUID.Zero, "void constructor should create an inventory item with Owner = UUID.Zero"); + Assert.That(b1.ID == UUID.Zero, "void constructor should create an inventory item with ID = UUID.Zero"); + Assert.That(b1.Owner == UUID.Zero, "void constructor should create an inventory item with Owner = UUID.Zero"); UUID ItemID = UUID.Random(); UUID OwnerID = UUID.Random(); InventoryItemBase b2 = new InventoryItemBase(ItemID); - Assert.True(b2.ID == ItemID, "ID constructor should create an inventory item with ID = ItemID"); - Assert.True(b2.Owner == UUID.Zero, "ID constructor should create an inventory item with Owner = UUID.Zero"); + Assert.That(b2.ID == ItemID, "ID constructor should create an inventory item with ID = ItemID"); + Assert.That(b2.Owner == UUID.Zero, "ID constructor should create an inventory item with Owner = UUID.Zero"); InventoryItemBase b3 = new InventoryItemBase(ItemID,OwnerID); - Assert.True(b3.ID == ItemID, "ID,OwnerID constructor should create an inventory item with ID = ItemID"); - Assert.True(b3.Owner == OwnerID, "ID,OwnerID constructor should create an inventory item with Owner = OwnerID"); + Assert.That(b3.ID == ItemID, "ID,OwnerID constructor should create an inventory item with ID = ItemID"); + Assert.That(b3.Owner == OwnerID, "ID,OwnerID constructor should create an inventory item with Owner = OwnerID"); } @@ -170,11 +170,11 @@ public void AssetMetaDataNonNullContentTypeTest01() { AssetMetadata assetMetadata = new AssetMetadata(); assetMetadata.ContentType = "image/jp2"; - Assert.True(assetMetadata.Type == (sbyte)AssetType.Texture, "Content type should be AssetType.Texture"); - Assert.True(assetMetadata.ContentType == "image/jp2", "Text of content type should be image/jp2"); + Assert.That(assetMetadata.Type == (sbyte)AssetType.Texture, "Content type should be AssetType.Texture"); + Assert.That(assetMetadata.ContentType == "image/jp2", "Text of content type should be image/jp2"); UUID rndID = UUID.Random(); assetMetadata.ID = rndID.ToString(); - Assert.True(assetMetadata.ID.ToLower() == rndID.ToString().ToLower(), "assetMetadata.ID Setter/Getter not Consistent"); + Assert.That(assetMetadata.ID.ToLower() == rndID.ToString().ToLower(), "assetMetadata.ID Setter/Getter not Consistent"); DateTime fixedTime = DateTime.Now; assetMetadata.CreationDate = fixedTime; } @@ -191,39 +191,39 @@ public void EstateSettingsMundateTests() BannedHostNameMask = string.Empty, BannedUserID = bannedUserId} ); - Assert.True(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); - Assert.False(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); + Assert.That(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); + Assert.That(es.IsBanned(UUID.Zero, 32) is false, "User Should not be banned but is."); es.RemoveBan(bannedUserId); - Assert.False(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); + Assert.That(es.IsBanned(bannedUserId, 32) is false, "User Should not be banned but is."); es.AddEstateManager(UUID.Zero); es.AddEstateManager(bannedUserId); - Assert.True(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't."); + Assert.That(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't."); es.RemoveEstateManager(bannedUserId); - Assert.False(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserID is estateManager but shouldn't be"); + Assert.That(es.IsEstateManagerOrOwner(bannedUserId) is false, "bannedUserID is estateManager but shouldn't be"); - Assert.False(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't"); + Assert.That(es.HasAccess(bannedUserId) is false, "bannedUserID has access but shouldn't"); es.AddEstateUser(bannedUserId); - Assert.True(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); + Assert.That(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); es.RemoveEstateUser(bannedUserId); es.AddEstateManager(bannedUserId); - Assert.True(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); + Assert.That(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); - Assert.True(es.EstateGroups.Length == 0, "No Estate Groups Added.. so the array should be 0 length"); + Assert.That(es.EstateGroups.Length == 0, "No Estate Groups Added.. so the array should be 0 length"); es.AddEstateGroup(bannedUserId); - Assert.True(es.EstateGroups.Length == 1, "1 Estate Groups Added.. so the array should be 1 length"); + Assert.That(es.EstateGroups.Length == 1, "1 Estate Groups Added.. so the array should be 1 length"); - Assert.True(es.EstateGroups[0] == bannedUserId,"User ID should be in EstateGroups"); + Assert.That(es.EstateGroups[0] == bannedUserId,"User ID should be in EstateGroups"); } @@ -234,30 +234,30 @@ public void InventoryFolderBaseConstructorTest01() UUID uuid2 = UUID.Random(); InventoryFolderBase fld = new InventoryFolderBase(uuid1); - Assert.True(fld.ID == uuid1, "ID constructor failed to save value in ID field."); + Assert.That(fld.ID == uuid1, "ID constructor failed to save value in ID field."); fld = new InventoryFolderBase(uuid1, uuid2); - Assert.True(fld.ID == uuid1, "ID,Owner constructor failed to save value in ID field."); - Assert.True(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); + Assert.That(fld.ID == uuid1, "ID,Owner constructor failed to save value in ID field."); + Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); } [Test] public void AsssetBaseConstructorTest01() { AssetBase abase = new AssetBase(); - Assert.True(abase.Metadata != null, "void constructor of AssetBase should have created a MetaData element but didn't."); + Assert.That(abase.Metadata != null, "void constructor of AssetBase should have created a MetaData element but didn't."); UUID itemID = UUID.Random(); UUID creatorID = UUID.Random(); abase = new AssetBase(itemID.ToString(), "test item", (sbyte) AssetType.Texture, creatorID.ToString()); - Assert.True(abase.Metadata != null, "string,string,sbyte,string constructor of AssetBase should have created a MetaData element but didn't."); - Assert.True(abase.ID == itemID.ToString(), "string,string,sbyte,string constructor failed to set ID property"); - Assert.True(abase.Metadata.CreatorID == creatorID.ToString(), "string,string,sbyte,string constructor failed to set Creator ID"); + Assert.That(abase.Metadata != null, "string,string,sbyte,string constructor of AssetBase should have created a MetaData element but didn't."); + Assert.That(abase.ID == itemID.ToString(), "string,string,sbyte,string constructor failed to set ID property"); + Assert.That(abase.Metadata.CreatorID == creatorID.ToString(), "string,string,sbyte,string constructor failed to set Creator ID"); abase = new AssetBase(itemID.ToString(), "test item", -1, creatorID.ToString()); - Assert.True(abase.Metadata != null, "string,string,sbyte,string constructor of AssetBase with unknown type should have created a MetaData element but didn't."); - Assert.True(abase.Metadata.Type == -1, "Unknown Type passed to string,string,sbyte,string constructor and was a known type when it came out again"); + Assert.That(abase.Metadata != null, "string,string,sbyte,string constructor of AssetBase with unknown type should have created a MetaData element but didn't."); + Assert.That(abase.Metadata.Type == -1, "Unknown Type passed to string,string,sbyte,string constructor and was a known type when it came out again"); AssetMetadata metts = new AssetMetadata(); metts.FullID = itemID; @@ -265,8 +265,8 @@ public void AsssetBaseConstructorTest01() metts.Name = "test item"; abase.Metadata = metts; - Assert.True(abase.ToString() == itemID.ToString(), "ToString is overriden to be fullID.ToString()"); - Assert.True(abase.ID == itemID.ToString(),"ID should be MetaData.FullID.ToString() when string.empty or null is provided to the ID property"); + Assert.That(abase.ToString() == itemID.ToString(), "ToString is overriden to be fullID.ToString()"); + Assert.That(abase.ID == itemID.ToString(),"ID should be MetaData.FullID.ToString() when string.empty or null is provided to the ID property"); } [Test] @@ -274,7 +274,7 @@ public void CultureSetCultureTest01() { CultureInfo ci = new CultureInfo("en-US", false); Culture.SetCurrentCulture(); - Assert.True(Thread.CurrentThread.CurrentCulture.Name == ci.Name, "SetCurrentCulture failed to set thread culture to en-US"); + Assert.That(Thread.CurrentThread.CurrentCulture.Name == ci.Name, "SetCurrentCulture failed to set thread culture to en-US"); } } diff --git a/Tests/OpenSim.Framework.Tests/OpenSim.Framework.Tests.csproj b/Tests/OpenSim.Framework.Tests/OpenSim.Framework.Tests.csproj index 3b39bb5bbb7..30a35078fe4 100644 --- a/Tests/OpenSim.Framework.Tests/OpenSim.Framework.Tests.csproj +++ b/Tests/OpenSim.Framework.Tests/OpenSim.Framework.Tests.csproj @@ -28,10 +28,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Framework.Tests/PrimeNumberHelperTests.cs b/Tests/OpenSim.Framework.Tests/PrimeNumberHelperTests.cs index 7907a4a8f86..d199bc7cd67 100644 --- a/Tests/OpenSim.Framework.Tests/PrimeNumberHelperTests.cs +++ b/Tests/OpenSim.Framework.Tests/PrimeNumberHelperTests.cs @@ -33,11 +33,11 @@ public class PrimeNumberHelperTests public void TestGetPrime() { int prime1 = PrimeNumberHelper.GetPrime(7919); - Assert.True(prime1 == 8419, "Prime Number Get Prime Failed, 7919 is prime"); - Assert.True(PrimeNumberHelper.IsPrime(prime1),"Prime1 should be prime"); - Assert.True(PrimeNumberHelper.IsPrime(7919), "7919 is prime but is falsely failing the prime test"); + Assert.That(prime1 == 8419, "Prime Number Get Prime Failed, 7919 is prime"); + Assert.That(PrimeNumberHelper.IsPrime(prime1),"Prime1 should be prime"); + Assert.That(PrimeNumberHelper.IsPrime(7919), "7919 is prime but is falsely failing the prime test"); prime1 = PrimeNumberHelper.GetPrime(Int32.MaxValue - 1); - Assert.True(prime1 == -1, "prime1 should have been -1 since there are no primes between Int32.MaxValue-1 and Int32.MaxValue"); + Assert.That(prime1 == -1, "prime1 should have been -1 since there are no primes between Int32.MaxValue-1 and Int32.MaxValue"); } @@ -113,7 +113,7 @@ public void Test1000SmallPrimeNumbers() }; for (int i = 0; i < primes.Length; i++) { - Assert.True(PrimeNumberHelper.IsPrime(primes[i]),primes[i] + " is prime but is erroniously failing the prime test"); + Assert.That(PrimeNumberHelper.IsPrime(primes[i]),primes[i] + " is prime but is erroniously failing the prime test"); } int[] nonprimes = { @@ -126,10 +126,10 @@ public void Test1000SmallPrimeNumbers() }; for (int i = 0; i < nonprimes.Length; i++) { - Assert.True(!PrimeNumberHelper.IsPrime(nonprimes[i]), nonprimes[i] + " is not prime but is erroniously passing the prime test"); + Assert.That(!PrimeNumberHelper.IsPrime(nonprimes[i]), nonprimes[i] + " is not prime but is erroniously passing the prime test"); } - Assert.True(PrimeNumberHelper.IsPrime(3)); + Assert.That(PrimeNumberHelper.IsPrime(3)); } } } \ No newline at end of file diff --git a/Tests/OpenSim.Framework.Tests/UtilTest.cs b/Tests/OpenSim.Framework.Tests/UtilTest.cs index 941de9b32aa..34d62beb823 100644 --- a/Tests/OpenSim.Framework.Tests/UtilTest.cs +++ b/Tests/OpenSim.Framework.Tests/UtilTest.cs @@ -138,15 +138,15 @@ public class UtilTests [Test] public void UUIDTests() { - Assert.True(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf"), + Assert.That(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf") is true, "A correct UUID wasn't recognized."); - Assert.False(Util.isUUID("FOOBAR67-89ab-Cdef-0123-456789AbCdEf"), + Assert.That(Util.isUUID("FOOBAR67-89ab-Cdef-0123-456789AbCdEf") is false, "UUIDs with non-hex characters are recognized as correct UUIDs."); - Assert.False(Util.isUUID("01234567"), + Assert.That(Util.isUUID("01234567") is false, "Too short UUIDs are recognized as correct UUIDs."); - Assert.False(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf0"), + Assert.That(Util.isUUID("01234567-89ab-Cdef-0123-456789AbCdEf0") is false, "Too long UUIDs are recognized as correct UUIDs."); - Assert.False(Util.isUUID("01234567-89ab-Cdef-0123+456789AbCdEf"), + Assert.That(Util.isUUID("01234567-89ab-Cdef-0123+456789AbCdEf") is false, "UUIDs with wrong format are recognized as correct UUIDs."); } @@ -157,8 +157,8 @@ public void GetHashGuidTests() string string2 = "This is another"; // Two consecutive runs should equal the same - Assert.AreEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret1")); - Assert.AreEqual(Util.GetHashGuid(string2, "secret1"), Util.GetHashGuid(string2, "secret1")); + Assert.That(Util.GetHashGuid(string1, "secret1"), Is.EqualTo(Util.GetHashGuid(string1, "secret1"))); + Assert.That(Util.GetHashGuid(string2, "secret1"), Is.EqualTo(Util.GetHashGuid(string2, "secret1"))); // Varying data should not eqal the same Assert.That(Util.GetHashGuid(string2, "secret1"), Is.Not.EqualTo(Util.GetHashGuid(string1, "secret1"))); @@ -198,7 +198,7 @@ public void SLUtilTypeConvertTests() for (int i=0;i - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Permissions.Tests/OpenSim.Tests.Permissions.csproj b/Tests/OpenSim.Permissions.Tests/OpenSim.Tests.Permissions.csproj index 2eacf2224dd..e50e201115e 100644 --- a/Tests/OpenSim.Permissions.Tests/OpenSim.Tests.Permissions.csproj +++ b/Tests/OpenSim.Permissions.Tests/OpenSim.Tests.Permissions.csproj @@ -25,10 +25,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.ClientStack.LindenCaps.Tests/OpenSim.Region.ClientStack.LindenCaps.Tests.csproj b/Tests/OpenSim.Region.ClientStack.LindenCaps.Tests/OpenSim.Region.ClientStack.LindenCaps.Tests.csproj index e1a94725bf7..ff45cf51ecc 100644 --- a/Tests/OpenSim.Region.ClientStack.LindenCaps.Tests/OpenSim.Region.ClientStack.LindenCaps.Tests.csproj +++ b/Tests/OpenSim.Region.ClientStack.LindenCaps.Tests/OpenSim.Region.ClientStack.LindenCaps.Tests.csproj @@ -36,10 +36,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.ClientStack.LindenUDP.Tests/OpenSim.Region.ClientStack.LindenUDP.Tests.csproj b/Tests/OpenSim.Region.ClientStack.LindenUDP.Tests/OpenSim.Region.ClientStack.LindenUDP.Tests.csproj index d8b89971d95..ed1fe0a67d0 100644 --- a/Tests/OpenSim.Region.ClientStack.LindenUDP.Tests/OpenSim.Region.ClientStack.LindenUDP.Tests.csproj +++ b/Tests/OpenSim.Region.ClientStack.LindenUDP.Tests/OpenSim.Region.ClientStack.LindenUDP.Tests.csproj @@ -29,10 +29,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.CoreModules.Tests/OpenSim.Region.CoreModules.Tests.csproj b/Tests/OpenSim.Region.CoreModules.Tests/OpenSim.Region.CoreModules.Tests.csproj index e82835b27d5..79477a809ae 100644 --- a/Tests/OpenSim.Region.CoreModules.Tests/OpenSim.Region.CoreModules.Tests.csproj +++ b/Tests/OpenSim.Region.CoreModules.Tests/OpenSim.Region.CoreModules.Tests.csproj @@ -45,10 +45,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.Framework.Tests/OpenSim.Region.Framework.Tests.csproj b/Tests/OpenSim.Region.Framework.Tests/OpenSim.Region.Framework.Tests.csproj index 1f46e6047be..ef3265347e7 100644 --- a/Tests/OpenSim.Region.Framework.Tests/OpenSim.Region.Framework.Tests.csproj +++ b/Tests/OpenSim.Region.Framework.Tests/OpenSim.Region.Framework.Tests.csproj @@ -39,10 +39,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.PhysicsModules.BulletS.Tests/OpenSim.Region.PhysicsModule.BulletS.Tests.csproj b/Tests/OpenSim.Region.PhysicsModules.BulletS.Tests/OpenSim.Region.PhysicsModule.BulletS.Tests.csproj index f6f56e2b478..a2b7b2d97fe 100644 --- a/Tests/OpenSim.Region.PhysicsModules.BulletS.Tests/OpenSim.Region.PhysicsModule.BulletS.Tests.csproj +++ b/Tests/OpenSim.Region.PhysicsModules.BulletS.Tests/OpenSim.Region.PhysicsModule.BulletS.Tests.csproj @@ -25,10 +25,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Region.ScriptEngine.Tests/OpenSim.Region.ScriptEngine.Tests.csproj b/Tests/OpenSim.Region.ScriptEngine.Tests/OpenSim.Region.ScriptEngine.Tests.csproj index bdbe5388eff..b6c2e0c2e2c 100644 --- a/Tests/OpenSim.Region.ScriptEngine.Tests/OpenSim.Region.ScriptEngine.Tests.csproj +++ b/Tests/OpenSim.Region.ScriptEngine.Tests/OpenSim.Region.ScriptEngine.Tests.csproj @@ -34,10 +34,16 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Robust.Tests/Robust.Tests.csproj b/Tests/OpenSim.Robust.Tests/Robust.Tests.csproj index 64c91f6cde6..01ee023499a 100644 --- a/Tests/OpenSim.Robust.Tests/Robust.Tests.csproj +++ b/Tests/OpenSim.Robust.Tests/Robust.Tests.csproj @@ -31,10 +31,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Server.Handlers.Tests/OpenSim.Server.Handlers.Tests.csproj b/Tests/OpenSim.Server.Handlers.Tests/OpenSim.Server.Handlers.Tests.csproj index 2478614e90e..c2704825dd9 100644 --- a/Tests/OpenSim.Server.Handlers.Tests/OpenSim.Server.Handlers.Tests.csproj +++ b/Tests/OpenSim.Server.Handlers.Tests/OpenSim.Server.Handlers.Tests.csproj @@ -36,10 +36,16 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Services.InventoryService.Tests/OpenSim.Services.InventoryService.Tests.csproj b/Tests/OpenSim.Services.InventoryService.Tests/OpenSim.Services.InventoryService.Tests.csproj index 65780e43de6..0b2165ebf0a 100644 --- a/Tests/OpenSim.Services.InventoryService.Tests/OpenSim.Services.InventoryService.Tests.csproj +++ b/Tests/OpenSim.Services.InventoryService.Tests/OpenSim.Services.InventoryService.Tests.csproj @@ -35,10 +35,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Stress.Tests/OpenSim.Tests.Stress.csproj b/Tests/OpenSim.Stress.Tests/OpenSim.Tests.Stress.csproj index 1b9a8a64baf..a86bce7e268 100644 --- a/Tests/OpenSim.Stress.Tests/OpenSim.Tests.Stress.csproj +++ b/Tests/OpenSim.Stress.Tests/OpenSim.Tests.Stress.csproj @@ -37,10 +37,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Tests.Common/OpenSim.Tests.Common.csproj b/Tests/OpenSim.Tests.Common/OpenSim.Tests.Common.csproj index 1b349d3bc3a..0bd094a0006 100644 --- a/Tests/OpenSim.Tests.Common/OpenSim.Tests.Common.csproj +++ b/Tests/OpenSim.Tests.Common/OpenSim.Tests.Common.csproj @@ -38,10 +38,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Tests/OpenSim.Tests/OpenSim.Tests.csproj b/Tests/OpenSim.Tests/OpenSim.Tests.csproj index d3067243a43..84181b23cfc 100644 --- a/Tests/OpenSim.Tests/OpenSim.Tests.csproj +++ b/Tests/OpenSim.Tests/OpenSim.Tests.csproj @@ -11,10 +11,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ThirdParty/SmartThreadPool/CanceledWorkItemsGroup.cs b/ThirdParty/SmartThreadPool/CanceledWorkItemsGroup.cs deleted file mode 100644 index 6eb7b88e565..00000000000 --- a/ThirdParty/SmartThreadPool/CanceledWorkItemsGroup.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Amib.Threading.Internal -{ - internal class CanceledWorkItemsGroup - { - public readonly static CanceledWorkItemsGroup NotCanceledWorkItemsGroup = new(); - - public CanceledWorkItemsGroup() - { - IsCanceled = false; - } - - public bool IsCanceled { get; set; } - } -} \ No newline at end of file diff --git a/ThirdParty/SmartThreadPool/Exceptions.cs b/ThirdParty/SmartThreadPool/Exceptions.cs deleted file mode 100644 index 91f88d54b04..00000000000 --- a/ThirdParty/SmartThreadPool/Exceptions.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Amib.Threading -{ - #region Exceptions - - /// - /// Represents an exception in case IWorkItemResult.GetResult has been canceled - /// - public sealed partial class WorkItemCancelException : Exception - { - public WorkItemCancelException() - { - } - - public WorkItemCancelException(string message) - : base(message) - { - } - - public WorkItemCancelException(string message, Exception e) - : base(message, e) - { - } - } - - /// - /// Represents an exception in case IWorkItemResult.GetResult has been timed out - /// - public sealed partial class WorkItemTimeoutException : Exception - { - public WorkItemTimeoutException() - { - } - - public WorkItemTimeoutException(string message) - : base(message) - { - } - - public WorkItemTimeoutException(string message, Exception e) - : base(message, e) - { - } - } - - /// - /// Represents an exception in case IWorkItemResult.GetResult has been timed out - /// - public sealed partial class WorkItemResultException : Exception - { - public WorkItemResultException() - { - } - - public WorkItemResultException(string message) - : base(message) - { - } - - public WorkItemResultException(string message, Exception e) - : base(message, e) - { - } - } - #endregion -} diff --git a/ThirdParty/SmartThreadPool/Interfaces.cs b/ThirdParty/SmartThreadPool/Interfaces.cs deleted file mode 100644 index e709aa80c21..00000000000 --- a/ThirdParty/SmartThreadPool/Interfaces.cs +++ /dev/null @@ -1,517 +0,0 @@ -using System; -using System.Threading; - -namespace Amib.Threading -{ - #region Delegates - - /// - /// A delegate that represents the method to run as the work item - /// - /// A state object for the method to run - public delegate object WorkItemCallback(object state); - - /// - /// A delegate to call after the WorkItemCallback completed - /// - /// The work item result object - public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir); - - /// - /// A delegate to call after the WorkItemCallback completed - /// - /// The work item result object - public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir); - - /// - /// A delegate to call when a WorkItemsGroup becomes idle - /// - /// A reference to the WorkItemsGroup that became idle - public delegate void WorkItemsGroupIdleHandler(IWorkItemsGroup workItemsGroup); - - /// - /// A delegate to call after a thread is created, but before - /// it's first use. - /// - public delegate void ThreadInitializationHandler(); - - /// - /// A delegate to call when a thread is about to exit, after - /// it is no longer belong to the pool. - /// - public delegate void ThreadTerminationHandler(); - - #endregion - - #region IWorkItemsGroup interface - - /// - /// IWorkItemsGroup interface - /// Created by SmartThreadPool.CreateWorkItemsGroup() - /// - public interface IWorkItemsGroup - { - /// - /// Get/Set the name of the WorkItemsGroup - /// - string Name { get; set; } - - int localID { get; set; } - - /// - /// Get/Set the maximum number of workitem that execute cocurrency on the thread pool - /// - int Concurrency { get; set; } - - /// - /// Get the number of work items waiting in the queue. - /// - int WaitingCallbacks { get; } - - /// - /// Get an array with all the state objects of the currently running items. - /// The array represents a snap shot and impact performance. - /// - object[] GetStates(); - - /// - /// Get the WorkItemsGroup start information - /// - WIGStartInfo WIGStartInfo { get; } - - /// - /// Starts to execute work items - /// - void Start(); - - /// - /// Cancel all the work items. - /// Same as Cancel(false) - /// - void Cancel(); - - /// - /// Cancel all work items using thread abortion - /// - /// True to stop work items by raising ThreadAbortException - void Cancel(bool abortExecution); - - /// - /// Wait for all work item to complete. - /// - void WaitForIdle(); - - /// - /// Wait for all work item to complete, until timeout expired - /// - /// How long to wait for the work items to complete - /// Returns true if work items completed within the timeout, otherwise false. - bool WaitForIdle(TimeSpan timeout); - - /// - /// Wait for all work item to complete, until timeout expired - /// - /// How long to wait for the work items to complete in milliseconds - /// Returns true if work items completed within the timeout, otherwise false. - bool WaitForIdle(int millisecondsTimeout); - - /// - /// IsIdle is true when there are no work items running or queued. - /// - bool IsIdle { get; } - - /// - /// This event is fired when all work items are completed. - /// (When IsIdle changes to true) - /// This event only work on WorkItemsGroup. On SmartThreadPool - /// it throws the NotImplementedException. - /// - event WorkItemsGroupIdleHandler OnIdle; - - #region QueueWorkItem - - IWorkItemResult QueueWorkItem(WaitCallback callback); - IWorkItemResult QueueWorkItem(WaitCallback callback, object state); - IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback); - IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback, object state); - - /// - /// Queue a work item - /// - /// A callback to execute - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemCallback callback); - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state); - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback); - - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Indicates on which cases to call to the post execute callback - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state, PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute); - - /// - /// Queue a work item - /// - /// Work item info - /// A callback to execute - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback); - - /// - /// Queue a work item - /// - /// Work item information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item result - IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback, object state); - - #endregion - - #region QueueWorkItem(Action<...>) - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult object, but its GetResult() will always return null - IWorkItemResult QueueWorkItem(Action action); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult object, but its GetResult() will always return null - IWorkItemResult QueueWorkItem(Action action, T arg); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult object, but its GetResult() will always return null - IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult object, but its GetResult() will always return null - IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult object, but its GetResult() will always return null - IWorkItemResult QueueWorkItem(Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4); - - #endregion - - #region QueueWorkItem(Func<...>) - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult<TResult> object. - /// its GetResult() returns a TResult object - IWorkItemResult QueueWorkItem(Func func); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult<TResult> object. - /// its GetResult() returns a TResult object - IWorkItemResult QueueWorkItem(Func func, T arg); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult<TResult> object. - /// its GetResult() returns a TResult object - IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult<TResult> object. - /// its GetResult() returns a TResult object - IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2, T3 arg3); - - /// - /// Queue a work item. - /// - /// Returns a IWorkItemResult<TResult> object. - /// its GetResult() returns a TResult object - IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2, T3 arg3, T4 arg4); - - #endregion - } - - #endregion - - #region CallToPostExecute enumerator - - [Flags] - public enum CallToPostExecute - { - /// - /// Never call to the PostExecute call back - /// - Never = 0x00, - - /// - /// Call to the PostExecute only when the work item is cancelled - /// - WhenWorkItemCanceled = 0x01, - - /// - /// Call to the PostExecute only when the work item is not cancelled - /// - WhenWorkItemNotCanceled = 0x02, - - /// - /// Always call to the PostExecute - /// - Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled, - } - - #endregion - - #region IWorkItemResult interface - - /// - /// The common interface of IWorkItemResult and IWorkItemResult<T> - /// - public interface IWaitableResult - { - /// - /// This method intent is for internal use. - /// - /// - IWorkItemResult GetWorkItemResult(); - - /// - /// This method intent is for internal use. - /// - /// - IWorkItemResult GetWorkItemResultT(); - } - - /// - /// IWorkItemResult interface. - /// Created when a WorkItemCallback work item is queued. - /// - public interface IWorkItemResult : IWorkItemResult - { - } - - /// - /// IWorkItemResult<TResult> interface. - /// Created when a Func<TResult> work item is queued. - /// - public interface IWorkItemResult : IWaitableResult - { - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits. - /// - /// The result of the work item - TResult GetResult(); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - TResult GetResult( - int millisecondsTimeout, - bool exitContext); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - TResult GetResult( - TimeSpan timeout, - bool exitContext); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled. - /// - /// Timeout in milliseconds, or -1 for infinite - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the blocking if needed - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - /// On cancel throws WorkItemCancelException - TResult GetResult( - int millisecondsTimeout, - bool exitContext, - WaitHandle cancelWaitHandle); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled. - /// - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - /// On cancel throws WorkItemCancelException - TResult GetResult( - TimeSpan timeout, - bool exitContext, - WaitHandle cancelWaitHandle); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits. - /// - /// Filled with the exception if one was thrown - /// The result of the work item - TResult GetResult(out Exception e); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// - /// - /// Filled with the exception if one was thrown - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - TResult GetResult( - int millisecondsTimeout, - bool exitContext, - out Exception e); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout. - /// - /// - /// Filled with the exception if one was thrown - /// - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - TResult GetResult( - TimeSpan timeout, - bool exitContext, - out Exception e); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled. - /// - /// Timeout in milliseconds, or -1 for infinite - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the blocking if needed - /// Filled with the exception if one was thrown - /// The result of the work item - /// On timeout throws WorkItemTimeoutException - /// On cancel throws WorkItemCancelException - TResult GetResult( - int millisecondsTimeout, - bool exitContext, - WaitHandle cancelWaitHandle, - out Exception e); - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled. - /// - /// The result of the work item - /// - /// Filled with the exception if one was thrown - /// - /// - /// On timeout throws WorkItemTimeoutException - /// On cancel throws WorkItemCancelException - TResult GetResult( - TimeSpan timeout, - bool exitContext, - WaitHandle cancelWaitHandle, - out Exception e); - - /// - /// Gets an indication whether the asynchronous operation has completed. - /// - bool IsCompleted { get; } - - /// - /// Gets an indication whether the asynchronous operation has been canceled. - /// - bool IsCanceled { get; } - - /// - /// Gets the user-defined object that contains context data - /// for the work item method. - /// - object State { get; } - - /// - /// Same as Cancel(false). - /// - bool Cancel(); - - /// - /// Cancel the work item execution. - /// If the work item is in the queue then it won't execute - /// If the work item is completed, it will remain completed - /// If the work item is in progress then the user can check the SmartThreadPool.IsWorkItemCanceled - /// property to check if the work item has been cancelled. If the abortExecution is set to true then - /// the Smart Thread Pool will send an AbortException to the running thread to stop the execution - /// of the work item. When an in progress work item is canceled its GetResult will throw WorkItemCancelException. - /// If the work item is already cancelled it will remain cancelled - /// - /// When true send an AbortException to the executing thread. - /// Returns true if the work item was not completed, otherwise false. - bool Cancel(bool abortExecution); - - /// - /// Return the result, same as GetResult() - /// - TResult Result { get; } - - /// - /// Returns the exception if occured otherwise returns null. - /// - object Exception { get; } - } - - #endregion -} diff --git a/ThirdParty/SmartThreadPool/InternalInterfaces.cs b/ThirdParty/SmartThreadPool/InternalInterfaces.cs deleted file mode 100644 index 96e80a16bbd..00000000000 --- a/ThirdParty/SmartThreadPool/InternalInterfaces.cs +++ /dev/null @@ -1,22 +0,0 @@ - -namespace Amib.Threading.Internal -{ - /// - /// An internal delegate to call when the WorkItem starts or completes - /// - internal delegate void WorkItemStateCallback(WorkItem workItem); - - internal interface IInternalWorkItemResult - { - event WorkItemStateCallback OnWorkItemStarted; - event WorkItemStateCallback OnWorkItemCompleted; - } - - internal interface IInternalWaitableResult - { - /// - /// This method is intent for internal use. - /// - IWorkItemResult GetWorkItemResult(); - } -} diff --git a/ThirdParty/SmartThreadPool/STPEventWaitHandle.cs b/ThirdParty/SmartThreadPool/STPEventWaitHandle.cs deleted file mode 100644 index fe9645aace4..00000000000 --- a/ThirdParty/SmartThreadPool/STPEventWaitHandle.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace Amib.Threading.Internal -{ - internal static class STPEventWaitHandle - { - public const int WaitTimeout = Timeout.Infinite; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) - { - return WaitHandle.WaitAll(waitHandles, millisecondsTimeout, exitContext); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static int WaitAny(WaitHandle[] waitHandles) - { - return WaitHandle.WaitAny(waitHandles); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) - { - return WaitHandle.WaitAny(waitHandles, millisecondsTimeout, exitContext); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static bool WaitOne(WaitHandle waitHandle, int millisecondsTimeout, bool exitContext) - { - return waitHandle.WaitOne(millisecondsTimeout, exitContext); - } - } -} diff --git a/ThirdParty/SmartThreadPool/STPStartInfo.cs b/ThirdParty/SmartThreadPool/STPStartInfo.cs deleted file mode 100644 index bf116ce1785..00000000000 --- a/ThirdParty/SmartThreadPool/STPStartInfo.cs +++ /dev/null @@ -1,172 +0,0 @@ -using System; -using System.Threading; - -namespace Amib.Threading -{ - /// - /// Summary description for STPStartInfo. - /// - public class STPStartInfo : WIGStartInfo - { - private int _idleTimeout = SmartThreadPool.DefaultIdleTimeout; - private int _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; - private int _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; - private ThreadPriority _threadPriority = SmartThreadPool.DefaultThreadPriority; - private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground; - private string _threadPoolName = SmartThreadPool.DefaultThreadPoolName; - private int? _maxStackSize = SmartThreadPool.DefaultMaxStackSize; - private bool _supressflow = false; - - public STPStartInfo() - { - _threadPriority = SmartThreadPool.DefaultThreadPriority; - _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; - _idleTimeout = SmartThreadPool.DefaultIdleTimeout; - _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; - } - - public STPStartInfo(STPStartInfo stpStartInfo) - : base(stpStartInfo) - { - _idleTimeout = stpStartInfo.IdleTimeout; - _minWorkerThreads = stpStartInfo.MinWorkerThreads; - _maxWorkerThreads = stpStartInfo.MaxWorkerThreads; - _threadPriority = stpStartInfo.ThreadPriority; - _threadPoolName = stpStartInfo._threadPoolName; - _areThreadsBackground = stpStartInfo.AreThreadsBackground; - _apartmentState = stpStartInfo._apartmentState; - _supressflow = stpStartInfo._supressflow; - } - - /// - /// Get/Set the idle timeout in milliseconds. - /// If a thread is idle (starved) longer than IdleTimeout then it may quit. - /// - public virtual int IdleTimeout - { - get { return _idleTimeout; } - set - { - ThrowIfReadOnly(); - _idleTimeout = value; - } - } - - /// - /// Get/Set the lower limit of threads in the pool. - /// - public virtual int MinWorkerThreads - { - get { return _minWorkerThreads; } - set - { - ThrowIfReadOnly(); - _minWorkerThreads = value; - } - } - - /// - /// Get/Set the upper limit of threads in the pool. - /// - public virtual int MaxWorkerThreads - { - get { return _maxWorkerThreads; } - set - { - ThrowIfReadOnly(); - _maxWorkerThreads = value; - } - } - - /// - /// Get/Set the scheduling priority of the threads in the pool. - /// The Os handles the scheduling. - /// - public virtual ThreadPriority ThreadPriority - { - get { return _threadPriority; } - set - { - ThrowIfReadOnly(); - _threadPriority = value; - } - } - - /// - /// Get/Set the thread pool name. Threads will get names depending on this. - /// - public virtual string ThreadPoolName - { - get { return _threadPoolName; } - set - { - ThrowIfReadOnly(); - _threadPoolName = value; - } - } - - /// - /// Get/Set backgroundness of thread in thread pool. - /// - public virtual bool AreThreadsBackground - { - get { return _areThreadsBackground; } - set - { - ThrowIfReadOnly(); - _areThreadsBackground = value; - } - } - - /// - /// Get a readonly version of this STPStartInfo. - /// - /// Returns a readonly reference to this STPStartInfo - public new STPStartInfo AsReadOnly() - { - return new STPStartInfo(this) { _readOnly = true }; - } - - private ApartmentState _apartmentState = SmartThreadPool.DefaultApartmentState; - - /// - /// Get/Set the apartment state of threads in the thread pool - /// - public ApartmentState ApartmentState - { - get { return _apartmentState; } - set - { - ThrowIfReadOnly(); - _apartmentState = value; - } - } - - /// - /// Get/Set the max stack size of threads in the thread pool - /// - public int? MaxStackSize - { - get { return _maxStackSize; } - set - { - ThrowIfReadOnly(); - if (value.HasValue && value.Value < 0) - { - throw new ArgumentOutOfRangeException("value", "Value must be greater than 0."); - } - _maxStackSize = value; - } - } - - public bool SuppressFlow - { - get { return _supressflow; } - set - { - ThrowIfReadOnly(); - _supressflow = value; - } - } - } -} diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.ThreadEntry.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.ThreadEntry.cs deleted file mode 100644 index c43825bbbac..00000000000 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.ThreadEntry.cs +++ /dev/null @@ -1,69 +0,0 @@ - -using Amib.Threading.Internal; -using System; -using System.Threading; - -namespace Amib.Threading -{ - public partial class SmartThreadPool - { - #region ThreadEntry class - - internal class ThreadEntry - { - /// - /// The thread creation time - /// The value is stored as UTC value. - /// - private readonly DateTime _creationTime; - - /// - /// The last time this thread has been running - /// It is updated by IAmAlive() method - /// The value is stored as UTC value. - /// - private DateTime _lastAliveTime; - - /// - /// A reference from each thread in the thread pool to its SmartThreadPool - /// object container. - /// With this variable a thread can know whatever it belongs to a - /// SmartThreadPool. - /// - private SmartThreadPool _associatedSmartThreadPool; - - /// - /// A reference to the current work item a thread from the thread pool - /// is executing. - /// - public WorkItem CurrentWorkItem { get; set; } - public Thread WorkThread; - - public ThreadEntry(SmartThreadPool stp, Thread th) - { - _associatedSmartThreadPool = stp; - _creationTime = DateTime.UtcNow; - _lastAliveTime = DateTime.MinValue; - WorkThread = th; - } - - public SmartThreadPool AssociatedSmartThreadPool - { - get { return _associatedSmartThreadPool; } - } - - public void IAmAlive() - { - _lastAliveTime = DateTime.UtcNow; - } - - public void Clean() - { - WorkThread = null; - _associatedSmartThreadPool = null; - } - } - - #endregion - } -} diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs deleted file mode 100644 index d7a6a9fbc4d..00000000000 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ /dev/null @@ -1,1556 +0,0 @@ -#region Release History - -// Smart Thread Pool -// 7 Aug 2004 - Initial release -// -// 14 Sep 2004 - Bug fixes -// -// 15 Oct 2004 - Added new features -// - Work items return result. -// - Support waiting synchronization for multiple work items. -// - Work items can be cancelled. -// - Passage of the caller thread’s context to the thread in the pool. -// - Minimal usage of WIN32 handles. -// - Minor bug fixes. -// -// 26 Dec 2004 - Changes: -// - Removed static constructors. -// - Added finalizers. -// - Changed Exceptions so they are serializable. -// - Fixed the bug in one of the SmartThreadPool constructors. -// - Changed the SmartThreadPool.WaitAll() so it will support any number of waiters. -// The SmartThreadPool.WaitAny() is still limited by the .NET Framework. -// - Added PostExecute with options on which cases to call it. -// - Added option to dispose of the state objects. -// - Added a WaitForIdle() method that waits until the work items queue is empty. -// - Added an STPStartInfo class for the initialization of the thread pool. -// - Changed exception handling so if a work item throws an exception it -// is rethrown at GetResult(), rather then firing an UnhandledException event. -// Note that PostExecute exception are always ignored. -// -// 25 Mar 2005 - Changes: -// - Fixed lost of work items bug -// -// 3 Jul 2005: Changes. -// - Fixed bug where Enqueue() throws an exception because PopWaiter() returned null, hardly reconstructed. -// -// 16 Aug 2005: Changes. -// - Fixed bug where the InUseThreads becomes negative when canceling work items. -// -// 31 Jan 2006 - Changes: -// - Added work items priority -// - Removed support of chained delegates in callbacks and post executes (nobody really use this) -// - Added work items groups -// - Added work items groups idle event -// - Changed SmartThreadPool.WaitAll() behavior so when it gets empty array -// it returns true rather then throwing an exception. -// - Added option to start the STP and the WIG as suspended -// - Exception behavior changed, the real exception is returned by an -// inner exception -// - Added performance counters -// - Added priority to the threads in the pool -// -// 13 Feb 2006 - Changes: -// - Added a call to the dispose of the Performance Counter so -// their won't be a Performance Counter leak. -// - Added exception catch in case the Performance Counters cannot -// be created. -// -// 17 May 2008 - Changes: -// - Changed the dispose behavior and removed the Finalizers. -// - Enabled the change of the MaxThreads and MinThreads at run time. -// - Enabled the change of the Concurrency of a IWorkItemsGroup at run -// time If the IWorkItemsGroup is a SmartThreadPool then the Concurrency -// refers to the MaxThreads. -// - Improved the cancel behavior. -// - Added events for thread creation and termination. -// - Fixed the HttpContext context capture. -// - Changed internal collections so they use generic collections -// - Added IsIdle flag to the SmartThreadPool and IWorkItemsGroup -// - Added support for WinCE -// - Added support for Action and Func -// -// 07 April 2009 - Changes: -// - Added support for Silverlight and Mono -// - Added Join, Choice, and Pipe to SmartThreadPool. -// - Added local performance counters (for Mono, Silverlight, and WindowsCE) -// - Changed duration measures from DateTime.Now to Stopwatch. -// - Queues changed from System.Collections.Queue to System.Collections.Generic.LinkedList. -// -// 21 December 2009 - Changes: -// - Added work item timeout (passive) -// -// 20 August 2012 - Changes: -// - Added set name to threads -// - Fixed the WorkItemsQueue.Dequeue. -// Replaced while (!Monitor.TryEnter(this)); with lock(this) { ... } -// - Fixed SmartThreadPool.Pipe -// - Added IsBackground option to threads -// - Added ApartmentState to threads -// - Fixed thread creation when queuing many work items at the same time. -// -// 24 August 2012 - Changes: -// - Enabled cancel abort after cancel. See: http://smartthreadpool.codeplex.com/discussions/345937 by alecswan -// - Added option to set MaxStackSize of threads - -#endregion - -using System; -using System.Security; -using System.Threading; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; - -using Amib.Threading.Internal; - -namespace Amib.Threading -{ - #region SmartThreadPool class - /// - /// Smart thread pool class. - /// - public partial class SmartThreadPool : WorkItemsGroupBase, IDisposable - { - #region Public Default Constants - - /// - /// Default minimum number of threads the thread pool contains. (0) - /// - public const int DefaultMinWorkerThreads = 0; - - /// - /// Default maximum number of threads the thread pool contains. (25) - /// - public const int DefaultMaxWorkerThreads = 25; - - /// - /// Default idle timeout in milliseconds. (One minute) - /// - public const int DefaultIdleTimeout = 60 * 1000; // One minute - - /// - /// Indicate to copy the security context of the caller and then use it in the call. (false) - /// - public const bool DefaultUseCallerCallContext = false; - - /// - /// Indicate to dispose of the state objects if they support the IDispose interface. (false) - /// - public const bool DefaultDisposeOfStateObjects = false; - - /// - /// The default option to run the post execute (CallToPostExecute.Always) - /// - public const CallToPostExecute DefaultCallToPostExecute = CallToPostExecute.Always; - - /// - /// The default post execute method to run. (None) - /// When null it means not to call it. - /// - public static readonly PostExecuteWorkItemCallback DefaultPostExecuteWorkItemCallback; - - /// - /// The default is to work on work items as soon as they arrive - /// and not to wait for the start. (false) - /// - public const bool DefaultStartSuspended = false; - - /// - /// The default name to use for the performance counters instance. (null) - /// - public static readonly string DefaultPerformanceCounterInstanceName; - - /// - /// The default thread priority (ThreadPriority.Normal) - /// - public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal; - - /// - /// The default thread pool name. (SmartThreadPool) - /// - public const string DefaultThreadPoolName = "SmartThreadPool"; - - /// - /// The default Max Stack Size. (SmartThreadPool) - /// - public static readonly int? DefaultMaxStackSize = null; - - /// - /// The default fill state with params. (false) - /// It is relevant only to QueueWorkItem of Action<...>/Func<...> - /// - public const bool DefaultFillStateWithArgs = false; - - /// - /// The default thread backgroundness. (true) - /// - public const bool DefaultAreThreadsBackground = true; - - /// - /// The default apartment state of a thread in the thread pool. - /// The default is ApartmentState.Unknown which means the STP will not - /// set the apartment of the thread. It will use the .NET default. - /// - public const ApartmentState DefaultApartmentState = ApartmentState.Unknown; - - #endregion - - #region Member Variables - - /// - /// Dictionary of all the threads in the thread pool. - /// - private readonly ConcurrentDictionary m_workerThreads = new(); - private readonly object m_workerThreadsLock = new(); - - /// - /// Queue of work items. - /// - private readonly WorkItemsQueue m_workItemsQueue = new(); - - /// - /// Count the work items handled. - /// Used by the performance counter. - /// - private int m_workItemsProcessed; - - /// - /// Number of threads that currently work (not idle). - /// - private int m_inUseWorkerThreads; - - /// - /// Stores a copy of the original STPStartInfo. - /// It is used to change the MinThread and MaxThreads - /// - private readonly STPStartInfo m_stpStartInfo; - - /// - /// Total number of work items that are stored in the work items queue - /// plus the work items that the threads in the pool are working on. - /// - private int m_currentWorkItemsCount; - - /// - /// Signaled when the thread pool is idle, i.e. no thread is busy - /// and the work items queue is empty - /// - private ManualResetEvent m_isIdleWaitHandle = new(true); - - /// - /// An event to signal all the threads to quit immediately. - /// - private ManualResetEvent m_shuttingDownEvent = new(false); - - /// - /// A flag to indicate if the Smart Thread Pool is now suspended. - /// - private bool m_isSuspended; - - /// - /// A flag to indicate the threads to quit. - /// - private bool m_shutdown; - - /// - /// Counts the threads created in the pool. - /// It is used to name the threads. - /// - private int m_threadCounter; - - /// - /// Indicate that the SmartThreadPool has been disposed - /// - private bool m_isDisposed; - - private static long m_lastThreadCreateTS = long.MinValue; - - /// - /// Holds all the WorkItemsGroup instaces that have at least one - /// work item int the SmartThreadPool - /// This variable is used in case of Shutdown - /// - private readonly ConcurrentDictionary m_workItemsGroups = new(); - - /// - /// A common object for all the work items int the STP - /// so we can mark them to cancel in O(1) - /// - private CanceledWorkItemsGroup m_canceledSmartThreadPool = new(); - - /// - /// An event to call after a thread is created, but before - /// it's first use. - /// - private event ThreadInitializationHandler m_onThreadInitialization; - - /// - /// An event to call when a thread is about to exit, after - /// it is no longer belong to the pool. - /// - private event ThreadTerminationHandler m_onThreadTermination; - - #endregion - - #region Per thread - - /// - /// A reference to the current work item a thread from the thread pool - /// is executing. - /// - [ThreadStatic] - internal static ThreadEntry CurrentThreadEntry; - - #endregion - - #region Construction and Finalization - - /// - /// Constructor - /// - public SmartThreadPool() - { - m_stpStartInfo = new STPStartInfo(); - Initialize(); - } - - /// - /// Constructor - /// - /// Idle timeout in milliseconds - public SmartThreadPool(int idleTimeout) - { - m_stpStartInfo = new STPStartInfo - { - IdleTimeout = idleTimeout, - }; - Initialize(); - } - - /// - /// Constructor - /// - /// Idle timeout in milliseconds - /// Upper limit of threads in the pool - public SmartThreadPool(int idleTimeout, int maxWorkerThreads) - { - m_stpStartInfo = new STPStartInfo - { - IdleTimeout = idleTimeout, - MaxWorkerThreads = maxWorkerThreads, - }; - Initialize(); - } - - /// - /// Constructor - /// - /// Idle timeout in milliseconds - /// Upper limit of threads in the pool - /// Lower limit of threads in the pool - public SmartThreadPool(int idleTimeout, int maxWorkerThreads, int minWorkerThreads) - { - m_stpStartInfo = new STPStartInfo - { - IdleTimeout = idleTimeout, - MaxWorkerThreads = maxWorkerThreads, - MinWorkerThreads = minWorkerThreads, - }; - Initialize(); - } - - /// - /// Constructor - /// - /// A SmartThreadPool configuration that overrides the default behavior - public SmartThreadPool(STPStartInfo stpStartInfo) - { - m_stpStartInfo = new STPStartInfo(stpStartInfo); - Initialize(); - } - - private void Initialize() - { - Name = m_stpStartInfo.ThreadPoolName; - ValidateSTPStartInfo(); - - // _stpStartInfoRW stores a read/write copy of the STPStartInfo. - // Actually only MaxWorkerThreads and MinWorkerThreads are overwritten - - m_isSuspended = m_stpStartInfo.StartSuspended; - - // If the STP is not started suspended then start the threads. - if (!m_isSuspended) - { - StartOptimalNumberOfThreads(); - } - } - - private void StartOptimalNumberOfThreads() - { - int threadsCount; - lock (m_workerThreadsLock) - { - threadsCount = m_workItemsQueue.Count; - if (threadsCount == m_stpStartInfo.MinWorkerThreads) - return; - if (threadsCount < m_stpStartInfo.MinWorkerThreads) - threadsCount = m_stpStartInfo.MinWorkerThreads; - else if (threadsCount > m_stpStartInfo.MaxWorkerThreads) - threadsCount = m_stpStartInfo.MaxWorkerThreads; - threadsCount -= m_workerThreads.Count; - } - StartThreads(threadsCount); - } - - private void ValidateSTPStartInfo() - { - if (m_stpStartInfo.MinWorkerThreads < 0) - { - throw new ArgumentOutOfRangeException( - "MinWorkerThreads", "MinWorkerThreads cannot be negative"); - } - - if (m_stpStartInfo.MaxWorkerThreads <= 0) - { - throw new ArgumentOutOfRangeException( - "MaxWorkerThreads", "MaxWorkerThreads must be greater than zero"); - } - - if (m_stpStartInfo.MinWorkerThreads > m_stpStartInfo.MaxWorkerThreads) - { - throw new ArgumentOutOfRangeException( - "MinWorkerThreads, maxWorkerThreads", - "MaxWorkerThreads must be greater or equal to MinWorkerThreads"); - } - } - - #endregion - - #region Thread Processing - - /// - /// Waits on the queue for a work item, shutdown, or timeout. - /// - /// - /// Returns the WaitingCallback or null in case of timeout or shutdown. - /// - private WorkItem Dequeue() - { - return m_workItemsQueue.DequeueWorkItem(m_stpStartInfo.IdleTimeout, m_shuttingDownEvent); - } - - /// - /// Put a new work item in the queue - /// - /// A work item to queue - internal override void Enqueue(WorkItem workItem) - { - // Make sure the workItem is not null - Debug.Assert(workItem is not null); - - IncrementWorkItemsCount(); - - workItem.CanceledSmartThreadPool = m_canceledSmartThreadPool; - workItem.WorkItemIsQueued(); - m_workItemsQueue.EnqueueWorkItem(workItem); - - // If all the threads are busy then try to create a new one - if (m_currentWorkItemsCount > m_workerThreads.Count) - { - StartThreads(1); - } - } - - private void IncrementWorkItemsCount() - { - int count = Interlocked.Increment(ref m_currentWorkItemsCount); - //Trace.WriteLine("WorkItemsCount = " + _currentWorkItemsCount.ToString()); - if (count == 1) - { - IsIdle = false; - m_isIdleWaitHandle.Reset(); - } - } - - private void DecrementWorkItemsCount() - { - int count = Interlocked.Decrement(ref m_currentWorkItemsCount); - //Trace.WriteLine("WorkItemsCount = " + _currentWorkItemsCount.ToString()); - if (count == 0) - { - IsIdle = true; - m_isIdleWaitHandle.Set(); - } - - Interlocked.Increment(ref m_workItemsProcessed); - } - - private int baseWorkIDs = Environment.TickCount; - internal void RegisterWorkItemsGroup(IWorkItemsGroup workItemsGroup) - { - int localID = Interlocked.Increment(ref baseWorkIDs); - while (m_workItemsGroups.ContainsKey(localID)) - localID = Interlocked.Increment(ref baseWorkIDs); - - workItemsGroup.localID = localID; - m_workItemsGroups[localID] = (WorkItemsGroup)workItemsGroup; - } - - internal void UnregisterWorkItemsGroup(IWorkItemsGroup workItemsGroup) - { - m_workItemsGroups.TryRemove(workItemsGroup.localID, out WorkItemsGroup _); - } - - /// - /// Inform that the current thread is about to quit or quiting. - /// The same thread may call this method more than once. - /// - private void InformCompleted() - { - if (m_workerThreads.TryRemove(Environment.CurrentManagedThreadId, out ThreadEntry te)) - { - te.Clean(); - } - } - - /// - /// Starts new threads - /// - /// The number of threads to start - private void StartThreads(int threadsCount) - { - if (m_isSuspended) - return; - - lock (m_workerThreadsLock) - { - // Don't start threads on shut down - if (m_shutdown) - return; - - int tmpcount = m_workerThreads.Count; - if(tmpcount > m_stpStartInfo.MinWorkerThreads) - { - long last = Interlocked.Read(ref m_lastThreadCreateTS); - if (DateTime.UtcNow.Ticks - last < 50 * TimeSpan.TicksPerMillisecond) - return; - } - - tmpcount = m_stpStartInfo.MaxWorkerThreads - tmpcount; - if (threadsCount > tmpcount) - threadsCount = tmpcount; - - while(threadsCount > 0) - { - // Create a new thread - Thread workerThread; - if(m_stpStartInfo.SuppressFlow) - { - using(ExecutionContext.SuppressFlow()) - { - workerThread = - m_stpStartInfo.MaxStackSize.HasValue - ? new Thread(ProcessQueuedItems, m_stpStartInfo.MaxStackSize.Value) - : new Thread(ProcessQueuedItems); - } - } - else - { - workerThread = - m_stpStartInfo.MaxStackSize.HasValue - ? new Thread(ProcessQueuedItems, m_stpStartInfo.MaxStackSize.Value) - : new Thread(ProcessQueuedItems); - } - - // Configure the new thread and start it - workerThread.IsBackground = m_stpStartInfo.AreThreadsBackground; - - if (m_stpStartInfo.ApartmentState != ApartmentState.Unknown) - workerThread.SetApartmentState(m_stpStartInfo.ApartmentState); - - workerThread.Priority = m_stpStartInfo.ThreadPriority; - workerThread.Name = $"STP:{Name}:{m_threadCounter}"; - - Interlocked.Exchange(ref m_lastThreadCreateTS, DateTime.UtcNow.Ticks); - ++m_threadCounter; - --threadsCount; - - // Add it to the dictionary and update its creation time. - m_workerThreads[workerThread.ManagedThreadId] = new ThreadEntry(this, workerThread); - - workerThread.Start(); - } - } - } - - /// - /// A worker thread method that processes work items from the work items queue. - /// - private void ProcessQueuedItems() - { - // Keep the entry of the dictionary as thread's variable to avoid the synchronization locks - // of the dictionary. - CurrentThreadEntry = m_workerThreads[Environment.CurrentManagedThreadId]; - - bool informedCompleted = false; - FireOnThreadInitialization(); - - try - { - bool bInUseWorkerThreadsWasIncremented = false; - int maxworkers = m_stpStartInfo.MaxWorkerThreads; - int minworkers = m_stpStartInfo.MinWorkerThreads; - - // Process until shutdown. - while (!m_shutdown) - { - // The following block handles the when the MaxWorkerThreads has been - // incremented by the user at run-time. - // Double lock for quit. - if (m_workerThreads.Count > maxworkers) - { - lock (m_workerThreadsLock) - { - if (m_workerThreads.Count > maxworkers) - { - // Inform that the thread is quiting and then quit. - // This method must be called within this lock or else - // more threads will quit and the thread pool will go - // below the lower limit. - InformCompleted(); - informedCompleted = true; - break; - } - } - } - - CurrentThreadEntry.IAmAlive(); - - // Wait for a work item, shutdown, or timeout - WorkItem workItem = Dequeue(); - - // On timeout or shut down. - if (workItem is null) - { - // Double lock for quit. - if (m_workerThreads.Count > minworkers) - { - lock (m_workerThreadsLock) - { - if (m_workerThreads.Count > minworkers) - { - // Inform that the thread is quiting and then quit. - // This method must be called within this lock or else - // more threads will quit and the thread pool will go - // below the lower limit. - InformCompleted(); - informedCompleted = true; - break; - } - } - } - continue; - } - - CurrentThreadEntry.IAmAlive(); - - try - { - // Initialize the value to false - bInUseWorkerThreadsWasIncremented = false; - - // Set the Current Work Item of the thread. - // Store the Current Work Item before the workItem.StartingWorkItem() is called, - // so WorkItem.Cancel can work when the work item is between InQueue and InProgress - // states. - // If the work item has been cancelled BEFORE the workItem.StartingWorkItem() - // (work item is in InQueue state) then workItem.StartingWorkItem() will return false. - // If the work item has been cancelled AFTER the workItem.StartingWorkItem() then - // (work item is in InProgress state) then the thread will be aborted - CurrentThreadEntry.CurrentWorkItem = workItem; - - // Change the state of the work item to 'in progress' if possible. - // We do it here so if the work item has been canceled we won't - // increment the _inUseWorkerThreads. - // The cancel mechanism doesn't delete items from the queue, - // it marks the work item as canceled, and when the work item - // is dequeued, we just skip it. - // If the post execute of work item is set to always or to - // call when the work item is canceled then the StartingWorkItem() - // will return true, so the post execute can run. - if (!workItem.StartingWorkItem()) - { - CurrentThreadEntry.CurrentWorkItem = null; - continue; - } - - // Execute the callback. Make sure to accurately - // record how many callbacks are currently executing. - int inUseWorkerThreads = Interlocked.Increment(ref m_inUseWorkerThreads); - - // Mark that the _inUseWorkerThreads incremented, so in the finally{} - // statement we will decrement it correctly. - bInUseWorkerThreadsWasIncremented = true; - - workItem.FireWorkItemStarted(); - - ExecuteWorkItem(workItem); - } - catch (Exception ex) - { - ex.GetHashCode(); - // Do nothing - } - finally - { - workItem.DisposeOfState(); - - // Set the CurrentWorkItem to null, since we - // no longer run user's code. - CurrentThreadEntry.CurrentWorkItem = null; - - // Decrement the _inUseWorkerThreads only if we had - // incremented it. Note the cancelled work items don't - // increment _inUseWorkerThreads. - if (bInUseWorkerThreadsWasIncremented) - { - int inUseWorkerThreads = Interlocked.Decrement(ref m_inUseWorkerThreads); - } - - // Notify that the work item has been completed. - // WorkItemsGroup may enqueue their next work item. - workItem.FireWorkItemCompleted(); - - // Decrement the number of work items here so the idle - // ManualResetEvent won't fluctuate. - DecrementWorkItemsCount(); - } - } - } - /* - catch (ThreadAbortException tae) - { - //tae.GetHashCode(); - // Handle the abort exception gracfully. - //Thread.ResetAbort(); - } - */ - catch (Exception e) - { - Debug.Assert(e is not null); - } - finally - { - if(!informedCompleted) - InformCompleted(); - FireOnThreadTermination(); - m_workItemsQueue.CloseThreadWaiter(); - CurrentThreadEntry = null; - } - } - - private static void ExecuteWorkItem(WorkItem workItem) - { - try - { - workItem.Execute(); - } - finally - { - } - } - - - #endregion - - #region Public Methods - - private void ValidateWaitForIdle() - { - if (CurrentThreadEntry is not null && CurrentThreadEntry.AssociatedSmartThreadPool == this) - { - throw new NotSupportedException( - "WaitForIdle cannot be called from a thread on its SmartThreadPool, it causes a deadlock"); - } - } - - internal static void ValidateWorkItemsGroupWaitForIdle(IWorkItemsGroup workItemsGroup) - { - if (CurrentThreadEntry is not null) - ValidateWorkItemsGroupWaitForIdleImpl(workItemsGroup, CurrentThreadEntry.CurrentWorkItem); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private static void ValidateWorkItemsGroupWaitForIdleImpl(IWorkItemsGroup workItemsGroup, WorkItem workItem) - { - if ((workItemsGroup is not null) && - (workItem is not null) && - workItem.WasQueuedBy(workItemsGroup)) - { - throw new NotSupportedException("WaitForIdle cannot be called from a thread on its SmartThreadPool, it causes a deadlock"); - } - } - - /// - /// Force the SmartThreadPool to shutdown - /// - public void Shutdown() - { - Shutdown(true, 0); - } - - /// - /// Force the SmartThreadPool to shutdown with timeout - /// - public void Shutdown(bool forceAbort, TimeSpan timeout) - { - Shutdown(forceAbort, (int)timeout.TotalMilliseconds); - } - - /// - /// Empties the queue of work items and abort the threads in the pool. - /// - public void Shutdown(bool forceAbort, int millisecondsTimeout) - { - ValidateNotDisposed(); - - ThreadEntry[] threadEntries; - lock (m_workerThreadsLock) - { - // Shutdown the work items queue - m_workItemsQueue.Dispose(); - - // Signal the threads to exit - m_shutdown = true; - m_shuttingDownEvent.Set(); - - // Make a copy of the threads' references in the pool - threadEntries = new ThreadEntry[m_workerThreads.Count]; - m_workerThreads.Values.CopyTo(threadEntries, 0); - m_workerThreads.Clear(); - } - - int millisecondsLeft = millisecondsTimeout; - Stopwatch stopwatch = Stopwatch.StartNew(); - //DateTime start = DateTime.UtcNow; - bool waitInfinitely = (Timeout.Infinite == millisecondsTimeout); - bool timeout = false; - - // Each iteration we update the time left for the timeout. - foreach (ThreadEntry te in threadEntries) - { - if (te is null) - continue; - - Thread thread = te.WorkThread; - - // Join don't work with negative numbers - if (!waitInfinitely && (millisecondsLeft < 0)) - { - timeout = true; - break; - } - - // Wait for the thread to terminate - bool success = thread.Join(millisecondsLeft); - if (!success) - { - timeout = true; - break; - } - - if (!waitInfinitely) - { - // Update the time left to wait - //TimeSpan ts = DateTime.UtcNow - start; - millisecondsLeft = millisecondsTimeout - (int)stopwatch.ElapsedMilliseconds; - } - te.WorkThread = null; - } - - if (timeout && forceAbort) - { - // Abort the threads in the pool - foreach (ThreadEntry te in threadEntries) - { - if (te is null) - continue; - - Thread thread = te.WorkThread; - if (thread is not null && thread.IsAlive ) - { - try - { - //thread.Abort(); // Shutdown - te.WorkThread = null; - } - catch (SecurityException e) - { - e.GetHashCode(); - } - catch (ThreadStateException ex) - { - ex.GetHashCode(); - // In case the thread has been terminated - // after the check if it is alive. - } - } - } - } - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// - /// true when every work item in workItemResults has completed; otherwise false. - /// - public static bool WaitAll( IWaitableResult[] waitableResults) - { - return WaitAll(waitableResults, Timeout.Infinite, true); - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// - /// true when every work item in workItemResults has completed; otherwise false. - /// - public static bool WaitAll( IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext) - { - return WaitAll(waitableResults, (int)timeout.TotalMilliseconds, exitContext); - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// true when every work item in workItemResults has completed; otherwise false. - /// - public static bool WaitAll( IWaitableResult[] waitableResults, TimeSpan timeout, - bool exitContext, WaitHandle cancelWaitHandle) - { - return WaitAll(waitableResults, (int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle); - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// - /// true when every work item in workItemResults has completed; otherwise false. - /// - public static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext) - { - return WorkItem.WaitAll(waitableResults, millisecondsTimeout, exitContext, null); - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// true when every work item in workItemResults has completed; otherwise false. - /// - public static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout, - bool exitContext, WaitHandle cancelWaitHandle) - { - return WorkItem.WaitAll(waitableResults, millisecondsTimeout, exitContext, cancelWaitHandle); - } - - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if any of the work items has been canceled. - /// - public static int WaitAny( IWaitableResult[] waitableResults) - { - return WaitAny(waitableResults, Timeout.Infinite, true); - } - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled. - /// - public static int WaitAny( IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext) - { - return WaitAny(waitableResults, (int)timeout.TotalMilliseconds, exitContext); - } - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled. - /// - public static int WaitAny( IWaitableResult[] waitableResults, TimeSpan timeout, - bool exitContext, WaitHandle cancelWaitHandle) - { - return WaitAny(waitableResults, (int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle); - } - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled. - /// - public static int WaitAny( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext) - { - return WorkItem.WaitAny(waitableResults, millisecondsTimeout, exitContext, null); - } - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled. - /// - public static int WaitAny( IWaitableResult[] waitableResults, int millisecondsTimeout, - bool exitContext, WaitHandle cancelWaitHandle) - { - return WorkItem.WaitAny(waitableResults, millisecondsTimeout, exitContext, cancelWaitHandle); - } - - /// - /// Creates a new WorkItemsGroup. - /// - /// The number of work items that can be run concurrently - /// A reference to the WorkItemsGroup - public IWorkItemsGroup CreateWorkItemsGroup(int concurrency) - { - IWorkItemsGroup workItemsGroup = new WorkItemsGroup(this, concurrency, m_stpStartInfo); - return workItemsGroup; - } - - /// - /// Creates a new WorkItemsGroup. - /// - /// The number of work items that can be run concurrently - /// A WorkItemsGroup configuration that overrides the default behavior - /// A reference to the WorkItemsGroup - public IWorkItemsGroup CreateWorkItemsGroup(int concurrency, WIGStartInfo wigStartInfo) - { - IWorkItemsGroup workItemsGroup = new WorkItemsGroup(this, concurrency, wigStartInfo); - return workItemsGroup; - } - - #region Fire Thread's Events - - private void FireOnThreadInitialization() - { - if (null != m_onThreadInitialization) - { - foreach (ThreadInitializationHandler tih in m_onThreadInitialization.GetInvocationList()) - { - try - { - tih(); - } - catch - { - Debug.Assert(false); - throw; - } - } - } - } - - private void FireOnThreadTermination() - { - if (null != m_onThreadTermination) - { - foreach (ThreadTerminationHandler tth in m_onThreadTermination.GetInvocationList()) - { - try - { - tth(); - } - catch - { - Debug.Assert(false); - throw; - } - } - } - } - - #endregion - - /// - /// This event is fired when a thread is created. - /// Use it to initialize a thread before the work items use it. - /// - public event ThreadInitializationHandler OnThreadInitialization - { - add { m_onThreadInitialization += value; } - remove { m_onThreadInitialization -= value; } - } - - /// - /// This event is fired when a thread is terminating. - /// Use it for cleanup. - /// - public event ThreadTerminationHandler OnThreadTermination - { - add { m_onThreadTermination += value; } - remove { m_onThreadTermination -= value; } - } - - - internal void CancelAbortWorkItemsGroup(WorkItemsGroup wig) - { - foreach (ThreadEntry threadEntry in m_workerThreads.Values) - { - WorkItem workItem = threadEntry.CurrentWorkItem; - if (null != workItem && !workItem.IsCanceled && workItem.WasQueuedBy(wig)) - { - threadEntry.CurrentWorkItem.GetWorkItemResult().Cancel(true); - } - } - } - - #endregion - - #region Properties - - /// - /// Get/Set the lower limit of threads in the pool. - /// - public int MinThreads - { - get - { - ValidateNotDisposed(); - return m_stpStartInfo.MinWorkerThreads; - } - set - { - Debug.Assert(value >= 0); - Debug.Assert(value <= m_stpStartInfo.MaxWorkerThreads); - if (m_stpStartInfo.MaxWorkerThreads < value) - { - m_stpStartInfo.MaxWorkerThreads = value; - } - m_stpStartInfo.MinWorkerThreads = value; - StartOptimalNumberOfThreads(); - } - } - - /// - /// Get/Set the upper limit of threads in the pool. - /// - public int MaxThreads - { - get - { - ValidateNotDisposed(); - return m_stpStartInfo.MaxWorkerThreads; - } - - set - { - Debug.Assert(value > 0); - Debug.Assert(value >= m_stpStartInfo.MinWorkerThreads); - if (m_stpStartInfo.MinWorkerThreads > value) - { - m_stpStartInfo.MinWorkerThreads = value; - } - m_stpStartInfo.MaxWorkerThreads = value; - StartOptimalNumberOfThreads(); - } - } - /// - /// Get the number of threads in the thread pool. - /// Should be between the lower and the upper limits. - /// - public int ActiveThreads - { - get - { - ValidateNotDisposed(); - return m_workerThreads.Count; - } - } - - /// - /// Get the number of busy (not idle) threads in the thread pool. - /// - public int InUseThreads - { - get - { - ValidateNotDisposed(); - return m_inUseWorkerThreads; - } - } - - /// - /// Returns true if the current running work item has been cancelled. - /// Must be used within the work item's callback method. - /// The work item should sample this value in order to know if it - /// needs to quit before its completion. - /// - public static bool IsWorkItemCanceled - { - get - { - return CurrentThreadEntry.CurrentWorkItem.IsCanceled; - } - } - - /// - /// Checks if the work item has been cancelled, and if yes then abort the thread. - /// Can be used with Cancel and timeout - /// - public static void AbortOnWorkItemCancel() - { - if (IsWorkItemCanceled) - { - //Thread.CurrentThread.Abort(); - } - } - - /// - /// Thread Pool start information (readonly) - /// - public STPStartInfo STPStartInfo - { - get - { - return m_stpStartInfo.AsReadOnly(); - } - } - - public bool IsShuttingdown - { - get { return m_shutdown; } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected void Dispose(bool disposing) - { - if (!m_isDisposed) - { - if (!m_shutdown) - { - Shutdown(); - } - - if (m_shuttingDownEvent is not null) - { - m_shuttingDownEvent.Close(); - m_shuttingDownEvent = null; - } - m_workerThreads.Clear(); - - if (m_isIdleWaitHandle is not null) - { - m_isIdleWaitHandle.Close(); - m_isIdleWaitHandle = null; - } - - m_isDisposed = true; - } - } - - private void ValidateNotDisposed() - { - if (m_isDisposed) - { - throw new ObjectDisposedException(GetType().ToString(), "The SmartThreadPool has been shutdown"); - } - } - #endregion - - #region WorkItemsGroupBase Overrides - - /// - /// Get/Set the maximum number of work items that execute cocurrency on the thread pool - /// - public override int Concurrency - { - get { return MaxThreads; } - set { MaxThreads = value; } - } - - /// - /// Get the number of work items in the queue. - /// - public override int WaitingCallbacks - { - get - { - ValidateNotDisposed(); - return m_workItemsQueue.Count; - } - } - - /// - /// Get an array with all the state objects of the currently running items. - /// The array represents a snap shot and impact performance. - /// - public override object[] GetStates() - { - object[] states = m_workItemsQueue.GetStates(); - return states; - } - - /// - /// WorkItemsGroup start information (readonly) - /// - public override WIGStartInfo WIGStartInfo - { - get { return m_stpStartInfo.AsReadOnly(); } - } - - /// - /// Start the thread pool if it was started suspended. - /// If it is already running, this method is ignored. - /// - public override void Start() - { - if (!m_isSuspended) - { - return; - } - m_isSuspended = false; - - foreach (WorkItemsGroup workItemsGroup in m_workItemsGroups.Values) - { - workItemsGroup?.OnSTPIsStarting(); - } - - StartOptimalNumberOfThreads(); - } - - /// - /// Cancel all work items using thread abortion - /// - /// True to stop work items by raising ThreadAbortException - public override void Cancel(bool abortExecution) - { - m_canceledSmartThreadPool.IsCanceled = true; - m_canceledSmartThreadPool = new CanceledWorkItemsGroup(); - - foreach (WorkItemsGroup workItemsGroup in m_workItemsGroups.Values) - { - workItemsGroup?.Cancel(abortExecution); - } - - if (abortExecution) - { - foreach (ThreadEntry threadEntry in m_workerThreads.Values) - { - if(threadEntry.AssociatedSmartThreadPool == this) - { - WorkItem workItem = threadEntry.CurrentWorkItem; - if (workItem is not null && !workItem.IsCanceled) - { - threadEntry.CurrentWorkItem.GetWorkItemResult().Cancel(true); - } - } - } - } - } - - /// - /// Wait for the thread pool to be idle - /// - public override bool WaitForIdle(int millisecondsTimeout) - { - ValidateWaitForIdle(); - return STPEventWaitHandle.WaitOne(m_isIdleWaitHandle, millisecondsTimeout, false); - } - - /// - /// This event is fired when all work items are completed. - /// (When IsIdle changes to true) - /// This event only work on WorkItemsGroup. On SmartThreadPool - /// it throws the NotImplementedException. - /// - public override event WorkItemsGroupIdleHandler OnIdle - { - add - { - //_onIdle += value; - } - remove - { - //_onIdle -= value; - } - } - - internal override void PreQueueWorkItem() - { - ValidateNotDisposed(); - } - - #endregion - - #region Join, Choice, Pipe, etc. - - /// - /// Executes all actions in parallel. - /// Returns when they all finish. - /// - /// Actions to execute - public void Join(IEnumerable actions) - { - WIGStartInfo wigStartInfo = new() { StartSuspended = true }; - IWorkItemsGroup workItemsGroup = CreateWorkItemsGroup(int.MaxValue, wigStartInfo); - foreach (Action action in actions) - { - workItemsGroup.QueueWorkItem(action); - } - workItemsGroup.Start(); - workItemsGroup.WaitForIdle(); - } - - /// - /// Executes all actions in parallel. - /// Returns when they all finish. - /// - /// Actions to execute - public void Join(params Action[] actions) - { - Join((IEnumerable)actions); - } - - private class ChoiceIndex - { - public int _index = -1; - } - - /// - /// Executes all actions in parallel - /// Returns when the first one completes - /// - /// Actions to execute - public int Choice(IEnumerable actions) - { - WIGStartInfo wigStartInfo = new() { StartSuspended = true }; - IWorkItemsGroup workItemsGroup = CreateWorkItemsGroup(int.MaxValue, wigStartInfo); - - ManualResetEvent anActionCompleted = new(false); - - ChoiceIndex choiceIndex = new(); - - int i = 0; - foreach (Action action in actions) - { - Action act = action; - int value = i; - workItemsGroup.QueueWorkItem(() => { act(); Interlocked.CompareExchange(ref choiceIndex._index, value, -1); anActionCompleted.Set(); }); - ++i; - } - workItemsGroup.Start(); - anActionCompleted.WaitOne(); - anActionCompleted.Dispose(); - - return choiceIndex._index; - } - - /// - /// Executes all actions in parallel - /// Returns when the first one completes - /// - /// Actions to execute - public int Choice(params Action[] actions) - { - return Choice((IEnumerable)actions); - } - - /// - /// Executes actions in sequence asynchronously. - /// Returns immediately. - /// - /// A state context that passes - /// Actions to execute in the order they should run - public void Pipe(T pipeState, IEnumerable> actions) - { - WIGStartInfo wigStartInfo = new() { StartSuspended = true }; - IWorkItemsGroup workItemsGroup = CreateWorkItemsGroup(1, wigStartInfo); - foreach (Action action in actions) - { - Action act = action; - workItemsGroup.QueueWorkItem(() => act(pipeState)); - } - workItemsGroup.Start(); - workItemsGroup.WaitForIdle(); - } - - /// - /// Executes actions in sequence asynchronously. - /// Returns immediately. - /// - /// - /// Actions to execute in the order they should run - public void Pipe(T pipeState, params Action[] actions) - { - Pipe(pipeState, (IEnumerable>)actions); - } - #endregion - } - #endregion -} diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.csproj b/ThirdParty/SmartThreadPool/SmartThreadPool.csproj deleted file mode 100644 index e9ea8b21f62..00000000000 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - net8.0 - Amib.Threading - Amib.Threading - Smart Thread Pool - 2.2.3.0 - 2.2.3.0 - - - - - - - - \ No newline at end of file diff --git a/ThirdParty/SmartThreadPool/WIGStartInfo.cs b/ThirdParty/SmartThreadPool/WIGStartInfo.cs deleted file mode 100644 index a5faad241b9..00000000000 --- a/ThirdParty/SmartThreadPool/WIGStartInfo.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; - -namespace Amib.Threading -{ - /// - /// Summary description for WIGStartInfo. - /// - public class WIGStartInfo - { - private bool _useCallerCallContext; - private bool _disposeOfStateObjects; - private CallToPostExecute _callToPostExecute; - private PostExecuteWorkItemCallback _postExecuteWorkItemCallback; - private bool _startSuspended; - private bool _fillStateWithArgs; - - protected bool _readOnly; - - public WIGStartInfo() - { - _fillStateWithArgs = SmartThreadPool.DefaultFillStateWithArgs; - _startSuspended = SmartThreadPool.DefaultStartSuspended; - _postExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback; - _callToPostExecute = SmartThreadPool.DefaultCallToPostExecute; - _disposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects; - _useCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; - } - - public WIGStartInfo(WIGStartInfo wigStartInfo) - { - _useCallerCallContext = wigStartInfo.UseCallerCallContext; - _disposeOfStateObjects = wigStartInfo.DisposeOfStateObjects; - _callToPostExecute = wigStartInfo.CallToPostExecute; - _postExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback; - _startSuspended = wigStartInfo.StartSuspended; - _fillStateWithArgs = wigStartInfo.FillStateWithArgs; - } - - protected void ThrowIfReadOnly() - { - if (_readOnly) - { - throw new NotSupportedException("This is a readonly instance and set is not supported"); - } - } - - /// - /// Get/Set if to use the caller's security context - /// - public virtual bool UseCallerCallContext - { - get { return _useCallerCallContext; } - set - { - ThrowIfReadOnly(); - _useCallerCallContext = value; - } - } - - - /// - /// Get/Set if to dispose of the state object of a work item - /// - public virtual bool DisposeOfStateObjects - { - get { return _disposeOfStateObjects; } - set - { - ThrowIfReadOnly(); - _disposeOfStateObjects = value; - } - } - - - /// - /// Get/Set the run the post execute options - /// - public virtual CallToPostExecute CallToPostExecute - { - get { return _callToPostExecute; } - set - { - ThrowIfReadOnly(); - _callToPostExecute = value; - } - } - - - /// - /// Get/Set the default post execute callback - /// - public virtual PostExecuteWorkItemCallback PostExecuteWorkItemCallback - { - get { return _postExecuteWorkItemCallback; } - set - { - ThrowIfReadOnly(); - _postExecuteWorkItemCallback = value; - } - } - - - /// - /// Get/Set if the work items execution should be suspended until the Start() - /// method is called. - /// - public virtual bool StartSuspended - { - get { return _startSuspended; } - set - { - ThrowIfReadOnly(); - _startSuspended = value; - } - } - - /// - /// Get/Set the if QueueWorkItem of Action<...>/Func<...> fill the - /// arguments as an object array into the state of the work item. - /// The arguments can be access later by IWorkItemResult.State. - /// - public virtual bool FillStateWithArgs - { - get { return _fillStateWithArgs; } - set - { - ThrowIfReadOnly(); - _fillStateWithArgs = value; - } - } - - /// - /// Get a readonly version of this WIGStartInfo - /// - /// Returns a readonly reference to this WIGStartInfoRO - public WIGStartInfo AsReadOnly() - { - return new WIGStartInfo(this) { _readOnly = true }; - } - } -} diff --git a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs b/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs deleted file mode 100644 index 6374d94ed62..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItem.WorkItemResult.cs +++ /dev/null @@ -1,180 +0,0 @@ -using System; -using System.Threading; - -namespace Amib.Threading.Internal -{ - public partial class WorkItem - { - #region WorkItemResult class - - private class WorkItemResult : IWorkItemResult, IInternalWorkItemResult, IInternalWaitableResult - { - /// - /// A back reference to the work item - /// - private readonly WorkItem _workItem; - - public WorkItemResult(WorkItem workItem) - { - _workItem = workItem; - } - - internal WorkItem GetWorkItem() - { - return _workItem; - } - - #region IWorkItemResult Members - - public bool IsCompleted - { - get - { - return _workItem.IsCompleted; - } - } - - public bool IsCanceled - { - get - { - return _workItem.IsCanceled; - } - } - - public object GetResult() - { - return _workItem.GetResult(Timeout.Infinite, true, null); - } - - public object GetResult(int millisecondsTimeout, bool exitContext) - { - return _workItem.GetResult(millisecondsTimeout, exitContext, null); - } - - public object GetResult(TimeSpan timeout, bool exitContext) - { - return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null); - } - - public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) - { - return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); - } - - public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) - { - return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle); - } - - public object GetResult(out Exception e) - { - return _workItem.GetResult(Timeout.Infinite, true, null, out e); - } - - public object GetResult(int millisecondsTimeout, bool exitContext, out Exception e) - { - return _workItem.GetResult(millisecondsTimeout, exitContext, null, out e); - } - - public object GetResult(TimeSpan timeout, bool exitContext, out Exception e) - { - return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, null, out e); - } - - public object GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) - { - return _workItem.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); - } - - public object GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) - { - return _workItem.GetResult((int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle, out e); - } - - public bool Cancel() - { - return Cancel(false); - } - - public bool Cancel(bool abortExecution) - { - return _workItem.Cancel(abortExecution); - } - - public object State - { - get - { - return _workItem.m_state; - } - } - - /// - /// Return the result, same as GetResult() - /// - public object Result - { - get { return GetResult(); } - } - - /// - /// Returns the exception if occured otherwise returns null. - /// This value is valid only after the work item completed, - /// before that it is always null. - /// - public object Exception - { - get { return _workItem.m_exception; } - } - - #endregion - - #region IInternalWorkItemResult Members - - public event WorkItemStateCallback OnWorkItemStarted - { - add - { - _workItem.OnWorkItemStarted += value; - } - remove - { - _workItem.OnWorkItemStarted -= value; - } - } - - - public event WorkItemStateCallback OnWorkItemCompleted - { - add - { - _workItem.OnWorkItemCompleted += value; - } - remove - { - _workItem.OnWorkItemCompleted -= value; - } - } - - #endregion - - #region IInternalWorkItemResult Members - - public IWorkItemResult GetWorkItemResult() - { - return this; - } - - public IWorkItemResult GetWorkItemResultT() - { - return new WorkItemResultTWrapper(this); - } - - #endregion - } - - #endregion - - } -} diff --git a/ThirdParty/SmartThreadPool/WorkItem.cs b/ThirdParty/SmartThreadPool/WorkItem.cs deleted file mode 100644 index db78b1019f2..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItem.cs +++ /dev/null @@ -1,974 +0,0 @@ -using System; -using System.Diagnostics; -using System.Threading; - -namespace Amib.Threading.Internal -{ - /// - /// Holds a callback delegate and the state for that delegate. - /// - public partial class WorkItem - { - #region WorkItemState enum - - /// - /// Indicates the state of the work item in the thread pool - /// - private enum WorkItemState - { - InQueue = 0, // Nexts: InProgress, Canceled - InProgress = 1, // Nexts: Completed, Canceled - Completed = 2, // Stays Completed - Canceled = 3, // Stays Canceled - } - - private static bool IsValidStatesTransition(WorkItemState currentState, WorkItemState nextState) - { - bool valid = false; - - switch (currentState) - { - case WorkItemState.InQueue: - valid = (WorkItemState.InProgress == nextState) || (WorkItemState.Canceled == nextState); - break; - case WorkItemState.InProgress: - valid = (WorkItemState.Completed == nextState) || (WorkItemState.Canceled == nextState); - break; - case WorkItemState.Completed: - case WorkItemState.Canceled: - // Cannot be changed - break; - default: - // Unknown state - Debug.Assert(false); - break; - } - - return valid; - } - - #endregion - - #region Fields - - /// - /// Callback delegate for the callback. - /// - private WorkItemCallback m_callback; - private WaitCallback m_callbackNoResult; - - /// - /// State with which to call the callback delegate. - /// - private object m_state; - - /// - /// Stores the caller's context - /// - private ExecutionContext m_callerContext = null; - - /// - /// Holds the result of the mehtod - /// - private object m_result; - - /// - /// Hold the exception if the method threw it - /// - private Exception m_exception; - - /// - /// Hold the state of the work item - /// - private WorkItemState m_workItemState; - - /// - /// A ManualResetEvent to indicate that the result is ready - /// - private ManualResetEvent m_workItemCompleted; - - /// - /// A reference count to the _workItemCompleted. - /// When it reaches to zero _workItemCompleted is Closed - /// - private int m_workItemCompletedRefCount; - - /// - /// Represents the result state of the work item - /// - private readonly WorkItemResult m_workItemResult; - - /// - /// Work item info - /// - private readonly WorkItemInfo m_workItemInfo; - - /// - /// Called when the WorkItem starts - /// - private event WorkItemStateCallback m_workItemStartedEvent; - - /// - /// Called when the WorkItem completes - /// - private event WorkItemStateCallback m_workItemCompletedEvent; - - /// - /// A reference to an object that indicates whatever the - /// WorkItemsGroup has been canceled - /// - private CanceledWorkItemsGroup m_canceledWorkItemsGroup = CanceledWorkItemsGroup.NotCanceledWorkItemsGroup; - - /// - /// A reference to an object that indicates whatever the - /// SmartThreadPool has been canceled - /// - private CanceledWorkItemsGroup m_canceledSmartThreadPool = CanceledWorkItemsGroup.NotCanceledWorkItemsGroup; - - /// - /// The work item group this work item belong to. - /// - private readonly IWorkItemsGroup m_workItemsGroup; - - /// - /// The thread that executes this workitem. - /// This field is available for the period when the work item is executed, before and after it is null. - /// - private Thread m_executingThread; - - /// - /// The absulote time when the work item will be timeout - /// - private long m_expirationTime; - - #region Performance Counter fields - - /// - /// Stores how long the work item waited on the stp queue - /// - private Stopwatch _waitingOnQueueStopwatch; - - /// - /// Stores how much time it took the work item to execute after it went out of the queue - /// - private Stopwatch _processingStopwatch; - - #endregion - - #endregion - - #region Properties - - public TimeSpan WaitingTime - { - get - { - return _waitingOnQueueStopwatch.Elapsed; - } - } - - public TimeSpan ProcessTime - { - get - { - return _processingStopwatch.Elapsed; - } - } - - internal WorkItemInfo WorkItemInfo - { - get - { - return m_workItemInfo; - } - } - - #endregion - - #region Construction - - /// - /// Initialize the callback holding object. - /// - /// The workItemGroup of the workitem - /// The WorkItemInfo of te workitem - /// Callback delegate for the callback. - /// State with which to call the callback delegate. - /// - /// We assume that the WorkItem object is created within the thread - /// that meant to run the callback - public WorkItem(IWorkItemsGroup workItemsGroup, WorkItemInfo workItemInfo, WorkItemCallback callback, object state) - { - m_workItemsGroup = workItemsGroup; - m_workItemInfo = workItemInfo; - - if (m_workItemInfo.UseCallerCallContext && !ExecutionContext.IsFlowSuppressed()) - { - ExecutionContext ec = ExecutionContext.Capture(); - if (ec is not null) - { - m_callerContext = ec.CreateCopy(); - ec.Dispose(); - ec = null; - } - } - - m_callback = callback; - m_callbackNoResult = null; - m_state = state; - m_workItemResult = new WorkItemResult(this); - Initialize(); - } - - public WorkItem(IWorkItemsGroup workItemsGroup, WorkItemInfo workItemInfo, WaitCallback callback, object state) - { - m_workItemsGroup = workItemsGroup; - m_workItemInfo = workItemInfo; - - if (m_workItemInfo.UseCallerCallContext && !ExecutionContext.IsFlowSuppressed()) - { - ExecutionContext ec = ExecutionContext.Capture(); - if (ec is not null) - { - m_callerContext = ec.CreateCopy(); - ec.Dispose(); - ec = null; - } - } - - m_callbackNoResult = callback; - m_state = state; - m_workItemResult = new WorkItemResult(this); - Initialize(); - } - - internal void Initialize() - { - // The _workItemState is changed directly instead of using the SetWorkItemState - // method since we don't want to go throught IsValidStateTransition. - m_workItemState = WorkItemState.InQueue; - - m_workItemCompleted = null; - m_workItemCompletedRefCount = 0; - _waitingOnQueueStopwatch = new Stopwatch(); - _processingStopwatch = new Stopwatch(); - m_expirationTime = m_workItemInfo.Timeout > 0 ? DateTime.UtcNow.Ticks + m_workItemInfo.Timeout * TimeSpan.TicksPerMillisecond : long.MaxValue; - } - - internal bool WasQueuedBy(IWorkItemsGroup workItemsGroup) - { - return (workItemsGroup == m_workItemsGroup); - } - - - #endregion - - #region Methods - - internal CanceledWorkItemsGroup CanceledWorkItemsGroup - { - get { return m_canceledWorkItemsGroup; } - set { m_canceledWorkItemsGroup = value; } - } - - internal CanceledWorkItemsGroup CanceledSmartThreadPool - { - get { return m_canceledSmartThreadPool; } - set { m_canceledSmartThreadPool = value; } - } - - /// - /// Change the state of the work item to in progress if it wasn't canceled. - /// - /// - /// Return true on success or false in case the work item was canceled. - /// If the work item needs to run a post execute then the method will return true. - /// - public bool StartingWorkItem() - { - _waitingOnQueueStopwatch.Stop(); - _processingStopwatch.Start(); - - lock (this) - { - if (IsCanceled) - { - if ((m_workItemInfo.PostExecuteWorkItemCallback is not null) && - ((m_workItemInfo.CallToPostExecute & CallToPostExecute.WhenWorkItemCanceled) == CallToPostExecute.WhenWorkItemCanceled)) - { - return true; - } - - return false; - } - - Debug.Assert(WorkItemState.InQueue == GetWorkItemState()); - - // No need for a lock yet, only after the state has changed to InProgress - m_executingThread = Thread.CurrentThread; - - SetWorkItemState(WorkItemState.InProgress); - } - - return true; - } - - /// - /// Execute the work item and the post execute - /// - public void Execute() - { - CallToPostExecute currentCallToPostExecute = 0; - - // Execute the work item if we are in the correct state - switch (GetWorkItemState()) - { - case WorkItemState.InProgress: - currentCallToPostExecute |= CallToPostExecute.WhenWorkItemNotCanceled; - ExecuteWorkItem(); - break; - case WorkItemState.Canceled: - currentCallToPostExecute |= CallToPostExecute.WhenWorkItemCanceled; - break; - default: - Debug.Assert(false); - throw new NotSupportedException(); - } - - // Run the post execute as needed - if ((currentCallToPostExecute & m_workItemInfo.CallToPostExecute) != 0) - { - PostExecute(); - } - - _processingStopwatch.Stop(); - } - - internal void FireWorkItemCompleted() - { - try - { - m_workItemCompletedEvent?.Invoke(this); - } - catch // Suppress exceptions - { } - } - - internal void FireWorkItemStarted() - { - try - { - m_workItemStartedEvent?.Invoke(this); - } - catch // Suppress exceptions - { } - } - - /// - /// Execute the work item - /// - private void ExecuteWorkItem() - { - Exception exception = null; - object result = null; - - try - { - try - { - if(m_callbackNoResult is null) - { - if(m_callerContext is null) - result = m_callback(m_state); - else - { - ContextCallback _ccb = new( o => { result =m_callback(o); }); - ExecutionContext.Run(m_callerContext, _ccb, m_state); - } - } - else - { - if (m_callerContext is null) - m_callbackNoResult(m_state); - else - { - ContextCallback _ccb = new(o => { m_callbackNoResult(o); }); - ExecutionContext.Run(m_callerContext, _ccb, m_state); - } - } - } - catch (Exception e) - { - // Save the exception so we can rethrow it later - exception = e; - } - - // Remove the value of the execution thread, so it will be impossible to cancel the work item, - // since it is already completed. - // Cancelling a work item that already completed may cause the abortion of the next work item!!! - Thread executionThread = Interlocked.CompareExchange(ref m_executingThread, null, m_executingThread); - - if (executionThread is null) - { - // Oops! we are going to be aborted..., Wait here so we can catch the ThreadAbortException - Thread.Sleep(60 * 1000); - - // If after 1 minute this thread was not aborted then let it continue working. - } - } - // We must treat the ThreadAbortException or else it will be stored in the exception variable - catch (ThreadAbortException tae) - { - // Check if the work item was cancelled - // If we got a ThreadAbortException and the STP is not shutting down, it means the - // work items was cancelled. - tae.GetHashCode(); - //if (!SmartThreadPool.CurrentThreadEntry.AssociatedSmartThreadPool.IsShuttingdown) - //{ - // Thread.ResetAbort(); - //} - } - if (!SmartThreadPool.IsWorkItemCanceled) - { - SetResult(result, exception); - } - } - - /// - /// Runs the post execute callback - /// - private void PostExecute() - { - if (m_workItemInfo.PostExecuteWorkItemCallback is not null) - { - try - { - m_workItemInfo.PostExecuteWorkItemCallback(m_workItemResult); - } - catch (Exception e) - { - Debug.Assert(e is not null); - } - } - } - - /// - /// Set the result of the work item to return - /// - /// The result of the work item - /// The exception that was throw while the workitem executed, null - /// if there was no exception. - internal void SetResult(object result, Exception exception) - { - m_result = result; - m_exception = exception; - SignalComplete(false); - } - - /// - /// Returns the work item result - /// - /// The work item result - internal IWorkItemResult GetWorkItemResult() - { - return m_workItemResult; - } - - /// - /// Wait for all work items to complete - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// true when every work item in waitableResults has completed; otherwise false. - /// - internal static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext, - WaitHandle cancelWaitHandle) - { - if (0 == waitableResults.Length) - { - return true; - } - - bool success; - WaitHandle[] waitHandles = new WaitHandle[waitableResults.Length]; - GetWaitHandles(waitableResults, waitHandles); - - if ((cancelWaitHandle is null) && (waitHandles.Length <= 64)) - { - success = STPEventWaitHandle.WaitAll(waitHandles, millisecondsTimeout, exitContext); - } - else - { - success = true; - int millisecondsLeft = millisecondsTimeout; - Stopwatch stopwatch = Stopwatch.StartNew(); - - WaitHandle[] whs = cancelWaitHandle is null ? - new WaitHandle[] { null } : - new WaitHandle[] { null, cancelWaitHandle }; - - bool waitInfinitely = (Timeout.Infinite == millisecondsTimeout); - // Iterate over the wait handles and wait for each one to complete. - // We cannot use WaitHandle.WaitAll directly, because the cancelWaitHandle - // won't affect it. - // Each iteration we update the time left for the timeout. - for (int i = 0; i < waitableResults.Length; ++i) - { - // WaitAny don't work with negative numbers - if (!waitInfinitely && (millisecondsLeft < 0)) - { - success = false; - break; - } - - whs[0] = waitHandles[i]; - int result = STPEventWaitHandle.WaitAny(whs, millisecondsLeft, exitContext); - if ((result > 0) || (STPEventWaitHandle.WaitTimeout == result)) - { - success = false; - break; - } - - if (!waitInfinitely) - { - // Update the time left to wait - millisecondsLeft = millisecondsTimeout - (int)stopwatch.ElapsedMilliseconds; - } - } - } - // Release the wait handles - ReleaseWaitHandles(waitableResults); - - return success; - } - - /// - /// Waits for any of the work items in the specified array to complete, cancel, or timeout - /// - /// Array of work item result objects - /// The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely. - /// - /// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false. - /// - /// A cancel wait handle to interrupt the wait if needed - /// - /// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled. - /// - internal static int WaitAny( IWaitableResult[] waitableResults, int millisecondsTimeout, - bool exitContext, WaitHandle cancelWaitHandle) - { - WaitHandle[] waitHandles; - if (cancelWaitHandle is not null) - { - waitHandles = new WaitHandle[waitableResults.Length + 1]; - GetWaitHandles(waitableResults, waitHandles); - waitHandles[waitableResults.Length] = cancelWaitHandle; - } - else - { - waitHandles = new WaitHandle[waitableResults.Length]; - GetWaitHandles(waitableResults, waitHandles); - } - - int result = STPEventWaitHandle.WaitAny(waitHandles, millisecondsTimeout, exitContext); - - // Treat cancel as timeout - if (cancelWaitHandle is not null) - { - if (result == waitableResults.Length) - { - result = STPEventWaitHandle.WaitTimeout; - } - } - - ReleaseWaitHandles(waitableResults); - - return result; - } - - /// - /// Fill an array of wait handles with the work items wait handles. - /// - /// An array of work item results - /// An array of wait handles to fill - private static void GetWaitHandles(IWaitableResult[] waitableResults, - WaitHandle[] waitHandles) - { - for (int i = 0; i < waitableResults.Length; ++i) - { - WorkItemResult wir = waitableResults[i].GetWorkItemResult() as WorkItemResult; - Debug.Assert(wir is not null, "All waitableResults must be WorkItemResult objects"); - - waitHandles[i] = wir.GetWorkItem().GetWaitHandle(); - } - } - - /// - /// Release the work items' wait handles - /// - /// An array of work item results - private static void ReleaseWaitHandles(IWaitableResult[] waitableResults) - { - for (int i = 0; i < waitableResults.Length; ++i) - { - WorkItemResult wir = (WorkItemResult)waitableResults[i].GetWorkItemResult(); - - wir.GetWorkItem().ReleaseWaitHandle(); - } - } - - #endregion - - #region Private Members - - private WorkItemState GetWorkItemState() - { - lock (this) - { - if (WorkItemState.Completed == m_workItemState) - { - return m_workItemState; - } - if (WorkItemState.Canceled != m_workItemState && DateTime.UtcNow.Ticks > m_expirationTime) - { - m_workItemState = WorkItemState.Canceled; - return m_workItemState; - } - if(WorkItemState.InProgress != m_workItemState) - { - if (CanceledSmartThreadPool.IsCanceled || CanceledWorkItemsGroup.IsCanceled) - { - return WorkItemState.Canceled; - } - } - return m_workItemState; - } - } - - - /// - /// Sets the work item's state - /// - /// The state to set the work item to - private void SetWorkItemState(WorkItemState workItemState) - { - lock (this) - { - if (IsValidStatesTransition(m_workItemState, workItemState)) - { - m_workItemState = workItemState; - } - } - } - - /// - /// Signals that work item has been completed or canceled - /// - /// Indicates that the work item has been canceled - private void SignalComplete(bool canceled) - { - SetWorkItemState(canceled ? WorkItemState.Canceled : WorkItemState.Completed); - lock (this) - { - // If someone is waiting then signal. - m_workItemCompleted?.Set(); - } - } - - internal void WorkItemIsQueued() - { - _waitingOnQueueStopwatch.Start(); - } - - #endregion - - #region Members exposed by WorkItemResult - - /// - /// Cancel the work item if it didn't start running yet. - /// - /// Returns true on success or false if the work item is in progress or already completed - private bool Cancel(bool abortExecution) - { - bool success = false; - bool signalComplete = false; - - lock (this) - { - switch (GetWorkItemState()) - { - case WorkItemState.Canceled: - //Debug.WriteLine("Work item already canceled"); - if (abortExecution) - { - Thread executionThread = Interlocked.CompareExchange(ref m_executingThread, null, m_executingThread); - if (executionThread is not null) - { - //executionThread.Abort(); // "Cancel" - // No need to signalComplete, because we already cancelled this work item - // so it already signaled its completion. - //signalComplete = true; - } - } - success = true; - break; - case WorkItemState.Completed: - //Debug.WriteLine("Work item cannot be canceled"); - break; - case WorkItemState.InProgress: - if (abortExecution) - { - Thread executionThread = Interlocked.CompareExchange(ref m_executingThread, null, m_executingThread); - if (executionThread is not null) - { - //executionThread.Abort(); // "Cancel" - success = true; - signalComplete = true; - } - } - else - { - // ************************** - // Stock SmartThreadPool 2.2.3 sets these to true and relies on the thread to check the - // WorkItem cancellation status. However, OpenSimulator uses a different mechanism to notify - // scripts of co-operative termination and the abort code also relies on this method - // returning false in order to implement a small wait. - // - // Therefore, as was the case previously with STP, we will not signal successful cancellation - // here. It's possible that OpenSimulator code could be changed in the future to remove - // the need for this change. - // ************************** - success = false; - signalComplete = false; - } - break; - case WorkItemState.InQueue: - // Signal to the wait for completion that the work - // item has been completed (canceled). There is no - // reason to wait for it to get out of the queue - signalComplete = true; - //Debug.WriteLine("Work item canceled"); - success = true; - break; - } - - if (signalComplete) - { - SignalComplete(true); - } - } - return success; - } - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits for the result, timeout, or cancel. - /// In case of error the method throws and exception - /// - /// The result of the work item - private object GetResult(int millisecondsTimeout, bool exitContext, - WaitHandle cancelWaitHandle) - { - object result = GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out Exception e); - if (e is not null) - { - throw new WorkItemResultException("The work item caused an excpetion, see the inner exception for details", e); - } - return result; - } - - /// - /// Get the result of the work item. - /// If the work item didn't run yet then the caller waits for the result, timeout, or cancel. - /// In case of error the e argument is filled with the exception - /// - /// The result of the work item - private object GetResult( int millisecondsTimeout, bool exitContext, - WaitHandle cancelWaitHandle, out Exception e) - { - e = null; - - // Check for cancel - if (WorkItemState.Canceled == GetWorkItemState()) - { - throw new WorkItemCancelException("Work item canceled"); - } - - // Check for completion - if (IsCompleted) - { - e = m_exception; - return m_result; - } - - // If no cancelWaitHandle is provided - if (cancelWaitHandle is null) - { - WaitHandle wh = GetWaitHandle(); - - bool timeout = !STPEventWaitHandle.WaitOne(wh, millisecondsTimeout, exitContext); - - ReleaseWaitHandle(); - - if (timeout) - { - throw new WorkItemTimeoutException("Work item timeout"); - } - } - else - { - WaitHandle wh = GetWaitHandle(); - int result = STPEventWaitHandle.WaitAny(new WaitHandle[] { wh, cancelWaitHandle }); - ReleaseWaitHandle(); - - switch (result) - { - case 0: - // The work item signaled - // Note that the signal could be also as a result of canceling the - // work item (not the get result) - break; - case 1: - case STPEventWaitHandle.WaitTimeout: - throw new WorkItemTimeoutException("Work item timeout"); - default: - Debug.Assert(false); - break; - - } - } - - // Check for cancel - if (WorkItemState.Canceled == GetWorkItemState()) - { - throw new WorkItemCancelException("Work item canceled"); - } - - Debug.Assert(IsCompleted); - - e = m_exception; - - // Return the result - return m_result; - } - - /// - /// A wait handle to wait for completion, cancel, or timeout - /// - private WaitHandle GetWaitHandle() - { - lock (this) - { - if (m_workItemCompleted is null) - { - m_workItemCompleted = new ManualResetEvent(IsCompleted); - } - ++m_workItemCompletedRefCount; - } - return m_workItemCompleted; - } - - private void ReleaseWaitHandle() - { - lock (this) - { - if (m_workItemCompleted is not null) - { - --m_workItemCompletedRefCount; - if (0 == m_workItemCompletedRefCount) - { - m_workItemCompleted.Close(); - m_workItemCompleted = null; - } - } - } - } - - /// - /// Returns true when the work item has completed or canceled - /// - private bool IsCompleted - { - get - { - lock (this) - { - WorkItemState workItemState = GetWorkItemState(); - return ((workItemState == WorkItemState.Completed) || - (workItemState == WorkItemState.Canceled)); - } - } - } - - /// - /// Returns true when the work item has canceled - /// - public bool IsCanceled - { - get - { - lock (this) - { - return (GetWorkItemState() == WorkItemState.Canceled); - } - } - } - - #endregion - - internal event WorkItemStateCallback OnWorkItemStarted - { - add - { - m_workItemStartedEvent += value; - } - remove - { - m_workItemStartedEvent -= value; - } - } - - internal event WorkItemStateCallback OnWorkItemCompleted - { - add - { - m_workItemCompletedEvent += value; - } - remove - { - m_workItemCompletedEvent -= value; - } - } - - public void DisposeOfState() - { - if(m_callerContext is not null) - { - m_callerContext.Dispose(); - m_callerContext = null; - } - - if(m_workItemCompleted is not null) - { - m_workItemCompleted.Dispose(); - m_workItemCompleted = null; - } - - if (m_workItemInfo.DisposeOfStateObjects) - { - if (m_state is IDisposable disp) - { - disp.Dispose(); - m_state = null; - } - } - m_callback = null; - m_callbackNoResult = null; - } - } -} diff --git a/ThirdParty/SmartThreadPool/WorkItemFactory.cs b/ThirdParty/SmartThreadPool/WorkItemFactory.cs deleted file mode 100644 index 539ae58ec8b..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemFactory.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Threading; -using System.Runtime.CompilerServices; - - -namespace Amib.Threading.Internal -{ - #region WorkItemFactory class - - public class WorkItemFactory - { - - public static WorkItem CreateWorkItem(IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, WorkItemInfo workItemInfo, - WaitCallback callback, object state) - { - ValidateCallback(callback); - ValidateCallback(workItemInfo.PostExecuteWorkItemCallback); - return new WorkItem(workItemsGroup, new WorkItemInfo(workItemInfo), callback, state); - - } - - public static WorkItem CreateWorkItem(IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, - WaitCallback callback, object state) - { - ValidateCallback(callback); - - WorkItemInfo workItemInfo = new() - { - UseCallerCallContext = wigStartInfo.UseCallerCallContext, - PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback, - CallToPostExecute = wigStartInfo.CallToPostExecute, - DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects, - }; - - return new WorkItem(workItemsGroup, workItemInfo, callback, state); - } - - /// - /// Create a new work item - /// - /// The WorkItemsGroup of this workitem - /// Work item group start information - /// A callback to execute - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem( IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, WorkItemCallback callback) - { - return CreateWorkItem(workItemsGroup, wigStartInfo, callback, null); - } - - /// - /// Create a new work item - /// - /// The WorkItemsGroup of this workitem - /// Work item group start information - /// Work item info - /// A callback to execute - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem( IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, - WorkItemInfo workItemInfo, WorkItemCallback callback) - { - return CreateWorkItem(workItemsGroup, wigStartInfo, workItemInfo, callback, null); - } - - /// - /// Create a new work item - /// - /// The WorkItemsGroup of this workitem - /// Work item group start information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem( IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, - WorkItemCallback callback, object state) - { - ValidateCallback(callback); - - WorkItemInfo workItemInfo = new() - { - UseCallerCallContext = wigStartInfo.UseCallerCallContext, - PostExecuteWorkItemCallback = wigStartInfo.PostExecuteWorkItemCallback, - CallToPostExecute = wigStartInfo.CallToPostExecute, - DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects, - }; - - return new WorkItem( workItemsGroup, workItemInfo, callback, state); - } - - /// - /// Create a new work item - /// - /// The work items group - /// Work item group start information - /// Work item information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem( IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, WorkItemInfo workItemInfo, - WorkItemCallback callback, object state) - { - ValidateCallback(callback); - ValidateCallback(workItemInfo.PostExecuteWorkItemCallback); - - WorkItem workItem = new( - workItemsGroup, - new WorkItemInfo(workItemInfo), - callback, - state); - - return workItem; - } - - /// - /// Create a new work item - /// - /// The work items group - /// Work item group start information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem(IWorkItemsGroup workItemsGroup, WIGStartInfo wigStartInfo, - WorkItemCallback callback, object state,PostExecuteWorkItemCallback postExecuteWorkItemCallback) - { - ValidateCallback(callback); - ValidateCallback(postExecuteWorkItemCallback); - - WorkItemInfo workItemInfo = new() - { - UseCallerCallContext = wigStartInfo.UseCallerCallContext, - PostExecuteWorkItemCallback = postExecuteWorkItemCallback, - CallToPostExecute = wigStartInfo.CallToPostExecute, - DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects - }; - - return new WorkItem( workItemsGroup, workItemInfo, callback, state); - } - - /// - /// Create a new work item - /// - /// The work items group - /// Work item group start information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Indicates on which cases to call to the post execute callback - /// Returns a work item - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static WorkItem CreateWorkItem(IWorkItemsGroup workItemsGroup,WIGStartInfo wigStartInfo, - WorkItemCallback callback, object state, - PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute) - { - ValidateCallback(callback); - ValidateCallback(postExecuteWorkItemCallback); - - WorkItemInfo workItemInfo = new() - { - UseCallerCallContext = wigStartInfo.UseCallerCallContext, - PostExecuteWorkItemCallback = postExecuteWorkItemCallback, - CallToPostExecute = callToPostExecute, - DisposeOfStateObjects = wigStartInfo.DisposeOfStateObjects - }; - - return new WorkItem(workItemsGroup, workItemInfo, callback, state); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ValidateCallback(Delegate callback) - { - if (callback is not null && callback.GetInvocationList().Length > 1) - { - throw new NotSupportedException("SmartThreadPool doesn't support delegates chains"); - } - } - } - - #endregion -} diff --git a/ThirdParty/SmartThreadPool/WorkItemInfo.cs b/ThirdParty/SmartThreadPool/WorkItemInfo.cs deleted file mode 100644 index 405ac5d3605..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -namespace Amib.Threading -{ - #region WorkItemInfo class - - /// - /// Summary description for WorkItemInfo. - /// - public class WorkItemInfo - { - public WorkItemInfo() - { - UseCallerCallContext = SmartThreadPool.DefaultUseCallerCallContext; - DisposeOfStateObjects = SmartThreadPool.DefaultDisposeOfStateObjects; - CallToPostExecute = SmartThreadPool.DefaultCallToPostExecute; - PostExecuteWorkItemCallback = SmartThreadPool.DefaultPostExecuteWorkItemCallback; - } - - public WorkItemInfo(WorkItemInfo workItemInfo) - { - UseCallerCallContext = workItemInfo.UseCallerCallContext; - DisposeOfStateObjects = workItemInfo.DisposeOfStateObjects; - CallToPostExecute = workItemInfo.CallToPostExecute; - PostExecuteWorkItemCallback = workItemInfo.PostExecuteWorkItemCallback; - Timeout = workItemInfo.Timeout; - } - - /// - /// Get/Set if to use the caller's security context - /// - public bool UseCallerCallContext { get; set; } - - /// - /// Get/Set if to dispose of the state object of a work item - /// - public bool DisposeOfStateObjects { get; set; } - - /// - /// Get/Set the run the post execute options - /// - public CallToPostExecute CallToPostExecute { get; set; } - - /// - /// Get/Set the post execute callback - /// - public PostExecuteWorkItemCallback PostExecuteWorkItemCallback { get; set; } - - /// - /// Get/Set the work item's timout in milliseconds. - /// This is a passive timout. When the timout expires the work item won't be actively aborted! - /// - public long Timeout { get; set; } - } - - #endregion -} diff --git a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs b/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs deleted file mode 100644 index 45d11ea15c5..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemResultTWrapper.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Threading; - -namespace Amib.Threading.Internal -{ - #region WorkItemResultTWrapper class - - internal class WorkItemResultTWrapper : IWorkItemResult, IInternalWaitableResult - { - private readonly IWorkItemResult _workItemResult; - - public WorkItemResultTWrapper(IWorkItemResult workItemResult) - { - _workItemResult = workItemResult; - } - - #region IWorkItemResult Members - - public TResult GetResult() - { - return (TResult)_workItemResult.GetResult(); - } - - public TResult GetResult(int millisecondsTimeout, bool exitContext) - { - return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext); - } - - public TResult GetResult(TimeSpan timeout, bool exitContext) - { - return (TResult)_workItemResult.GetResult(timeout, exitContext); - } - - public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle) - { - return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle); - } - - public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle) - { - return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle); - } - - public TResult GetResult(out Exception e) - { - return (TResult)_workItemResult.GetResult(out e); - } - - public TResult GetResult(int millisecondsTimeout, bool exitContext, out Exception e) - { - return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, out e); - } - - public TResult GetResult(TimeSpan timeout, bool exitContext, out Exception e) - { - return (TResult)_workItemResult.GetResult(timeout, exitContext, out e); - } - - public TResult GetResult(int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) - { - return (TResult)_workItemResult.GetResult(millisecondsTimeout, exitContext, cancelWaitHandle, out e); - } - - public TResult GetResult(TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle, out Exception e) - { - return (TResult)_workItemResult.GetResult(timeout, exitContext, cancelWaitHandle, out e); - } - - public bool IsCompleted - { - get { return _workItemResult.IsCompleted; } - } - - public bool IsCanceled - { - get { return _workItemResult.IsCanceled; } - } - - public object State - { - get { return _workItemResult.State; } - } - - public bool Cancel() - { - return _workItemResult.Cancel(); - } - - public bool Cancel(bool abortExecution) - { - return _workItemResult.Cancel(abortExecution); - } - - public TResult Result - { - get { return (TResult)_workItemResult.Result; } - } - - public object Exception - { - get { return (TResult)_workItemResult.Exception; } - } - - #region IInternalWorkItemResult Members - - public IWorkItemResult GetWorkItemResult() - { - return _workItemResult.GetWorkItemResult(); - } - - public IWorkItemResult GetWorkItemResultT() - { - return (IWorkItemResult)this; - } - - #endregion - - #endregion - } - - #endregion - -} diff --git a/ThirdParty/SmartThreadPool/WorkItemsGroup.cs b/ThirdParty/SmartThreadPool/WorkItemsGroup.cs deleted file mode 100644 index e22756313e1..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemsGroup.cs +++ /dev/null @@ -1,354 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Runtime.CompilerServices; -using System.Diagnostics; - -namespace Amib.Threading.Internal -{ - - #region WorkItemsGroup class - - /// - /// Summary description for WorkItemsGroup. - /// - public class WorkItemsGroup : WorkItemsGroupBase - { - #region Private members - - private readonly object _lock = new(); - - /// - /// A reference to the SmartThreadPool instance that created this - /// WorkItemsGroup. - /// - private readonly SmartThreadPool _stp; - - /// - /// The OnIdle event - /// - private event WorkItemsGroupIdleHandler _onIdle; - - /// - /// A flag to indicate if the Work Items Group is now suspended. - /// - private bool _isSuspended; - - /// - /// Defines how many work items of this WorkItemsGroup can run at once. - /// - private int _concurrency; - - /// - /// Priority queue to hold work items before they are passed - /// to the SmartThreadPool. - /// - private readonly Queue _workItemsQueue; - - /// - /// Indicate how many work items are waiting in the SmartThreadPool - /// queue. - /// This value is used to apply the concurrency. - /// - private int _workItemsInStpQueue; - - /// - /// Indicate how many work items are currently running in the SmartThreadPool. - /// This value is used with the Cancel, to calculate if we can send new - /// work items to the STP. - /// - private int _workItemsExecutingInStp = 0; - - /// - /// WorkItemsGroup start information - /// - private readonly WIGStartInfo _workItemsGroupStartInfo; - - /// - /// Signaled when all of the WorkItemsGroup's work item completed. - /// - private readonly ManualResetEvent _isIdleWaitHandle = new(true); - - /// - /// A common object for all the work items that this work items group - /// generate so we can mark them to cancel in O(1) - /// - private CanceledWorkItemsGroup _canceledWorkItemsGroup = new(); - - #endregion - - #region Construction - - public WorkItemsGroup(SmartThreadPool stp, int concurrency, WIGStartInfo wigStartInfo) - { - if (concurrency <= 0) - { - throw new ArgumentOutOfRangeException( - "concurrency", - concurrency, - "concurrency must be greater than zero"); - } - _stp = stp; - _concurrency = concurrency; - _workItemsGroupStartInfo = new WIGStartInfo(wigStartInfo).AsReadOnly(); - _workItemsQueue = new Queue(); - Name = "WorkItemsGroup"; - - // The _workItemsInStpQueue gets the number of currently executing work items, - // because once a work item is executing, it cannot be cancelled. - _workItemsInStpQueue = _workItemsExecutingInStp; - - _isSuspended = _workItemsGroupStartInfo.StartSuspended; - } - - #endregion - - #region WorkItemsGroupBase Overrides - - public override int Concurrency - { - get { return _concurrency; } - set - { - Debug.Assert(value > 0); - - int diff = value - _concurrency; - _concurrency = value; - if (diff > 0) - { - EnqueueToSTPNextNWorkItem(diff); - } - } - } - - public override int WaitingCallbacks - { - get { return _workItemsQueue.Count; } - } - - public override object[] GetStates() - { - lock (_lock) - { - object[] states = new object[_workItemsQueue.Count]; - int i = 0; - foreach (WorkItem workItem in _workItemsQueue) - { - states[i] = workItem.GetWorkItemResult().State; - ++i; - } - return states; - } - } - - /// - /// WorkItemsGroup start information - /// - public override WIGStartInfo WIGStartInfo - { - get { return _workItemsGroupStartInfo; } - } - - /// - /// Start the Work Items Group if it was started suspended - /// - public override void Start() - { - // If the Work Items Group already started then quit - if (!_isSuspended) - { - return; - } - _isSuspended = false; - - EnqueueToSTPNextNWorkItem(Math.Min(_workItemsQueue.Count, _concurrency)); - } - - public override void Cancel(bool abortExecution) - { - lock (_lock) - { - _canceledWorkItemsGroup.IsCanceled = true; - _workItemsQueue.Clear(); - _workItemsInStpQueue = 0; - _canceledWorkItemsGroup = new CanceledWorkItemsGroup(); - } - - if (abortExecution) - { - _stp.CancelAbortWorkItemsGroup(this); - } - } - - /// - /// Wait for the thread pool to be idle - /// - public override bool WaitForIdle(int millisecondsTimeout) - { - SmartThreadPool.ValidateWorkItemsGroupWaitForIdle(this); - return STPEventWaitHandle.WaitOne(_isIdleWaitHandle, millisecondsTimeout, false); - } - - public override event WorkItemsGroupIdleHandler OnIdle - { - add { _onIdle += value; } - remove { _onIdle -= value; } - } - - #endregion - - #region Private methods - - private void RegisterToWorkItemCompletion(IWorkItemResult wir) - { - IInternalWorkItemResult iwir = (IInternalWorkItemResult)wir; - iwir.OnWorkItemStarted += OnWorkItemStartedCallback; - iwir.OnWorkItemCompleted += OnWorkItemCompletedCallback; - } - - public void OnSTPIsStarting() - { - if (_isSuspended) - { - return; - } - - EnqueueToSTPNextNWorkItem(_concurrency); - } - - public void EnqueueToSTPNextNWorkItem(int count) - { - for (int i = 0; i < count; ++i) - { - EnqueueToSTPNextWorkItem(null, false); - } - } - - private object FireOnIdle(object state) - { - FireOnIdleImpl(_onIdle); - return null; - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private void FireOnIdleImpl(WorkItemsGroupIdleHandler onIdle) - { - if(onIdle is null) - return; - - Delegate[] delegates = onIdle.GetInvocationList(); - foreach(WorkItemsGroupIdleHandler eh in delegates) - { - try - { - eh(this); - } - catch { } // Suppress exceptions - } - } - - private void OnWorkItemStartedCallback(WorkItem workItem) - { - lock(_lock) - { - ++_workItemsExecutingInStp; - } - } - - private void OnWorkItemCompletedCallback(WorkItem workItem) - { - EnqueueToSTPNextWorkItem(null, true); - } - - internal override void Enqueue(WorkItem workItem) - { - EnqueueToSTPNextWorkItem(workItem); - } - - private void EnqueueToSTPNextWorkItem(WorkItem workItem) - { - EnqueueToSTPNextWorkItem(workItem, false); - } - - private void EnqueueToSTPNextWorkItem(WorkItem workItem, bool decrementWorkItemsInStpQueue) - { - lock(_lock) - { - // Got here from OnWorkItemCompletedCallback() - if (decrementWorkItemsInStpQueue) - { - --_workItemsInStpQueue; - - if(_workItemsInStpQueue < 0) - { - _workItemsInStpQueue = 0; - } - - --_workItemsExecutingInStp; - - if(_workItemsExecutingInStp < 0) - { - _workItemsExecutingInStp = 0; - } - } - - // If the work item is not null then enqueue it - if (workItem is not null) - { - workItem.CanceledWorkItemsGroup = _canceledWorkItemsGroup; - - RegisterToWorkItemCompletion(workItem.GetWorkItemResult()); - _workItemsQueue.Enqueue(workItem); - //_stp.IncrementWorkItemsCount(); - - if ((1 == _workItemsQueue.Count) && - (0 == _workItemsInStpQueue)) - { - _stp.RegisterWorkItemsGroup(this); - IsIdle = false; - _isIdleWaitHandle.Reset(); - } - } - - // If the work items queue of the group is empty than quit - if (0 == _workItemsQueue.Count) - { - if (0 == _workItemsInStpQueue) - { - _stp.UnregisterWorkItemsGroup(this); - IsIdle = true; - _isIdleWaitHandle.Set(); - if (decrementWorkItemsInStpQueue && _onIdle is not null && _onIdle.GetInvocationList().Length > 0) - { - _stp.QueueWorkItem(new WorkItemCallback(FireOnIdle)); - } - } - return; - } - - if (!_isSuspended) - { - if (_workItemsInStpQueue < _concurrency) - { - WorkItem nextWorkItem = _workItemsQueue.Dequeue(); - try - { - _stp.Enqueue(nextWorkItem); - } - catch (ObjectDisposedException e) - { - e.GetHashCode(); - // The STP has been shutdown - } - - ++_workItemsInStpQueue; - } - } - } - } - - #endregion - } - - #endregion -} diff --git a/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs b/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs deleted file mode 100644 index c7db400d20f..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemsGroupBase.cs +++ /dev/null @@ -1,388 +0,0 @@ -using System; -using System.Threading; - -namespace Amib.Threading.Internal -{ - public abstract class WorkItemsGroupBase : IWorkItemsGroup - { - #region Private Fields - - /// - /// Contains the name of this instance of SmartThreadPool. - /// Can be changed by the user. - /// - private string _name = "WorkItemsGroupBase"; - - public WorkItemsGroupBase() - { - IsIdle = true; - } - - #endregion - - #region IWorkItemsGroup Members - - #region Public Methods - - /// - /// Get/Set the name of the SmartThreadPool/WorkItemsGroup instance - /// - public string Name - { - get { return _name; } - set { _name = value; } - } - - public int localID { get; set;} - #endregion - - #region Abstract Methods - - public abstract int Concurrency { get; set; } - public abstract int WaitingCallbacks { get; } - public abstract object[] GetStates(); - public abstract WIGStartInfo WIGStartInfo { get; } - public abstract void Start(); - public abstract void Cancel(bool abortExecution); - public abstract bool WaitForIdle(int millisecondsTimeout); - public abstract event WorkItemsGroupIdleHandler OnIdle; - - internal abstract void Enqueue(WorkItem workItem); - internal virtual void PreQueueWorkItem() { } - - #endregion - - #region Common Base Methods - - /// - /// Cancel all the work items. - /// Same as Cancel(false) - /// - public virtual void Cancel() - { - Cancel(false); - } - - /// - /// Wait for the SmartThreadPool/WorkItemsGroup to be idle - /// - public void WaitForIdle() - { - WaitForIdle(Timeout.Infinite); - } - - /// - /// Wait for the SmartThreadPool/WorkItemsGroup to be idle - /// - public bool WaitForIdle(TimeSpan timeout) - { - return WaitForIdle((int)timeout.TotalMilliseconds); - } - - /// - /// IsIdle is true when there are no work items running or queued. - /// - public bool IsIdle { get; protected set; } - - #endregion - - #region QueueWorkItem - - public IWorkItemResult QueueWorkItem(WaitCallback callback) - { - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, null); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - public IWorkItemResult QueueWorkItem(WaitCallback callback, object state) - { - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, workItemInfo, callback, null); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WaitCallback callback, object state) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, workItemInfo, callback, state); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - /// - /// Queue a work item - /// - /// A callback to execute - /// Returns a work item result - public IWorkItemResult QueueWorkItem(WorkItemCallback callback) - { - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - /// - /// Queue a work item - /// - /// Work item info - /// A callback to execute - /// Returns a work item result - public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, workItemInfo, callback); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item result - public IWorkItemResult QueueWorkItem(WorkItemCallback callback, object state) - { - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - /// - /// Queue a work item - /// - /// Work item information - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// Returns a work item result - public IWorkItemResult QueueWorkItem(WorkItemInfo workItemInfo, WorkItemCallback callback, object state) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, workItemInfo, callback, state); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Returns a work item result - public IWorkItemResult QueueWorkItem( WorkItemCallback callback, object state, - PostExecuteWorkItemCallback postExecuteWorkItemCallback) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, postExecuteWorkItemCallback); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - - /// - /// Queue a work item - /// - /// A callback to execute - /// - /// The context object of the work item. Used for passing arguments to the work item. - /// - /// - /// A delegate to call after the callback completion - /// - /// Indicates on which cases to call to the post execute callback - /// Returns a work item result - public IWorkItemResult QueueWorkItem( WorkItemCallback callback, object state, - PostExecuteWorkItemCallback postExecuteWorkItemCallback, CallToPostExecute callToPostExecute) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem(this, WIGStartInfo, callback, state, postExecuteWorkItemCallback, callToPostExecute); - Enqueue(workItem); - return workItem.GetWorkItemResult(); - } - - #endregion - - #region QueueWorkItem(Action<...>) - - public IWorkItemResult QueueWorkItem (Action action) - { - PreQueueWorkItem (); - WorkItem workItem = WorkItemFactory.CreateWorkItem ( - this, - WIGStartInfo, - delegate - { - action.Invoke (); - return null; - }); - Enqueue (workItem); - return workItem.GetWorkItemResult (); - } - - public IWorkItemResult QueueWorkItem (Action action, T arg) - { - PreQueueWorkItem (); - WorkItem workItem = WorkItemFactory.CreateWorkItem ( - this, - WIGStartInfo, - state => - { - action.Invoke (arg); - return null; - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null); - Enqueue (workItem); - return workItem.GetWorkItemResult (); - } - - public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2) - { - PreQueueWorkItem (); - WorkItem workItem = WorkItemFactory.CreateWorkItem ( - this, - WIGStartInfo, - state => - { - action.Invoke (arg1, arg2); - return null; - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null); - Enqueue (workItem); - return workItem.GetWorkItemResult (); - } - - public IWorkItemResult QueueWorkItem (Action action, T1 arg1, T2 arg2, T3 arg3) - { - PreQueueWorkItem (); - WorkItem workItem = WorkItemFactory.CreateWorkItem ( - this, - WIGStartInfo, - state => - { - action.Invoke (arg1, arg2, arg3); - return null; - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null); - Enqueue (workItem); - return workItem.GetWorkItemResult (); - } - - public IWorkItemResult QueueWorkItem ( - Action action, T1 arg1, T2 arg2, T3 arg3, T4 arg4) - { - PreQueueWorkItem (); - WorkItem workItem = WorkItemFactory.CreateWorkItem ( - this, - WIGStartInfo, - state => - { - action.Invoke (arg1, arg2, arg3, arg4); - return null; - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null); - Enqueue (workItem); - return workItem.GetWorkItemResult (); - } - - #endregion - - #region QueueWorkItem(Func<...>) - - public IWorkItemResult QueueWorkItem(Func func) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem( - this, - WIGStartInfo, - state => - { - return func.Invoke(); - }); - Enqueue(workItem); - return new WorkItemResultTWrapper(workItem.GetWorkItemResult()); - } - - public IWorkItemResult QueueWorkItem(Func func, T arg) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem( - this, - WIGStartInfo, - state => - { - return func.Invoke(arg); - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg } : null); - Enqueue(workItem); - return new WorkItemResultTWrapper(workItem.GetWorkItemResult()); - } - - public IWorkItemResult QueueWorkItem(Func func, T1 arg1, T2 arg2) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem( - this, - WIGStartInfo, - state => - { - return func.Invoke(arg1, arg2); - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2 } : null); - Enqueue(workItem); - return new WorkItemResultTWrapper(workItem.GetWorkItemResult()); - } - - public IWorkItemResult QueueWorkItem( - Func func, T1 arg1, T2 arg2, T3 arg3) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem( - this, - WIGStartInfo, - state => - { - return func.Invoke(arg1, arg2, arg3); - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3 } : null); - Enqueue(workItem); - return new WorkItemResultTWrapper(workItem.GetWorkItemResult()); - } - - public IWorkItemResult QueueWorkItem( - Func func, T1 arg1, T2 arg2, T3 arg3, T4 arg4) - { - PreQueueWorkItem(); - WorkItem workItem = WorkItemFactory.CreateWorkItem( - this, - WIGStartInfo, - state => - { - return func.Invoke(arg1, arg2, arg3, arg4); - }, - WIGStartInfo.FillStateWithArgs ? new object[] { arg1, arg2, arg3, arg4 } : null); - Enqueue(workItem); - return new WorkItemResultTWrapper(workItem.GetWorkItemResult()); - } - - #endregion - - #endregion - } -} \ No newline at end of file diff --git a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs b/ThirdParty/SmartThreadPool/WorkItemsQueue.cs deleted file mode 100644 index 38bed47d8a1..00000000000 --- a/ThirdParty/SmartThreadPool/WorkItemsQueue.cs +++ /dev/null @@ -1,561 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Runtime.CompilerServices; - -namespace Amib.Threading.Internal -{ - #region WorkItemsQueue class - - /// - /// WorkItemsQueue class. - /// - public class WorkItemsQueue : IDisposable - { - #region Member variables - - /// - /// Waiters queue (implemented as stack). - /// - private readonly WaiterEntry _headWaiterEntry = new(); - - /// - /// Waiters count - /// - private int _waitersCount = 0; - - /// - /// Work items queue - /// - private readonly Queue _workItems = new(); - - /// - /// Indicate that work items are allowed to be queued - /// - private bool _isWorkItemsQueueActive = true; - - [ThreadStatic] - private static WaiterEntry _waiterEntry; - - /// - /// A flag that indicates if the WorkItemsQueue has been disposed. - /// - private bool _isDisposed = false; - - #endregion - - #region Public properties - - /// - /// Returns the current number of work items in the queue - /// - public int Count - { - get - { - return _workItems.Count; - } - } - - /// - /// Returns the current number of waiters - /// - public int WaitersCount - { - get - { - return _waitersCount; - } - } - - - #endregion - - #region Public methods - - /// - /// Enqueue a work item to the queue. - /// - public bool EnqueueWorkItem(WorkItem workItem) - { - // A work item cannot be null, since null is used in the - // WaitForWorkItem() method to indicate timeout or cancel - if (workItem is null) - { - throw new ArgumentNullException("workItem", "workItem cannot be null"); - } - - // First check if there is a waiter waiting for work item. During - // the check, timed out waiters are ignored. If there is no - // waiter then the work item is queued. - lock (this) - { - ValidateNotDisposed(); - - if (!_isWorkItemsQueueActive) - return false; - - while (_waitersCount > 0) - { - // Dequeue a waiter. - WaiterEntry waiterEntry = PopWaiter(); - - // Signal the waiter. On success break the loop - if (waiterEntry.Signal(workItem)) - return true; - } - - // Enqueue the work item - _workItems.Enqueue(workItem); - } - return true; - } - - public void CloseThreadWaiter() - { - if(_waiterEntry is not null) - { - _waiterEntry.Close(); - _waiterEntry = null; - } - } - - - /// - /// Waits for a work item or exits on timeout or cancel - /// - /// Timeout in milliseconds - /// Cancel wait handle - /// Returns true if the resource was granted - public WorkItem DequeueWorkItem( int millisecondsTimeout, WaitHandle cancelEvent) - { - // This method cause the caller to wait for a work item. - // If there is at least one waiting work item then the - // method returns immidiately with it. - // - // If there are no waiting work items then the caller - // is queued between other waiters for a work item to arrive. - // - // If a work item didn't come within millisecondsTimeout or - // the user canceled the wait by signaling the cancelEvent - // then the method returns null to indicate that the caller - // didn't get a work item. - - WaiterEntry waiterEntry; - lock (this) - { - ValidateNotDisposed(); - - // If there are waiting work items then take one and return. - if (_workItems.Count > 0) - return _workItems.Dequeue(); - - // No waiting work items ... - - // Get the waiter entry for the waiters queue - waiterEntry = GetThreadWaiterEntry(); - - // Put the waiter with the other waiters - PushWaiter(waiterEntry); - } - - // Prepare array of wait handle for the WaitHandle.WaitAny() - WaitHandle[] waitHandles = new WaitHandle[] { waiterEntry.WaitHandle, cancelEvent }; - - // Wait for an available resource, cancel event, or timeout. - - // During the wait we are supposes to exit the synchronization - // domain. (Placing true as the third argument of the WaitAny()) - // It just doesn't work, I don't know why, so I have two lock(this) - // statments instead of one. - - int index = STPEventWaitHandle.WaitAny( waitHandles, millisecondsTimeout, true); - - lock (this) - { - // On timeout update the waiterEntry that it is timed out - if (index != 0) - { - // The Timeout() fails if the waiter has already been signaled - // On timeout remove the waiter from the queue. - // Note that the complexity is O(1). - if (waiterEntry.Timeout()) - { - RemoveWaiter(waiterEntry, false); - return null; - } - } - - // On success return the work item - WorkItem workItem = waiterEntry.WorkItem; - workItem ??= _workItems.Dequeue(); - - return workItem; - } - } - - /// - /// Cleanup the work items queue, hence no more work - /// items are allowed to be queue - /// - private void Cleanup() - { - lock (this) - { - // Deactivate only once - if (!_isWorkItemsQueueActive) - { - return; - } - - // Don't queue more work items - _isWorkItemsQueueActive = false; - - foreach (WorkItem workItem in _workItems) - { - workItem.DisposeOfState(); - } - - // Clear the work items that are already queued - _workItems.Clear(); - - // Note: - // I don't iterate over the queue and dispose of work items's states, - // since if a work item has a state object that is still in use in the - // application then I must not dispose it. - - // Tell the waiters that they were timed out. - // It won't signal them to exit, but to ignore their - // next work item. - while (_waitersCount > 0) - { - WaiterEntry waiterEntry = PopWaiter(); - waiterEntry.Timeout(); - } - } - } - - public object[] GetStates() - { - lock (this) - { - object[] states = new object[_workItems.Count]; - int i = 0; - foreach (WorkItem workItem in _workItems) - { - states[i] = workItem.GetWorkItemResult().State; - ++i; - } - return states; - } - } - - #endregion - - #region Private methods - - /// - /// Returns the WaiterEntry of the current thread - /// - /// - /// In order to avoid creation and destuction of WaiterEntry - /// objects each thread has its own WaiterEntry object. - private static WaiterEntry GetThreadWaiterEntry() - { - if (_waiterEntry is null) - { - _waiterEntry = new WaiterEntry(); - } - else - _waiterEntry.Reset(); - return _waiterEntry; - } - - #region Waiters stack methods - - /// - /// Push a new waiter into the waiter's stack - /// - /// A waiter to put in the stack - public void PushWaiter(WaiterEntry newWaiterEntry) - { - // Remove the waiter if it is already in the stack and - // update waiter's count as needed - RemoveWaiter(newWaiterEntry, false); - - // If the stack is empty then newWaiterEntry is the new head of the stack - if (_headWaiterEntry._nextWaiterEntry is null) - { - _headWaiterEntry._nextWaiterEntry = newWaiterEntry; - newWaiterEntry._prevWaiterEntry = _headWaiterEntry; - } - // If the stack is not empty then put newWaiterEntry as the new head - // of the stack. - else - { - // Save the old first waiter entry - WaiterEntry oldFirstWaiterEntry = _headWaiterEntry._nextWaiterEntry; - - // Update the links - _headWaiterEntry._nextWaiterEntry = newWaiterEntry; - newWaiterEntry._nextWaiterEntry = oldFirstWaiterEntry; - newWaiterEntry._prevWaiterEntry = _headWaiterEntry; - oldFirstWaiterEntry._prevWaiterEntry = newWaiterEntry; - } - - // Increment the number of waiters - ++_waitersCount; - } - - /// - /// Pop a waiter from the waiter's stack - /// - /// Returns the first waiter in the stack - private WaiterEntry PopWaiter() - { - // Store the current stack head - WaiterEntry oldFirstWaiterEntry = _headWaiterEntry._nextWaiterEntry; - - // Store the new stack head - WaiterEntry newHeadWaiterEntry = oldFirstWaiterEntry._nextWaiterEntry; - - // Update the old stack head list links and decrement the number - // waiters. - RemoveWaiter(oldFirstWaiterEntry, true); - - // Update the new stack head - _headWaiterEntry._nextWaiterEntry = newHeadWaiterEntry; - if (newHeadWaiterEntry is not null) - { - newHeadWaiterEntry._prevWaiterEntry = _headWaiterEntry; - } - - // Return the old stack head - return oldFirstWaiterEntry; - } - - /// - /// Remove a waiter from the stack - /// - /// A waiter entry to remove - /// If true the waiter count is always decremented - private void RemoveWaiter(WaiterEntry waiterEntry, bool popDecrement) - { - // Store the prev entry in the list - WaiterEntry prevWaiterEntry = waiterEntry._prevWaiterEntry; - waiterEntry._prevWaiterEntry = null; - - // Store the next entry in the list - WaiterEntry nextWaiterEntry = waiterEntry._nextWaiterEntry; - waiterEntry._nextWaiterEntry = null; - - // popDecrement indicate if we need to decrement the waiters count. - // If we got here from PopWaiter then we must decrement. - // If we got here from PushWaiter then we decrement only if - // the waiter was already in the stack. - - // If the waiter entry had a prev link then update it. - // It also means that the waiter is already in the list and we - // need to decrement the waiters count. - if (prevWaiterEntry is not null) - { - prevWaiterEntry._nextWaiterEntry = nextWaiterEntry; - popDecrement = true; - } - - // If the waiter entry had a next link then update it. - // It also means that the waiter is already in the list and we - // need to decrement the waiters count. - if (nextWaiterEntry is not null) - { - nextWaiterEntry._prevWaiterEntry = prevWaiterEntry; - popDecrement = true; - } - - // Decrement the waiters count if needed - if (popDecrement) - --_waitersCount; - } - - #endregion - - #endregion - - #region WaiterEntry class - - // A waiter entry in the _waiters queue. - public sealed class WaiterEntry : IDisposable - { - #region Member variables - - /// - /// Event to signal the waiter that it got the work item. - /// - private AutoResetEvent _waitHandle = new(false); - - /// - /// Flag to know if this waiter already quited from the queue - /// because of a timeout. - /// - private bool _isTimedout = false; - - /// - /// Flag to know if the waiter was signaled and got a work item. - /// - private bool _isSignaled = false; - - /// - /// A work item that passed directly to the waiter withou going - /// through the queue - /// - private WorkItem _workItem = null; - - private bool _isDisposed = false; - - // Linked list members - internal WaiterEntry _nextWaiterEntry = null; - internal WaiterEntry _prevWaiterEntry = null; - - #endregion - - #region Construction - - public WaiterEntry() - { - } - - #endregion - - #region Public methods - - public WaitHandle WaitHandle - { - get { return _waitHandle; } - } - - public WorkItem WorkItem - { - get - { - return _workItem; - } - } - - /// - /// Signal the waiter that it got a work item. - /// - /// Return true on success - /// The method fails if Timeout() preceded its call - public bool Signal(WorkItem workItem) - { - lock (this) - { - if (_isTimedout) - return false; - - _workItem = workItem; - _isSignaled = true; - _waitHandle.Set(); - return true; - } - } - - /// - /// Mark the wait entry that it has been timed out - /// - /// Return true on success - /// The method fails if Signal() preceded its call - public bool Timeout() - { - lock (this) - { - // Time out can happen only if the waiter wasn't marked as - // signaled - if (_isSignaled) - return false; - - // We don't remove the waiter from the queue, the DequeueWorkItem - // method skips _waiters that were timed out. - _isTimedout = true; - return true; - } - } - - /// - /// Reset the wait entry so it can be used again - /// - public void Reset() - { - _workItem = null; - _isTimedout = false; - _isSignaled = false; - _waitHandle.Reset(); - } - - /// - /// Free resources - /// - public void Close() - { - _workItem = null; - if (_waitHandle is not null) - { - _waitHandle.Close(); - _waitHandle = null; - } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - lock (this) - { - if (!_isDisposed) - { - Close(); - _isDisposed = true; - } - } - } - - #endregion - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!_isDisposed) - { - _isDisposed = true; - Cleanup(); - _headWaiterEntry.Close(); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void ValidateNotDisposed() - { - if (_isDisposed) - { - throw new ObjectDisposedException(GetType().ToString(), "The SmartThreadPool has been shutdown"); - } - } - - #endregion - } - - #endregion -} - diff --git a/ThirdPartyLicenses/Aurora-Sim.txt b/ThirdPartyLicenses/Aurora-Sim.txt deleted file mode 100644 index 162d552b90b..00000000000 --- a/ThirdPartyLicenses/Aurora-Sim.txt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors, http://aurora-sim.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 Aurora-Sim 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. - */ diff --git a/ThirdPartyLicenses/BclExtras.txt b/ThirdPartyLicenses/BclExtras.txt deleted file mode 100644 index a8a02925b12..00000000000 --- a/ThirdPartyLicenses/BclExtras.txt +++ /dev/null @@ -1,60 +0,0 @@ -MICROSOFT PUBLIC LICENSE (Ms-PL) - -This license governs use of the accompanying software. If you use the software, -you accept this license. If you do not accept the license, do not use the -software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" -have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the -software. - -A "contributor" is any person that distributes its contribution under this -license. - -"Licensed patents" are a contributor's patent claims that read directly on its -contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free copyright license to reproduce its -contribution, prepare derivative works of its contribution, and distribute its -contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license -conditions and limitations in section 3, each contributor grants you a -non-exclusive, worldwide, royalty-free license under its licensed patents to -make, have made, use, sell, offer for sale, import, and/or otherwise dispose of -its contribution in the software or derivative works of the contribution in the -software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any -contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you -claim are infringed by the software, your patent license from such contributor -to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all -copyright, patent, trademark, and attribution notices that are present in the -software. - -(D) If you distribute any portion of the software in source code form, you may -do so only under this license by including a complete copy of this license with -your distribution. If you distribute any portion of the software in compiled or -object code form, you may only do so under a license that complies with this -license. - -(E) The software is licensed "as-is." You bear the risk of using it. The -contributors give no express warranties, guarantees or conditions. You may have -additional consumer rights under your local laws which this license cannot -change. To the extent permitted under your local laws, the contributors exclude -the implied warranties of merchantability, fitness for a particular purpose and -non-infringement. diff --git a/ThirdPartyLicenses/Bullet for Xna (ModifiedBulletX).txt b/ThirdPartyLicenses/Bullet for Xna (ModifiedBulletX).txt deleted file mode 100644 index a8ed924e897..00000000000 --- a/ThirdPartyLicenses/Bullet for Xna (ModifiedBulletX).txt +++ /dev/null @@ -1,19 +0,0 @@ - Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru - Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - \ No newline at end of file diff --git a/ThirdPartyLicenses/Bullet-XNA.txt b/ThirdPartyLicenses/Bullet-XNA.txt deleted file mode 100644 index 5d8899ba57b..00000000000 --- a/ThirdPartyLicenses/Bullet-XNA.txt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * C# / XNA port of Bullet (c) 2011 Mark Neale - * http://code.google.com/p/bullet-xna/ - * - * Bullet Continuous Collision Detection and Physics Library - * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from - * the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ \ No newline at end of file diff --git a/ThirdPartyLicenses/BulletLicense.txt b/ThirdPartyLicenses/BulletLicense.txt deleted file mode 100644 index c3ec68c21fd..00000000000 --- a/ThirdPartyLicenses/BulletLicense.txt +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -Free for commercial use, but please mail bullet@erwincoumans.com to report projects, and join the forum at -www.continuousphysics.com/Bullet/phpBB2 diff --git a/ThirdPartyLicenses/C# Webserver.txt b/ThirdPartyLicenses/C# Webserver.txt deleted file mode 100644 index 9526ae1ed52..00000000000 --- a/ThirdPartyLicenses/C# Webserver.txt +++ /dev/null @@ -1,73 +0,0 @@ -Embedded http lister uses some code derived from Gauffin Telecom AB HttpServer - -Files: HttpServer_OpenSim.dll - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -1. You must give any other recipients of the Work or Derivative Works a copy of this License; and - -2. You must cause any modified files to carry prominent notices stating that You changed the files; and - -3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. \ No newline at end of file diff --git a/ThirdPartyLicenses/C5.txt b/ThirdPartyLicenses/C5.txt deleted file mode 100644 index 4c3a0496cad..00000000000 --- a/ThirdPartyLicenses/C5.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2003-2008 Niels Kokholm and Peter Sestoft. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE \ No newline at end of file diff --git a/ThirdPartyLicenses/CSCompilerTools.txt b/ThirdPartyLicenses/CSCompilerTools.txt deleted file mode 100644 index c2567bde0e7..00000000000 --- a/ThirdPartyLicenses/CSCompilerTools.txt +++ /dev/null @@ -1,12 +0,0 @@ -The LSL compiler is generated with "Compiler tools in C#" version 4.7[1] by Dr. Malcolm Crowe[2]. The code is used with permission by the author: - -There is no problem with using the code in any way you like, as long as -somewhere you say that that is what you have done (in the source for -example). -And of course we disclaim all responsibility for any resulting -damage... -Best wishes -Malcolm Crowe - -[1] http://cis.paisley.ac.uk/crow-ci0/CSTools47.zip -[2] http://cis.paisley.ac.uk/crow-ci0/ diff --git a/ThirdPartyLicenses/CSJ2K.txt b/ThirdPartyLicenses/CSJ2K.txt deleted file mode 100644 index 303254816bd..00000000000 --- a/ThirdPartyLicenses/CSJ2K.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 1999/2000 JJ2000 Partners. - -This software module was originally developed by Raphaël Grosbois and -Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel -Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David -Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research -Centre France S.A) in the course of development of the JPEG2000 -standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This -software module is an implementation of a part of the JPEG 2000 -Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio -Systems AB and Canon Research Centre France S.A (collectively JJ2000 -Partners) agree not to assert against ISO/IEC and users of the JPEG -2000 Standard (Users) any of their rights under the copyright, not -including other intellectual property rights, for this software module -with respect to the usage by ISO/IEC and Users of this software module -or modifications thereof for use in hardware or software products -claiming conformance to the JPEG 2000 Standard. Those intending to use -this software module in hardware or software products are advised that -their use may infringe existing patents. The original developers of -this software module, JJ2000 Partners and ISO/IEC assume no liability -for use of this software module or modifications thereof. No license -or right to this software module is granted for non JPEG 2000 Standard -conforming products. JJ2000 Partners have full right to use this -software module for his/her own purpose, assign or donate this -software module to any third party and to inhibit third parties from -using this software module for non JPEG 2000 Standard conforming -products. This copyright notice must be included in all copies or -derivative works of this software module. diff --git a/ThirdPartyLicenses/CircularBuffer.txt b/ThirdPartyLicenses/CircularBuffer.txt deleted file mode 100644 index 09c37d9ff4b..00000000000 --- a/ThirdPartyLicenses/CircularBuffer.txt +++ /dev/null @@ -1,16 +0,0 @@ -Copyright (c) 2012, Alex Regueiro -All rights reserved. -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR 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. \ No newline at end of file diff --git a/ThirdPartyLicenses/ConvexDecompositionDotNet.txt b/ThirdPartyLicenses/ConvexDecompositionDotNet.txt deleted file mode 100644 index 714ae898d87..00000000000 --- a/ThirdPartyLicenses/ConvexDecompositionDotNet.txt +++ /dev/null @@ -1,28 +0,0 @@ -ConvexDecompositionDotNet -------------------------- - -The MIT License - -Copyright (c) 2010 Intel Corporation. -All rights reserved. - -Based on the convexdecomposition library from - by John W. Ratcliff and Stan Melax. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/ThirdPartyLicenses/DefaultTerrain.txt b/ThirdPartyLicenses/DefaultTerrain.txt deleted file mode 100644 index 112beffa0b3..00000000000 --- a/ThirdPartyLicenses/DefaultTerrain.txt +++ /dev/null @@ -1,23 +0,0 @@ - COPYRIGHT AND PERMISSION NOTICE - -Second Life(TM) Viewer Artwork. Copyright (C) 2008 Linden Research, Inc. - -Linden Research, Inc. ("Linden Lab") licenses the Second Life viewer -artwork and other works in the files distributed with this Notice under -the Creative Commons Attribution-Share Alike 3.0 License, available at -http://creativecommons.org/licenses/by-sa/3.0/legalcode. [^] For the license -summary, see http://creativecommons.org/licenses/by-sa/3.0/. - -Notwithstanding the foregoing, all of Linden Lab's trademarks, including -but not limited to the Second Life brand name and Second Life Eye-in-Hand -logo, are subject to our trademark policy at -http://secondlife.com/corporate/trademark/. - -If you distribute any copies or adaptations of the Second Life viewer -artwork or any other works in these files, you must include this Notice -and clearly identify any changes made to the original works. Include -this Notice and information where copyright notices are usually included, -for example, after your own copyright notice acknowledging your use of -the Second Life viewer artwork, in a text file distributed with your -program, in your application's About window, or on a credits page for -your work. diff --git a/ThirdPartyLicenses/DotNetOpenid.txt b/ThirdPartyLicenses/DotNetOpenid.txt deleted file mode 100644 index 6833494f80f..00000000000 --- a/ThirdPartyLicenses/DotNetOpenid.txt +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (c) 2008, Andrew Arnott, Scott Hanselman, Jason Alexander, et. al -All rights reserved. - -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 DotNetOpenId 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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. \ No newline at end of file diff --git a/ThirdPartyLicenses/DotNetZip-bzip2.txt b/ThirdPartyLicenses/DotNetZip-bzip2.txt deleted file mode 100644 index f8b4346fe93..00000000000 --- a/ThirdPartyLicenses/DotNetZip-bzip2.txt +++ /dev/null @@ -1,29 +0,0 @@ - -The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is -modified code, based on the bzip2 code in the Apache commons compress -library. - -The original BZip2 was created by Julian Seward, and is licensed under -the BSD license. - -The following license applies to the Apache code: ------------------------------------------------------------------------ - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ diff --git a/ThirdPartyLicenses/DotNetZip-zlib.txt b/ThirdPartyLicenses/DotNetZip-zlib.txt deleted file mode 100644 index 801e9419039..00000000000 --- a/ThirdPartyLicenses/DotNetZip-zlib.txt +++ /dev/null @@ -1,70 +0,0 @@ - -The following licenses govern use of the accompanying software, the -DotNetZip library ("the software"). If you use the software, you accept -these licenses. If you do not accept the license, do not use the software. - -The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is -modified code, based on jzlib. - - - -The following notice applies to jzlib: ------------------------------------------------------------------------ - -Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -2. 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. - -3. The names of the authors may not be used to endorse or promote products -derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 JCRAFT, -INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE 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. - ------------------------------------------------------------------------ - -jzlib is based on zlib-1.1.3. - -The following notice applies to zlib: - ------------------------------------------------------------------------ - -Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler - - The ZLIB software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly jloup@gzip.org - Mark Adler madler@alumni.caltech.edu - - ------------------------------------------------------------------------ diff --git a/ThirdPartyLicenses/DotNetZip.txt b/ThirdPartyLicenses/DotNetZip.txt deleted file mode 100644 index c3103fd07de..00000000000 --- a/ThirdPartyLicenses/DotNetZip.txt +++ /dev/null @@ -1,33 +0,0 @@ -Microsoft Public License (Ms-PL) - -This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software. - -1. Definitions - -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. - -A "contribution" is the original software, or any additions or changes to the software. - -A "contributor" is any person that distributes its contribution under this license. - -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights - -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. - -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations - -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. - -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. - - diff --git a/ThirdPartyLicenses/GTCache.txt b/ThirdPartyLicenses/GTCache.txt deleted file mode 100644 index 0e3496fac6e..00000000000 --- a/ThirdPartyLicenses/GTCache.txt +++ /dev/null @@ -1,477 +0,0 @@ -GlynnTucker.Cache - -http://gtcache.sourceforge.net/ - -The GlynnTucker.Cache assembly provides a data structure for caching slow data retrievals, for example data retrieved from a database server over the network. Think of it as a Hashtable that can automatically expire its data after a set amount of time or a specified period of inactivity, on a per-object basis. It is written in C# and dual licensed under the GPL/MPL, it should work with any .NET language. - - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - diff --git a/ThirdPartyLicenses/GoogleProtoBuffer.txt b/ThirdPartyLicenses/GoogleProtoBuffer.txt deleted file mode 100644 index e0df00c71a9..00000000000 --- a/ThirdPartyLicenses/GoogleProtoBuffer.txt +++ /dev/null @@ -1,31 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://github.com/jskeet/dotnet-protobufs/ -// Original C++/Java/Python code: -// http://code.google.com/p/protobuf/ -// -// 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 Google Inc. 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 COPYRIGHT HOLDERS AND CONTRIBUTORS -// "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 COPYRIGHT -// OWNER OR 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. diff --git a/ThirdPartyLicenses/ICSharpCode.SharpZipLib.license.txt b/ThirdPartyLicenses/ICSharpCode.SharpZipLib.license.txt deleted file mode 100644 index c384be424ed..00000000000 --- a/ThirdPartyLicenses/ICSharpCode.SharpZipLib.license.txt +++ /dev/null @@ -1,17 +0,0 @@ -The library is released under the GPL with the following exception: - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent modules, -and to copy and distribute the resulting executable under terms of your -choice, provided that you also meet, for each linked independent module, -the terms and conditions of the license of that module. An independent -module is a module which is not derived from or based on this library. - -If you modify this library, you may extend this exception to your -version of the library, but you are not obligated to do so. If you do not -wish to do so, delete this exception statement from your version. diff --git a/ThirdPartyLicenses/MXP.txt b/ThirdPartyLicenses/MXP.txt deleted file mode 100644 index 43f51cecb07..00000000000 --- a/ThirdPartyLicenses/MXP.txt +++ /dev/null @@ -1,15 +0,0 @@ -Metaverse Exchange Protocol specification and reference implementation. - -Copyright 2008-2009 Bubble Cloud Comminity (http://www.bubblecloud.org) - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/ThirdPartyLicenses/Mono.Xna (MonoXnaCompactMaths).txt b/ThirdPartyLicenses/Mono.Xna (MonoXnaCompactMaths).txt deleted file mode 100644 index ef324b6bbe3..00000000000 --- a/ThirdPartyLicenses/Mono.Xna (MonoXnaCompactMaths).txt +++ /dev/null @@ -1,22 +0,0 @@ -MIT License -Copyright © 2006 The Mono.Xna Team - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/ThirdPartyLicenses/MonoAddins.txt b/ThirdPartyLicenses/MonoAddins.txt deleted file mode 100644 index 10c23b37ddb..00000000000 --- a/ThirdPartyLicenses/MonoAddins.txt +++ /dev/null @@ -1,41 +0,0 @@ -Authors: Lluis Sanchez Gual - -The MIT License - -Copyright (C) 2007 Novell, Inc (http://www.novell.com) - - - -Permission is hereby granted, free of charge, to any person obtaining -a copy - of this software and associated documentation files (the "Software"), -to deal - in the Software without restriction, including without limitation -the rights -to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell -copies of the Software, and to permit persons to whom the -Software is -furnished to do so, subject to the following conditions: - - - -The above copyright notice and this permission notice shall be included in - -all copies or substantial portions of the Software. - - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. -IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/ThirdPartyLicenses/MySQL.txt b/ThirdPartyLicenses/MySQL.txt deleted file mode 100644 index bbda93619aa..00000000000 --- a/ThirdPartyLicenses/MySQL.txt +++ /dev/null @@ -1,122 +0,0 @@ -GPLv2 + MySQL FLOSS License Exception (files COPYING and EXCEPTIONS) - ---- file: EXCEPTIONS --- -MySQL FLOSS License Exception - -The MySQL AB Exception for Free/Libre and Open Source -Software-only Applications Using MySQL Client Libraries (the -"FLOSS Exception"). - -Version 0.6, 7 March 2007 - -Exception Intent - -We want specified Free/Libre and Open Source Software (``FLOSS'') -applications to be able to use specified GPL-licensed MySQL client -libraries (the ``Program'') despite the fact that not all FLOSS -licenses are compatible with version 2 of the GNU General Public -License (the ``GPL''). - -Legal Terms and Conditions - -As a special exception to the terms and conditions of version 2.0 -of the GPL: - - 1. You are free to distribute a Derivative Work that is formed - entirely from the Program and one or more works (each, a - "FLOSS Work") licensed under one or more of the licenses - listed below in section 1, as long as: - a. You obey the GPL in all respects for the Program and the - Derivative Work, except for identifiable sections of the - Derivative Work which are not derived from the Program, - and which can reasonably be considered independent and - separate works in themselves, - b. all identifiable sections of the Derivative Work which - are not derived from the Program, and which can - reasonably be considered independent and separate works - in themselves, - i. are distributed subject to one of the FLOSS licenses - listed below, and - ii. the object code or executable form of those sections - are accompanied by the complete corresponding - machine-readable source code for those sections on - the same medium and under the same FLOSS license as - the corresponding object code or executable forms of - those sections, and - c. any works which are aggregated with the Program or with a - Derivative Work on a volume of a storage or distribution - medium in accordance with the GPL, can reasonably be - considered independent and separate works in themselves - which are not derivatives of either the Program, a - Derivative Work or a FLOSS Work. - If the above conditions are not met, then the Program may only - be copied, modified, distributed or used under the terms and - conditions of the GPL or another valid licensing option from - MySQL AB. - - 2. FLOSS License List - -License name Version(s)/Copyright Date -Academic Free License 2.0 -Apache Software License 1.0/1.1/2.0 -Apple Public Source License 2.0 -Artistic license From Perl 5.8.0 -BSD license "July 22 1999" -Common Development and Distribution License (CDDL) 1.0 -Common Public License 1.0 -Eclipse Public License 1.0 -GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1 -Jabber Open Source License 1.0 -MIT license (As listed in file MIT-License.txt) --- -Mozilla Public License (MPL) 1.0/1.1 -Open Software License 2.0 -OpenSSL license (with original SSLeay license) "2003" ("1998") -PHP License 3.0 -Python license (CNRI Python License) --- -Python Software Foundation License 2.1.1 -Sleepycat License "1999" -University of Illinois/NCSA Open Source License --- -W3C License "2001" -X11 License "2001" -Zlib/libpng License --- -Zope Public License 2.0 - - Due to the many variants of some of the above licenses, we - require that any version follow the 2003 version of the Free - Software Foundation's Free Software Definition - (http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of - the Open Source Definition by the Open Source Initiative - (http://www.opensource.org/docs/definition.php). - - 3. Definitions - - a. Terms used, but not defined, herein shall have the - meaning provided in the GPL. - b. Derivative Work means a derivative work under copyright - law. - - 4. Applicability: This FLOSS Exception applies to all Programs - that contain a notice placed by MySQL AB saying that the - Program may be distributed under the terms of this FLOSS - Exception. If you create or distribute a work which is a - Derivative Work of both the Program and any other work - licensed under the GPL, then this FLOSS Exception is not - available for that work; thus, you must remove the FLOSS - Exception notice from that work and comply with the GPL in all - respects, including by retaining all GPL notices. You may - choose to redistribute a copy of the Program exclusively under - the terms of the GPL by removing the FLOSS Exception notice - from that copy of the Program, provided that the copy has - never been modified by you or any third party. - -Appendix A. Qualified Libraries and Packages - -The following is a non-exhaustive list of libraries and packages -which are covered by the FLOSS License Exception. Please note that -this appendix is provided merely as an additional service to -specific FLOSS projects wishing to simplify licensing information -for their users. Compliance with one of the licenses noted under -the "FLOSS license list" section remains a prerequisite. - -Package Name Qualifying License and Version -Apache Portable Runtime (APR) Apache Software License 2.0 diff --git a/ThirdPartyLicenses/Nini.txt b/ThirdPartyLicenses/Nini.txt deleted file mode 100644 index fe38b627cf7..00000000000 --- a/ThirdPartyLicenses/Nini.txt +++ /dev/null @@ -1,23 +0,0 @@ - -Nini Configuration Project. -Copyright (c) 2006 Brent R. Matzelle - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/ThirdPartyLicenses/Npgsql.txt b/ThirdPartyLicenses/Npgsql.txt deleted file mode 100644 index e2e4f1283bd..00000000000 --- a/ThirdPartyLicenses/Npgsql.txt +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2002-2007, The Npgsql Development Team - -Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/ThirdPartyLicenses/ODE.txt b/ThirdPartyLicenses/ODE.txt deleted file mode 100644 index 53a93dbe89a..00000000000 --- a/ThirdPartyLicenses/ODE.txt +++ /dev/null @@ -1,13 +0,0 @@ -Open Dynamics Engine -Copyright (c) 2001-2004, Russell L. Smith. -All rights reserved. - -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 names of ODE's copyright owner 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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. \ No newline at end of file diff --git a/ThirdPartyLicenses/OpenJpeg.txt b/ThirdPartyLicenses/OpenJpeg.txt deleted file mode 100644 index d1e5b6a5333..00000000000 --- a/ThirdPartyLicenses/OpenJpeg.txt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2007, Professor Benoit Macq - * Copyright (c) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe - * Copyright (c) 2005, Herve Drolon, FreeImage Team - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `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 COPYRIGHT OWNER OR 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. - */ \ No newline at end of file diff --git a/ThirdPartyLicenses/Protobuf-net.txt b/ThirdPartyLicenses/Protobuf-net.txt deleted file mode 100644 index 8eb6c71333a..00000000000 --- a/ThirdPartyLicenses/Protobuf-net.txt +++ /dev/null @@ -1,21 +0,0 @@ -The core Protocol Buffers technology is provided courtesy of Google. -At the time of writing, this is released under the BSD license. -Full details can be found here: - -http://code.google.com/p/protobuf/ - - -This .NET implementation is Copyright 2008 Marc Gravell - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/ThirdPartyLicenses/Prototype.txt b/ThirdPartyLicenses/Prototype.txt deleted file mode 100644 index 61e491823bb..00000000000 --- a/ThirdPartyLicenses/Prototype.txt +++ /dev/null @@ -1,16 +0,0 @@ -Copyright (c) 2005-2008 Sam Stephenson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/ThirdPartyLicenses/SmartThreadPool.txt b/ThirdPartyLicenses/SmartThreadPool.txt deleted file mode 100644 index 7bfc997e59b..00000000000 --- a/ThirdPartyLicenses/SmartThreadPool.txt +++ /dev/null @@ -1,22 +0,0 @@ -Microsoft Public License (Ms-PL) - -This license governs use of the accompanying software. If you use the software, you -accept this license. If you do not accept the license, do not use the software. - -1. Definitions -The terms "reproduce," "reproduction," "derivative works," and "distribution" have the -same meaning here as under U.S. copyright law. -A "contribution" is the original software, or any additions or changes to the software. -A "contributor" is any person that distributes its contribution under this license. -"Licensed patents" are a contributor's patent claims that read directly on its contribution. - -2. Grant of Rights -(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. -(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - -3. Conditions and Limitations -(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. -(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. -(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. -(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. diff --git a/ThirdPartyLicenses/XML-RPC.NET.txt b/ThirdPartyLicenses/XML-RPC.NET.txt deleted file mode 100644 index 2aff37f7e18..00000000000 --- a/ThirdPartyLicenses/XML-RPC.NET.txt +++ /dev/null @@ -1,27 +0,0 @@ -XML-RPC.NET - XML-RPC for .NET -v2.1.0 -Copyright (C) 2001-2006 Charles Cook (chascook@gmail.com) - -xmlrpcgen -Copyright (C) 2003 Joe Bork - -For more information about XML-RPC.NET visit http://www.xml-rpc.net. - -XML-RPC.NET is licensed with MIT X11 license. -(see http://www.xml-rpc.net/faq/xmlrpcnetfaq.html#6.12) - -For more information about XML-RPC refer to http://www.xmlrpc.com/ - - -PREQUISITES ------------ -Assembly CookComputing.XmlRpc.dll requires 1.0 .NET runtime and -runs on all later versions. - -Assembly CookComputing.XmlRpcV2.dll requires 2.0 .NET runtime. - - -DOCUMENTATION -------------- -For help on using XML-RPC.NET, see -http://www.xml-rpc.net/faq/xmlrpcnetfaq.html. \ No newline at end of file diff --git a/ThirdPartyLicenses/libsl.txt b/ThirdPartyLicenses/libsl.txt deleted file mode 100644 index 73951dc7346..00000000000 --- a/ThirdPartyLicenses/libsl.txt +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2006, Second Life Reverse Engineering Team -All rights reserved. - -- 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. -- Neither the name of the Second Life Reverse Engineering Team 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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. \ No newline at end of file diff --git a/ThirdPartyLicenses/log4net b/ThirdPartyLicenses/log4net deleted file mode 100644 index 261eeb9e9f8..00000000000 --- a/ThirdPartyLicenses/log4net +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Tranquillity.sln b/Tranquillity.sln index 7d79bbfd778..d7d7ae48b57 100644 --- a/Tranquillity.sln +++ b/Tranquillity.sln @@ -3,131 +3,154 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.6.33815.320 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doc", "Doc", "{033B5574-717D-4FD7-A156-3FF28C13B7F4}" + ProjectSection(SolutionItems) = preProject + Doc\doxygen.conf = Doc\doxygen.conf + Doc\README = Doc\README + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8F448DF9-DE18-4810-8545-96DFE17D5C39}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Tests", "Tests\OpenSim.Framework.Tests\OpenSim.Framework.Tests.csproj", "{3B850422-D5E2-4C10-BC5A-EC3C94598106}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Tests", "Tests\OpenSim.Framework.Tests\OpenSim.Framework.Tests.csproj", "{3B850422-D5E2-4C10-BC5A-EC3C94598106}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{02C09046-CFF3-40BA-9E3F-629241EB25A5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Capabilities", "Source\OpenSim.Capabilities\OpenSim.Capabilities.csproj", "{FF56527B-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Capabilities", "Source\OpenSim.Capabilities\OpenSim.Capabilities.csproj", "{FF56527B-0000-0000-0000-000000000000}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Capabilities.Handlers", "Source\OpenSim.Capabilities.Handlers\OpenSim.Capabilities.Handlers.csproj", "{002BDDF6-0000-0000-0000-000000000000}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data", "Source\OpenSim.Data\OpenSim.Data.csproj", "{7E218E2D-0000-0000-0000-000000000000}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.MySQL", "Source\OpenSim.Data.MySQL\OpenSim.Data.MySQL.csproj", "{1E894ECD-0000-0000-0000-000000000000}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework", "Source\OpenSim.Framework\OpenSim.Framework.csproj", "{BCCDBB55-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Capabilities.Handlers", "Source\OpenSim.Capabilities.Handlers\OpenSim.Capabilities.Handlers.csproj", "{002BDDF6-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.AssetLoader.Filesystem", "Source\OpenSim.Framework.AssetLoader.Filesystem\OpenSim.Framework.AssetLoader.Filesystem.csproj", "{384A4FAB-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Data", "Source\OpenSim.Data\OpenSim.Data.csproj", "{7E218E2D-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Console", "Source\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{0ED8EBE8-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Data.MySQL", "Source\OpenSim.Data.MySQL\OpenSim.Data.MySQL.csproj", "{1E894ECD-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Monitoring", "Source\OpenSim.Framework.Monitoring\OpenSim.Framework.Monitoring.csproj", "{69AB1BC7-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "Source\OpenSim.Framework\OpenSim.Framework.csproj", "{BCCDBB55-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Serialization", "Source\OpenSim.Framework.Serialization\OpenSim.Framework.Serialization.csproj", "{BD63E665-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.AssetLoader.Filesystem", "Source\OpenSim.Framework.AssetLoader.Filesystem\OpenSim.Framework.AssetLoader.Filesystem.csproj", "{384A4FAB-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Servers", "Source\OpenSim.Framework.Servers\OpenSim.Framework.Servers.csproj", "{726D540D-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Console", "Source\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{0ED8EBE8-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Servers.HttpServer", "Source\OpenSim.Framework.Servers.HttpServer\OpenSim.Framework.Servers.HttpServer.csproj", "{159EC5C2-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Monitoring", "Source\OpenSim.Framework.Monitoring\OpenSim.Framework.Monitoring.csproj", "{69AB1BC7-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ScriptEngine.Shared", "Source\OpenSim.Region.ScriptEngine.Shared\OpenSim.Region.ScriptEngine.Shared.csproj", "{F93F91AD-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Serialization", "Source\OpenSim.Framework.Serialization\OpenSim.Framework.Serialization.csproj", "{BD63E665-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ScriptEngine.YEngine", "Source\OpenSim.Region.ScriptEngine.YEngine\OpenSim.Region.ScriptEngine.YEngine.csproj", "{798B4867-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Servers", "Source\OpenSim.Framework.Servers\OpenSim.Framework.Servers.csproj", "{726D540D-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.Base", "Source\OpenSim.Server.Base\OpenSim.Server.Base.csproj", "{2E0569BB-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Servers.HttpServer", "Source\OpenSim.Framework.Servers.HttpServer\OpenSim.Framework.Servers.HttpServer.csproj", "{159EC5C2-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.Handlers", "Source\OpenSim.Server.Handlers\OpenSim.Server.Handlers.csproj", "{ED041501-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ScriptEngine.Shared", "Source\OpenSim.Region.ScriptEngine.Shared\OpenSim.Region.ScriptEngine.Shared.csproj", "{F93F91AD-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.GridServer", "Source\OpenSim.Server.GridServer\OpenSim.Server.GridServer.csproj", "{6E64F01D-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ScriptEngine.YEngine", "Source\OpenSim.Region.ScriptEngine.YEngine\OpenSim.Region.ScriptEngine.YEngine.csproj", "{798B4867-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.MoneyServer", "Source\OpenSim.Server.MoneyServer\OpenSim.Server.MoneyServer.csproj", "{C3AEE6AC-BE40-4003-A7A3-E8AA039E4451}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.Base", "Source\OpenSim.Server.Base\OpenSim.Server.Base.csproj", "{2E0569BB-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.Common", "Source\OpenSim.Server.Common\OpenSim.Server.Common.csproj", "{14B10CB1-EE07-438B-B9C9-E7C241579269}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.Handlers", "Source\OpenSim.Server.Handlers\OpenSim.Server.Handlers.csproj", "{ED041501-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Services", "Source\OpenSim.Services\OpenSim.Services.csproj", "{0882C4EB-72A6-468F-98A4-283E51C297C3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.GridServer", "Source\OpenSim.Server.GridServer\OpenSim.Server.GridServer.csproj", "{6E64F01D-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Services.Interfaces", "Source\OpenSim.Services.Interfaces\OpenSim.Services.Interfaces.csproj", "{6515DCE2-15C0-4FAF-BA7C-6863B4DB696A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.MoneyServer", "Source\OpenSim.Server.MoneyServer\OpenSim.Server.MoneyServer.csproj", "{C3AEE6AC-BE40-4003-A7A3-E8AA039E4451}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.Model", "Source\OpenSim.Data.Model\OpenSim.Data.Model.csproj", "{39D8B47B-C213-41C6-9E5D-D09AB7E89AB0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.Common", "Source\OpenSim.Server.Common\OpenSim.Server.Common.csproj", "{14B10CB1-EE07-438B-B9C9-E7C241579269}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.Framework", "Source\OpenSim.Region.Framework\OpenSim.Region.Framework.csproj", "{599EC9E3-6F33-42C0-A174-E16506F59A43}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Services", "Source\OpenSim.Services\OpenSim.Services.csproj", "{0882C4EB-72A6-468F-98A4-283E51C297C3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.SharedBase", "Source\OpenSim.Region.PhysicsModule.SharedBase\OpenSim.Region.PhysicsModule.SharedBase.csproj", "{94C6C0BC-F5BB-4696-A5C4-D5E4FDBF8EF1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Services.Interfaces", "Source\OpenSim.Services.Interfaces\OpenSim.Services.Interfaces.csproj", "{6515DCE2-15C0-4FAF-BA7C-6863B4DB696A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ClientStack.LindenUDP", "Source\OpenSim.Region.ClientStack.LindenUDP\OpenSim.Region.ClientStack.LindenUDP.csproj", "{9A41B033-842D-46BA-AD13-61639EC53A86}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Data.Model", "Source\OpenSim.Data.Model\OpenSim.Data.Model.csproj", "{39D8B47B-C213-41C6-9E5D-D09AB7E89AB0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ClientStack.LindenCaps", "Source\OpenSim.Region.ClientStack.LindenCaps\OpenSim.Region.ClientStack.LindenCaps.csproj", "{5EE751AE-F13E-4B62-AD36-7FBC291D0FDA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.Framework", "Source\OpenSim.Region.Framework\OpenSim.Region.Framework.csproj", "{599EC9E3-6F33-42C0-A174-E16506F59A43}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.CoreModules", "Source\OpenSim.Region.CoreModules\OpenSim.Region.CoreModules.csproj", "{20619EF5-8852-4C66-9B93-3934E2211BAF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.SharedBase", "Source\OpenSim.Region.PhysicsModule.SharedBase\OpenSim.Region.PhysicsModule.SharedBase.csproj", "{94C6C0BC-F5BB-4696-A5C4-D5E4FDBF8EF1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.OptionalModules", "Source\OpenSim.Region.OptionalModules\OpenSim.Region.OptionalModules.csproj", "{53076375-212A-42DB-B52A-D3A65A364E87}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ClientStack.LindenUDP", "Source\OpenSim.Region.ClientStack.LindenUDP\OpenSim.Region.ClientStack.LindenUDP.csproj", "{9A41B033-842D-46BA-AD13-61639EC53A86}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.RegionServer", "Source\OpenSim.Server.RegionServer\OpenSim.Server.RegionServer.csproj", "{D99FE8F4-C557-4522-B6B3-FA1D30154A43}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ClientStack.LindenCaps", "Source\OpenSim.Region.ClientStack.LindenCaps\OpenSim.Region.ClientStack.LindenCaps.csproj", "{5EE751AE-F13E-4B62-AD36-7FBC291D0FDA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.ApplicationPlugins.LoadRegions", "Source\OpenSim.ApplicationPlugins.LoadRegions\OpenSim.ApplicationPlugins.LoadRegions.csproj", "{35E07AB7-C302-42BC-A51A-6A1377E47E57}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.CoreModules", "Source\OpenSim.Region.CoreModules\OpenSim.Region.CoreModules.csproj", "{20619EF5-8852-4C66-9B93-3934E2211BAF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.ApplicationPlugins.RegionModulesController", "Source\OpenSim.ApplicationPlugins.RegionModulesController\OpenSim.ApplicationPlugins.RegionModulesController.csproj", "{6A84F67F-69C6-483B-873A-761BC695A786}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.OptionalModules", "Source\OpenSim.Region.OptionalModules\OpenSim.Region.OptionalModules.csproj", "{53076375-212A-42DB-B52A-D3A65A364E87}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.ApplicationPlugins.RemoteController", "Source\OpenSim.ApplicationPlugins.RemoteController\OpenSim.ApplicationPlugins.RemoteController.csproj", "{05A88CFF-D58F-4F39-8076-8392739404FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.RegionServer", "Source\OpenSim.Server.RegionServer\OpenSim.Server.RegionServer.csproj", "{D99FE8F4-C557-4522-B6B3-FA1D30154A43}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.BasicPhysics", "Source\OpenSim.Region.PhysicsModule.BasicPhysics\OpenSim.Region.PhysicsModule.BasicPhysics.csproj", "{7313C6C9-61DE-4084-A801-C9586FBA740D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.ApplicationPlugins.LoadRegions", "Source\OpenSim.ApplicationPlugins.LoadRegions\OpenSim.ApplicationPlugins.LoadRegions.csproj", "{35E07AB7-C302-42BC-A51A-6A1377E47E57}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.BulletS", "Source\OpenSim.Region.PhysicsModule.BulletS\OpenSim.Region.PhysicsModule.BulletS.csproj", "{01384B86-2DA4-4266-99B7-4E43F0676376}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.ApplicationPlugins.RegionModulesController", "Source\OpenSim.ApplicationPlugins.RegionModulesController\OpenSim.ApplicationPlugins.RegionModulesController.csproj", "{6A84F67F-69C6-483B-873A-761BC695A786}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet", "Source\OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet\OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet.csproj", "{F0CE96DE-1143-4551-A56A-BA619C195C12}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.ApplicationPlugins.RemoteController", "Source\OpenSim.ApplicationPlugins.RemoteController\OpenSim.ApplicationPlugins.RemoteController.csproj", "{05A88CFF-D58F-4F39-8076-8392739404FD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.Meshing", "Source\OpenSim.Region.PhysicsModule.Meshing\OpenSim.Region.PhysicsModule.Meshing.csproj", "{EB86E29E-8ADA-4895-80BA-76358F964FDD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.BasicPhysics", "Source\OpenSim.Region.PhysicsModule.BasicPhysics\OpenSim.Region.PhysicsModule.BasicPhysics.csproj", "{7313C6C9-61DE-4084-A801-C9586FBA740D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.POS", "Source\OpenSim.Region.PhysicsModule.POS\OpenSim.Region.PhysicsModule.POS.csproj", "{B298DB04-84B6-4112-BDFA-76C812F62CD2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.BulletS", "Source\OpenSim.Region.PhysicsModule.BulletS\OpenSim.Region.PhysicsModule.BulletS.csproj", "{01384B86-2DA4-4266-99B7-4E43F0676376}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.ubOde", "Source\OpenSim.Region.PhysicsModule.ubOde\OpenSim.Region.PhysicsModule.ubOde.csproj", "{C655AB04-C861-4EBD-AD52-D532BC9B3677}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet", "Source\OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet\OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet.csproj", "{F0CE96DE-1143-4551-A56A-BA619C195C12}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.ubOdeMeshing", "Source\OpenSim.Region.PhysicsModule.ubOdeMeshing\OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj", "{A3773F06-1D60-4278-9A53-2D5C6370C69A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.Meshing", "Source\OpenSim.Region.PhysicsModule.Meshing\OpenSim.Region.PhysicsModule.Meshing.csproj", "{EB86E29E-8ADA-4895-80BA-76358F964FDD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.OptionalModules.Currency", "Source\OpenSim.Region.OptionalModules.Currency\OpenSim.Region.OptionalModules.Currency.csproj", "{ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.POS", "Source\OpenSim.Region.PhysicsModule.POS\OpenSim.Region.PhysicsModule.POS.csproj", "{B298DB04-84B6-4112-BDFA-76C812F62CD2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gloebit", "Source\Gloebit\Gloebit.csproj", "{E1C4D992-705B-4C02-B408-8A518E27F7A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.ubOde", "Source\OpenSim.Region.PhysicsModule.ubOde\OpenSim.Region.PhysicsModule.ubOde.csproj", "{C655AB04-C861-4EBD-AD52-D532BC9B3677}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Capabilities.Handlers.Tests", "Tests\OpenSim.Capabilities.Handlers.Tests\OpenSim.Capabilities.Handlers.Tests.csproj", "{ED4B08CB-38CF-4AAE-B58F-6E657A1CBDFC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.ubOdeMeshing", "Source\OpenSim.Region.PhysicsModule.ubOdeMeshing\OpenSim.Region.PhysicsModule.ubOdeMeshing.csproj", "{A3773F06-1D60-4278-9A53-2D5C6370C69A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests.Clients.AssetClient", "Tests\OpenSim.Clients.Assets.Tests\OpenSim.Tests.Clients.AssetClient.csproj", "{8B1577EA-D750-4F86-BFF9-137ACC201DF9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.OptionalModules.Currency", "Source\OpenSim.Region.OptionalModules.Currency\OpenSim.Region.OptionalModules.Currency.csproj", "{ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests.Common", "Tests\OpenSim.Tests.Common\OpenSim.Tests.Common.csproj", "{4B9B10D0-DF6A-4D9F-9AF4-75E723AF69A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Data.MySQL.MoneyData", "Source\OpenSim.Data.MySQL.MoneyData\OpenSim.Data.MySQL.MoneyData.csproj", "{A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.Tests", "Tests\OpenSim.Data.Tests\OpenSim.Data.Tests.csproj", "{8579C7CF-F05C-42FB-8DFB-7F0E7CB122ED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gloebit", "Source\Gloebit\Gloebit.csproj", "{E1C4D992-705B-4C02-B408-8A518E27F7A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Serialization.Tests", "Tests\OpenSim.Framework.Serialization.Tests\OpenSim.Framework.Serialization.Tests.csproj", "{2648CDB9-FB5B-4678-9ED5-F67A6D3E9C77}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Capabilities.Handlers.Tests", "Tests\OpenSim.Capabilities.Handlers.Tests\OpenSim.Capabilities.Handlers.Tests.csproj", "{ED4B08CB-38CF-4AAE-B58F-6E657A1CBDFC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Framework.Servers.Tests", "Tests\OpenSim.Framework.Servers.Tests\OpenSim.Framework.Servers.Tests.csproj", "{621208A4-6A02-4378-A080-45C276D54963}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests.Clients.AssetClient", "Tests\OpenSim.Clients.Assets.Tests\OpenSim.Tests.Clients.AssetClient.csproj", "{8B1577EA-D750-4F86-BFF9-137ACC201DF9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests.Performance", "Tests\OpenSim.Performance.Tests\OpenSim.Tests.Performance.csproj", "{59D2F1B6-817F-40A5-A911-18F7CF97AD1D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests.Common", "Tests\OpenSim.Tests.Common\OpenSim.Tests.Common.csproj", "{4B9B10D0-DF6A-4D9F-9AF4-75E723AF69A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests.Permissions", "Tests\OpenSim.Permissions.Tests\OpenSim.Tests.Permissions.csproj", "{487F2A21-2154-4F7B-84C6-837199060A15}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Data.Tests", "Tests\OpenSim.Data.Tests\OpenSim.Data.Tests.csproj", "{8579C7CF-F05C-42FB-8DFB-7F0E7CB122ED}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ClientStack.LindenCaps.Tests", "Tests\OpenSim.Region.ClientStack.LindenCaps.Tests\OpenSim.Region.ClientStack.LindenCaps.Tests.csproj", "{9F84CB9B-0DAA-4ED5-B1E5-96CDE5DBB835}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Serialization.Tests", "Tests\OpenSim.Framework.Serialization.Tests\OpenSim.Framework.Serialization.Tests.csproj", "{2648CDB9-FB5B-4678-9ED5-F67A6D3E9C77}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ClientStack.LindenUDP.Tests", "Tests\OpenSim.Region.ClientStack.LindenUDP.Tests\OpenSim.Region.ClientStack.LindenUDP.Tests.csproj", "{A27669E1-03A2-4AE2-98E4-7ED644FB449C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Servers.Tests", "Tests\OpenSim.Framework.Servers.Tests\OpenSim.Framework.Servers.Tests.csproj", "{621208A4-6A02-4378-A080-45C276D54963}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.CoreModules.Tests", "Tests\OpenSim.Region.CoreModules.Tests\OpenSim.Region.CoreModules.Tests.csproj", "{4DD026A1-E0E1-4449-BD55-19A404560013}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests.Performance", "Tests\OpenSim.Performance.Tests\OpenSim.Tests.Performance.csproj", "{59D2F1B6-817F-40A5-A911-18F7CF97AD1D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.Framework.Tests", "Tests\OpenSim.Region.Framework.Tests\OpenSim.Region.Framework.Tests.csproj", "{EE95DDC4-0360-474E-A534-16C6D5A284A6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests.Permissions", "Tests\OpenSim.Permissions.Tests\OpenSim.Tests.Permissions.csproj", "{487F2A21-2154-4F7B-84C6-837199060A15}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.PhysicsModule.BulletS.Tests", "Tests\OpenSim.Region.PhysicsModules.BulletS.Tests\OpenSim.Region.PhysicsModule.BulletS.Tests.csproj", "{697F2348-D44D-4D7F-9ADC-56BE8B83D561}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ClientStack.LindenCaps.Tests", "Tests\OpenSim.Region.ClientStack.LindenCaps.Tests\OpenSim.Region.ClientStack.LindenCaps.Tests.csproj", "{9F84CB9B-0DAA-4ED5-B1E5-96CDE5DBB835}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Region.ScriptEngine.Tests", "Tests\OpenSim.Region.ScriptEngine.Tests\OpenSim.Region.ScriptEngine.Tests.csproj", "{095BB4F2-113F-41CC-95CC-BA8BB8AE50D9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ClientStack.LindenUDP.Tests", "Tests\OpenSim.Region.ClientStack.LindenUDP.Tests\OpenSim.Region.ClientStack.LindenUDP.Tests.csproj", "{A27669E1-03A2-4AE2-98E4-7ED644FB449C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Tests", "Tests\OpenSim.Robust.Tests\Robust.Tests.csproj", "{F81FC0C2-5968-489D-A2EE-427CA2BFF51A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.CoreModules.Tests", "Tests\OpenSim.Region.CoreModules.Tests\OpenSim.Region.CoreModules.Tests.csproj", "{4DD026A1-E0E1-4449-BD55-19A404560013}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Server.Handlers.Tests", "Tests\OpenSim.Server.Handlers.Tests\OpenSim.Server.Handlers.Tests.csproj", "{36362244-B5D1-4B98-8B5C-95B3D04F77DA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.Framework.Tests", "Tests\OpenSim.Region.Framework.Tests\OpenSim.Region.Framework.Tests.csproj", "{EE95DDC4-0360-474E-A534-16C6D5A284A6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Services.InventoryService.Tests", "Tests\OpenSim.Services.InventoryService.Tests\OpenSim.Services.InventoryService.Tests.csproj", "{C1917976-A953-49A5-A10B-1C6F6C3C9D03}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.PhysicsModule.BulletS.Tests", "Tests\OpenSim.Region.PhysicsModules.BulletS.Tests\OpenSim.Region.PhysicsModule.BulletS.Tests.csproj", "{697F2348-D44D-4D7F-9ADC-56BE8B83D561}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests.Stress", "Tests\OpenSim.Stress.Tests\OpenSim.Tests.Stress.csproj", "{68F4BE4E-3763-4550-8A55-6B26505FF2F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Region.ScriptEngine.Tests", "Tests\OpenSim.Region.ScriptEngine.Tests\OpenSim.Region.ScriptEngine.Tests.csproj", "{095BB4F2-113F-41CC-95CC-BA8BB8AE50D9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Tests", "Tests\OpenSim.Tests\OpenSim.Tests.csproj", "{B2038E44-5DED-4776-BDD5-1D7915C2A80B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Tests", "Tests\OpenSim.Robust.Tests\Robust.Tests.csproj", "{F81FC0C2-5968-489D-A2EE-427CA2BFF51A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{059B6577-1634-4550-BD75-2EEC6C188AEA}" + ProjectSection(SolutionItems) = preProject + BUILDING.md = BUILDING.md + CONTRIBUTORS.txt = CONTRIBUTORS.txt + LICENSE.txt = LICENSE.txt + README.md = README.md + RELEASE.md = RELEASE.md + SECURITY.md = SECURITY.md + TESTING.txt = TESTING.txt + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Server.Handlers.Tests", "Tests\OpenSim.Server.Handlers.Tests\OpenSim.Server.Handlers.Tests.csproj", "{36362244-B5D1-4B98-8B5C-95B3D04F77DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Addons.Groups", "Source\OpenSim.Addons.Groups\OpenSim.Addons.Groups.csproj", "{7AC7DE42-37C4-4AFE-BD39-CBF373E85A72}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Services.InventoryService.Tests", "Tests\OpenSim.Services.InventoryService.Tests\OpenSim.Services.InventoryService.Tests.csproj", "{C1917976-A953-49A5-A10B-1C6F6C3C9D03}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Addons.OfflineIM", "Source\OpenSim.Addons.OfflineIM\OpenSim.Addons.OfflineIM.csproj", "{362A017B-80DE-4FA2-8AC3-0226F51AAB56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests.Stress", "Tests\OpenSim.Stress.Tests\OpenSim.Tests.Stress.csproj", "{68F4BE4E-3763-4550-8A55-6B26505FF2F9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.SQLite", "Source\OpenSim.Data.SQLite\OpenSim.Data.SQLite.csproj", "{AF2313C2-F8D3-4469-8C0F-D83842B62BE0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Tests", "Tests\OpenSim.Tests\OpenSim.Tests.csproj", "{B2038E44-5DED-4776-BDD5-1D7915C2A80B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSim.Data.PGSQL", "Source\OpenSim.Data.PGSQL\OpenSim.Data.PGSQL.csproj", "{12B7EA13-4A71-4BCF-9723-D6F07F6C89C4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -295,10 +318,6 @@ Global {ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47}.Release|Any CPU.ActiveCfg = Release|Any CPU {ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47}.Release|Any CPU.Build.0 = Release|Any CPU - {A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09}.Release|Any CPU.Build.0 = Release|Any CPU {E1C4D992-705B-4C02-B408-8A518E27F7A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1C4D992-705B-4C02-B408-8A518E27F7A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1C4D992-705B-4C02-B408-8A518E27F7A8}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -379,6 +398,22 @@ Global {B2038E44-5DED-4776-BDD5-1D7915C2A80B}.Debug|Any CPU.Build.0 = Debug|Any CPU {B2038E44-5DED-4776-BDD5-1D7915C2A80B}.Release|Any CPU.ActiveCfg = Release|Any CPU {B2038E44-5DED-4776-BDD5-1D7915C2A80B}.Release|Any CPU.Build.0 = Release|Any CPU + {7AC7DE42-37C4-4AFE-BD39-CBF373E85A72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AC7DE42-37C4-4AFE-BD39-CBF373E85A72}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AC7DE42-37C4-4AFE-BD39-CBF373E85A72}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AC7DE42-37C4-4AFE-BD39-CBF373E85A72}.Release|Any CPU.Build.0 = Release|Any CPU + {362A017B-80DE-4FA2-8AC3-0226F51AAB56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {362A017B-80DE-4FA2-8AC3-0226F51AAB56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {362A017B-80DE-4FA2-8AC3-0226F51AAB56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {362A017B-80DE-4FA2-8AC3-0226F51AAB56}.Release|Any CPU.Build.0 = Release|Any CPU + {AF2313C2-F8D3-4469-8C0F-D83842B62BE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF2313C2-F8D3-4469-8C0F-D83842B62BE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF2313C2-F8D3-4469-8C0F-D83842B62BE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF2313C2-F8D3-4469-8C0F-D83842B62BE0}.Release|Any CPU.Build.0 = Release|Any CPU + {12B7EA13-4A71-4BCF-9723-D6F07F6C89C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12B7EA13-4A71-4BCF-9723-D6F07F6C89C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12B7EA13-4A71-4BCF-9723-D6F07F6C89C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12B7EA13-4A71-4BCF-9723-D6F07F6C89C4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -424,7 +459,6 @@ Global {C655AB04-C861-4EBD-AD52-D532BC9B3677} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} {A3773F06-1D60-4278-9A53-2D5C6370C69A} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} {ACE8841A-D54C-4DA6-AB4B-6EFEAA662C47} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} - {A8A7CC2D-5267-4B1B-B9BF-2FC0E3C01D09} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} {E1C4D992-705B-4C02-B408-8A518E27F7A8} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} {ED4B08CB-38CF-4AAE-B58F-6E657A1CBDFC} = {8F448DF9-DE18-4810-8545-96DFE17D5C39} {8B1577EA-D750-4F86-BFF9-137ACC201DF9} = {8F448DF9-DE18-4810-8545-96DFE17D5C39} @@ -445,6 +479,10 @@ Global {C1917976-A953-49A5-A10B-1C6F6C3C9D03} = {8F448DF9-DE18-4810-8545-96DFE17D5C39} {68F4BE4E-3763-4550-8A55-6B26505FF2F9} = {8F448DF9-DE18-4810-8545-96DFE17D5C39} {B2038E44-5DED-4776-BDD5-1D7915C2A80B} = {8F448DF9-DE18-4810-8545-96DFE17D5C39} + {7AC7DE42-37C4-4AFE-BD39-CBF373E85A72} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} + {362A017B-80DE-4FA2-8AC3-0226F51AAB56} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} + {AF2313C2-F8D3-4469-8C0F-D83842B62BE0} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} + {12B7EA13-4A71-4BCF-9723-D6F07F6C89C4} = {02C09046-CFF3-40BA-9E3F-629241EB25A5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A40AD54B-8BC7-41E4-B241-19B59EA65D2A}