Remove all references and use of Nini in feature/dotnet6 (#78)

* Add dependency to package Microsoft.Extensions.Logging.Console to tests

* Complete renaming OpenSim.PhysicsModules to OpenSim.PhysicsModule.

* Fix up some logging errors that were overlooked or sprung up as logging is converting to MS.Extension.Logging.

* Remove all references and use of Nini

* Update modules implementing I[Non]SharedRegionModule with new Initialize(IConfiguration)
This commit is contained in:
Robert 2024-06-27 06:52:37 -07:00 committed by GitHub
parent 5753772bb1
commit 96b993cd60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
315 changed files with 1560 additions and 1903 deletions

View file

@ -237,7 +237,6 @@ This software uses components from the following developers:
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
* Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI
* Nini (http://nini.sourceforge.net/)
* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
* Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx)

View file

@ -12,7 +12,6 @@ software at it's earliest stages.
This software uses components from the following developers:
* Microsoft .NET C# (https://docs.microsoft.com/en-us/dotnet/csharp/)
* Nini (http://nini.sourceforge.net/)
* XmlRpcCS (http://xmlrpccs.sf.net/)
* Mono (https://www.mono-project.com/
* LibOpenMetaverse (http://lib.openmetaverse.org/))

View file

@ -70,6 +70,7 @@ using System.Net;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -85,8 +86,6 @@ using OpenSim.Services.Interfaces;
using OpenMetaverse;
using OpenMetaverse.StructuredData; // TODO: turn transactionData into a dictionary of <string, object> and remove this.
using Nini.Config;
using Nwc.XmlRpc;
namespace Gloebit.GloebitMoneyModule
@ -215,11 +214,11 @@ namespace Gloebit.GloebitMoneyModule
m_logger.LogInformation("[GLOEBITMONEYMODULE] Initialising.");
IConfig economyConfig = config.Configs["Economy"];
IConfigurationSection economyConfig = config.GetSection("Economy");
var mmodule = economyConfig?.GetString("economymodule", "");
var mmodule = economyConfig?.GetValue("economymodule", "");
if (String.IsNullOrEmpty(mmodule))
mmodule = economyConfig?.GetString("EconomyModule", "");
mmodule = economyConfig?.GetValue("EconomyModule", "");
if ((string.IsNullOrEmpty(mmodule) == false) && ((mmodule == Name) || (mmodule == "Gloebit")))
{
@ -238,7 +237,7 @@ namespace Gloebit.GloebitMoneyModule
string[] sections = { "Economy", "Gloebit" };
foreach (var section in sections)
{
IConfig sec_config = config.Configs[section];
IConfigurationSection sec_config = config.GetSection(section);
if (null == sec_config)
{
@ -250,8 +249,8 @@ namespace Gloebit.GloebitMoneyModule
}
// Load Grid info from GridInfoService if Standalone and GridInfo if Robust
IConfig standalone_config = config.Configs["GridInfoService"];
IConfig robust_config = config.Configs["GridInfo"];
IConfigurationSection standalone_config = config.GetSection("GridInfoService");
IConfigurationSection robust_config = config.GetSection("GridInfo");
if (standalone_config == null && robust_config == null)
{
@ -290,8 +289,8 @@ namespace Gloebit.GloebitMoneyModule
// GLBSpecificStorageProvider wasn't specified so fall back to using the global
// DatabaseService settings
m_logger.LogInformation("[GLOEBITMONEYMODULE] using default StorageProvider and ConnectionString from DatabaseService");
m_dbProvider = config.Configs["DatabaseService"].GetString("StorageProvider");
m_dbConnectionString = config.Configs["DatabaseService"].GetString("ConnectionString");
m_dbProvider = config.GetSection("DatabaseService")>.GetValue<string>("StorageProvider");
m_dbConnectionString = config.GetSection("DatabaseService")?.GetValue<string>("ConnectionString");
}
else
{
@ -338,28 +337,28 @@ namespace Gloebit.GloebitMoneyModule
/// </summary>
/// <param name="config"></param>
/// <param name="section"></param>
private void ReadConfigAndPopulate(IConfig config, string section)
private void ReadConfigAndPopulate(IConfigurationSection config, string section)
{
/********** [Economy] ************/
if (section == "Economy")
{
/*** Get OpenSim built in pricing configuration info ***/
PriceEnergyUnit = config.GetInt("PriceEnergyUnit", 100);
PriceObjectClaim = config.GetInt("PriceObjectClaim", 10);
PricePublicObjectDecay = config.GetInt("PricePublicObjectDecay", 4);
PricePublicObjectDelete = config.GetInt("PricePublicObjectDelete", 4);
PriceParcelClaim = config.GetInt("PriceParcelClaim", 1);
PriceParcelClaimFactor = config.GetFloat("PriceParcelClaimFactor", 1f);
PriceUpload = config.GetInt("PriceUpload", 0);
PriceRentLight = config.GetInt("PriceRentLight", 5);
TeleportMinPrice = config.GetInt("TeleportMinPrice", 2);
TeleportPriceExponent = config.GetFloat("TeleportPriceExponent", 2f);
EnergyEfficiency = config.GetFloat("EnergyEfficiency", 1);
PriceObjectRent = config.GetFloat("PriceObjectRent", 1);
PriceObjectScaleFactor = config.GetFloat("PriceObjectScaleFactor", 10);
PriceParcelRent = config.GetInt("PriceParcelRent", 1);
PriceGroupCreate = config.GetInt("PriceGroupCreate", -1);
m_sellEnabled = config.GetBoolean("SellEnabled", true);
PriceEnergyUnit = config.GetValue<int>("PriceEnergyUnit", 100);
PriceObjectClaim = config.GetValue<int>("PriceObjectClaim", 10);
PricePublicObjectDecay = config.GetValue<int>("PricePublicObjectDecay", 4);
PricePublicObjectDelete = config.GetValue<int>("PricePublicObjectDelete", 4);
PriceParcelClaim = config.GetValue<int>("PriceParcelClaim", 1);
PriceParcelClaimFactor = config.GetValue<float>("PriceParcelClaimFactor", 1f);
PriceUpload = config.GetValue<int>("PriceUpload", 0);
PriceRentLight = config.GetValue<int>("PriceRentLight", 5);
TeleportMinPrice = config.GetValue<int>("TeleportMinPrice", 2);
TeleportPriceExponent = config.GetValue<float>("TeleportPriceExponent", 2f);
EnergyEfficiency = config.GetValue<float>("EnergyEfficiency", 1);
PriceObjectRent = config.GetValue<float>("PriceObjectRent", 1);
PriceObjectScaleFactor = config.GetValue<float>("PriceObjectScaleFactor", 10);
PriceParcelRent = config.GetValue<int>("PriceParcelRent", 1);
PriceGroupCreate = config.GetValue<int>("PriceGroupCreate", -1);
m_sellEnabled = config.GetValue<bool>("SellEnabled", true);
}
/********** [Gloebit] ************/
@ -367,8 +366,8 @@ namespace Gloebit.GloebitMoneyModule
{
/*** Get GloebitMoneyModule configuration details ***/
// Get region/grid owner contact details for transaction failure contact instructions.
string ownerName = config.GetString("GLBOwnerName", "region or grid owner");
string ownerEmail = config.GetString("GLBOwnerEmail", null);
string ownerName = config.GetValue<string>("GLBOwnerName", "region or grid owner");
string ownerEmail = config.GetValue<string>("GLBOwnerEmail", null);
m_contactOwner = ownerName;
if (!String.IsNullOrEmpty(ownerEmail))
{
@ -376,14 +375,14 @@ namespace Gloebit.GloebitMoneyModule
}
// Should we disable adding info to OpenSimExtras map
m_disablePerSimCurrencyExtras = config.GetBoolean("DisablePerSimCurrencyExtras", false);
m_disablePerSimCurrencyExtras = config.GetValue<bool>("DisablePerSimCurrencyExtras", false);
// Should we send new session IMs informing user how to auth or purchase gloebits
m_showNewSessionPurchaseIM = config.GetBoolean("GLBShowNewSessionPurchaseIM", false);
m_showNewSessionAuthIM = config.GetBoolean("GLBShowNewSessionAuthIM", true);
m_showNewSessionPurchaseIM = config.GetValue<bool>("GLBShowNewSessionPurchaseIM", false);
m_showNewSessionAuthIM = config.GetValue<bool>("GLBShowNewSessionAuthIM", true);
// Should we send a welcome message informing user that Gloebit is enabled
m_showWelcomeMessage = config.GetBoolean("GLBShowWelcomeMessage", true);
m_showWelcomeMessage = config.GetValue<bool>("GLBShowWelcomeMessage", true);
string nsms_msg = "\n\t";
nsms_msg = String.Format("{0}Welcome Message: {1},\tTo modify, set GLBShowWelcomeMessage in [Gloebit] section of config\n\t", nsms_msg, m_showWelcomeMessage);
nsms_msg = String.Format("{0}Auth Message: {1},\tTo modify, set GLBShowNewSessionAuthIM in [Gloebit] section of config\n\t", nsms_msg, m_showNewSessionAuthIM);
@ -393,15 +392,15 @@ namespace Gloebit.GloebitMoneyModule
// If version cannot be detected override workflow selection via config
// Currently not documented because last resort if all version checking fails
m_forceNewLandPassFlow = config.GetBoolean("GLBNewLandPassFlow", false);
m_forceNewHTTPFlow = config.GetBoolean("GLBNewHTTPFlow", false);
m_forceNewLandPassFlow = config.GetValue<bool>("GLBNewLandPassFlow", false);
m_forceNewHTTPFlow = config.GetValue<bool>("GLBNewHTTPFlow", false);
// Are we using custom db connection info
m_dbProvider = config.GetString("GLBSpecificStorageProvider");
m_dbConnectionString = config.GetString("GLBSpecificConnectionString");
m_dbProvider = config.GetValue<string>("GLBSpecificStorageProvider");
m_dbConnectionString = config.GetValue<string>("GLBSpecificConnectionString");
/*** Get Gloebit API configuration details ***/
string envString = config.GetString("GLBEnvironment", "sandbox");
string envString = config.GetValue<string>("GLBEnvironment", "sandbox");
switch(envString)
{
case "sandbox":
@ -414,8 +413,8 @@ namespace Gloebit.GloebitMoneyModule
break;
case "custom":
m_environment = GLBEnv.Custom;
m_apiUrl = config.GetString("GLBApiUrl", SANDBOX_URL);
string overrideBaseURIStr = config.GetString("GLBCallbackBaseURI", null);
m_apiUrl = config.GetValue<string>("GLBApiUrl", SANDBOX_URL);
string overrideBaseURIStr = config.GetValue<string>("GLBCallbackBaseURI", null);
if(overrideBaseURIStr != null) {
m_overrideBaseURI = new Uri(overrideBaseURIStr);
}
@ -428,9 +427,9 @@ namespace Gloebit.GloebitMoneyModule
break;
}
m_keyAlias = config.GetString("GLBKeyAlias", null);
m_key = config.GetString("GLBKey", null);
m_secret = config.GetString("GLBSecret", null);
m_keyAlias = config.GetValue<string>("GLBKeyAlias", null);
m_key = config.GetValue<string>("GLBKey", null);
m_secret = config.GetValue<string>("GLBSecret", null);
}
/********** [GridInfoService] ************/
@ -438,7 +437,9 @@ namespace Gloebit.GloebitMoneyModule
{
// If we're here, this is a standalone mode grid
/*** Grab the grid info locally ***/
setGridInfo(config.GetString("gridname", m_gridname), config.GetString("gridnick", m_gridnick), config.GetString("economy", null));
setGridInfo(config.GetValue<string>("gridname", m_gridname),
config.GetValue<string>("gridnick", m_gridnick),
config.GetValue<string>("economy", null));
}
/********** [GridInfo] ************/
@ -446,7 +447,7 @@ namespace Gloebit.GloebitMoneyModule
{
// If we're here, this is a robust mode grid
/*** Grab the grid info via the grid info uri ***/
string gridInfoURI = config.GetString("GridInfoURI", null);
string gridInfoURI = config.GetValue<string>("GridInfoURI", null);
// TODO: Should we store the info url?
m_logger.LogInformation("[GLOEBITMONEYMODULE] GRID INFO URL = {0}", gridInfoURI);

View file

@ -19,7 +19,6 @@
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="MySql.Data" path="../../../bin/"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Data.MySQL"/>

View file

@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsServiceLocalConnectorModule : ISharedRegionModule, IGroupsServicesConnector
@ -77,12 +73,12 @@ namespace OpenSim.Groups
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<GroupsServiceLocalConnectorModule>>();
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
IConfigurationSection groupsConfig = config.GetSection("Groups");
if (!groupsConfig.GetChildren().Any())
return;
if ((groupsConfig.GetBoolean("Enabled", false) == false)
|| (groupsConfig.GetString("ServicesConnectorModule", string.Empty) != Name))
if ((groupsConfig.GetValue<bool>("Enabled", false) == false)
|| (groupsConfig.GetValue<string>("ServicesConnectorModule", string.Empty) != Name))
{
return;
}

View file

@ -8,7 +8,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="RawScape.Nini" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Source\OpenSim.Data\OpenSim.Data.csproj" />

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsServiceRemoteConnector
@ -50,8 +49,9 @@ namespace OpenSim.Groups
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<GroupsServiceRemoteConnector>>();
IConfig groupsConfig = config.Configs["Groups"];
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
IConfigurationSection groupsConfig = config.GetSection("Groups");
string url = groupsConfig.GetValue<string>("GroupsServerURI", string.Empty);
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));

View file

@ -38,8 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsServiceRemoteConnectorModule : ISharedRegionModule, IGroupsServicesConnector
@ -78,12 +76,12 @@ namespace OpenSim.Groups
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
IConfigurationSection groupsConfig = config.GetSection("Groups");
if (!groupsConfig.GetChildren().Any())
return;
if ((groupsConfig.GetBoolean("Enabled", false) == false)
|| (groupsConfig.GetString("ServicesConnectorModule", string.Empty) != Name))
if ((groupsConfig.GetValue<bool>("Enabled", false) == false)
|| (groupsConfig.GetValue<string>("ServicesConnectorModule", string.Empty) != Name))
{
return;
}

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -37,8 +36,6 @@ using OpenSim.Framework.ServiceAuth;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsServiceRobustConnector : ServiceConnector
@ -59,10 +56,10 @@ namespace OpenSim.Groups
m_logger.LogDebug("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
IConfig groupsConfig = config.Configs[m_ConfigName];
if (groupsConfig != null)
IConfigurationSection groupsConfig = config.GetSection(m_ConfigName);
if (groupsConfig.GetChildren().Any())
{
key = groupsConfig.GetString("SecretKey", string.Empty);
key = groupsConfig.GetValue<string>("SecretKey", string.Empty);
m_logger.LogDebug("[Groups.RobustConnector]: Starting with secret key {0}", key);
}
// else

View file

@ -27,6 +27,7 @@
using System.Timers;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Groups
{
public class GroupsService : GroupsServiceBase

View file

@ -25,19 +25,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using Nini.Config;
using OpenSim.Server.Base;
namespace OpenSim.Groups
{

View file

@ -55,7 +55,7 @@ namespace OpenSim.OfflineIM
m_logger = logger;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var cnf = m_configuration.GetSection("Messaging");
if (cnf.Exists() is false)

View file

@ -8,7 +8,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="RawScape.Nini" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="OpenMetaverse">

View file

@ -25,16 +25,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
using OpenSim.Region.Framework;
using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using OpenSim.Server.Base;
namespace OpenSim.ApplicationPlugins.LoadRegions
{
@ -62,11 +62,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
string estateConfigPath = Path.Combine(Util.configDir(), "Estates");
IConfig startupConfig = m_configSource.Configs["Startup"];
IConfigurationSection startupConfig = m_configSource.GetSection("Startup");
if(startupConfig == null)
return;
estateConfigPath = startupConfig.GetString("regionload_estatesdir", estateConfigPath).Trim();
estateConfigPath = startupConfig.GetValue<string>("regionload_estatesdir", estateConfigPath).Trim();
if(string.IsNullOrWhiteSpace(estateConfigPath))
return;
@ -97,24 +97,26 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
foreach (string file in iniFiles)
{
m_logger.LogInformation("[ESTATE LOADER FILE SYSTEM]: Loading config file {0}", file);
IConfiguration source = null;
try
{
source = new IniConfigSource(file);
try {
source = new ConfigurationBuilder()
.AddIniFile(file)
.Build();
}
catch
{
m_logger.LogWarning("[ESTATE LOADER FILE SYSTEM]: failed to parse file {0}", file);
continue;
}
if(source == null)
continue;
foreach (IConfig config in source.Configs)
foreach (IConfigurationSection config in source.GetChildren())
{
// Read Estate Config From Source File
string estateName = config.Name;
string estateName = config.Key;
if (string.IsNullOrWhiteSpace(estateName))
continue;
@ -124,7 +126,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
continue;
}
string ownerString = config.GetString("Owner", string.Empty);
string ownerString = config.GetValue<string>("Owner", string.Empty);
if (string.IsNullOrWhiteSpace(ownerString))
continue;
@ -140,7 +142,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
//### Should check Estate Owner ID but no Scene object available at this point
// Does Config Specify EstateID (0 Defaults To AutoIncrement)
int EstateID = config.GetInt("EstateID", 0);
int EstateID = config.GetValue<int>("EstateID", 0);
if (EstateID > 0)
{

View file

@ -25,7 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Nini.Config;
using Microsoft.Extensions.Configuration;
namespace OpenSim.ApplicationPlugins.LoadRegions
{

View file

@ -25,7 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenSim.Framework;
namespace OpenSim.ApplicationPlugins.LoadRegions

View file

@ -25,10 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
using OpenSim.Region.Framework;
using Microsoft.Extensions.Logging;
using Nini.Config;
namespace OpenSim.ApplicationPlugins.LoadRegions
{
@ -85,7 +86,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
IEstateLoader estateLoader = null;
IRegionLoader regionLoader;
if (_configuration.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
if (_configuration.GetSection("Startup").GetValue<string>("region_info_source", "filesystem") == "filesystem")
{
_logger.LogInformation("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem");

View file

@ -25,16 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.ApplicationPlugins.LoadRegions
{
public class RegionLoaderFileSystem : IRegionLoader
@ -56,9 +53,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
try
{
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
IConfigurationSection startupConfig = m_configSource.GetSection("Startup");
regionConfigPath = startupConfig.GetValue<string>("regionload_regionsdir", regionConfigPath).Trim();
allowRegionless = startupConfig.GetValue<bool>("allow_regionless", false);
}
catch (Exception)
{
@ -89,11 +86,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
m_logger?.LogInformation("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
IConfiguration source = new IniConfigSource(file);
IConfiguration source = new ConfigurationBuilder().AddIniFile(file).Build();
foreach (IConfig config in source.Configs)
foreach (IConfigurationSection config in source.GetChildren())
{
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Key);
regionInfos.Add(regionInfo);
m_logger?.LogInformation("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);

View file

@ -28,14 +28,13 @@
using System.Net;
using System.Xml;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.ApplicationPlugins.LoadRegions
{
public class RegionLoaderWebServer : IRegionLoader
@ -62,9 +61,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
}
else
{
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
IConfigurationSection startupConfig = m_configSource.GetSection("Startup");
string url = startupConfig.GetValue<string>("regionload_webserver_url", String.Empty).Trim();
bool allowRegionless = startupConfig.GetValue<bool>("allow_regionless", false);
if (url.Length == 0)
{

View file

@ -140,7 +140,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
m_sharedInstances.Add(module);
m_logger.LogInformation($"[REGIONMODULES]: Initializing: {module.Name}");
module.Initialise();
module.Initialise(m_configuration);
}
m_logger.LogInformation($"[REGIONMODULES]: Initializing INonSharedRegionModules");
@ -158,7 +158,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
m_nonSharedInstances.Add(module);
m_logger.LogInformation($"[REGIONMODULES]: Initializing: {module.Name}");
module.Initialise();
module.Initialise(m_configuration);
}
}
}
@ -409,7 +409,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
scene.RegionInfo.RegionName, module.Name);
// Initialise the module
module.Initialise( );
module.Initialise(m_configuration);
list.Add(module);
}
@ -471,7 +471,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
m_logger.LogDebug("[REGIONMODULE]: Adding scene {0} to non-shared module {1} (deferred)",
scene.RegionInfo.RegionName, module.Name);
module.Initialise();
module.Initialise(m_configuration);
list.Add(module);
deferredlist.Add(module);

View file

@ -31,6 +31,7 @@ using System.Net;
using System.Timers;
using System.Xml;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
@ -45,8 +46,6 @@ using OpenMetaverse;
using Nwc.XmlRpc;
using Nini.Config;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using RegionInfo = OpenSim.Framework.RegionInfo;
using OpenSim.Server.Base;
@ -105,19 +104,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
if (_configuration.Configs["RemoteAdmin"] == null ||
!_configuration.Configs["RemoteAdmin"].GetBoolean("enabled", false))
var config = _configuration.GetSection("RemoteAdmin");
if (config.GetValue<bool>("enabled", false))
{
// No config or disabled
}
else
{
var config = _configuration.Configs["RemoteAdmin"];
m_logger.LogDebug("[RADMIN]: Remote Admin Plugin Enabled");
m_requiredPassword = config.GetString("access_password", String.Empty);
int port = config.GetInt("port", 0);
m_requiredPassword = config.GetValue<string>("access_password", String.Empty);
int port = config.GetValue<int>("port", 0);
string accessIP = config.GetString("access_ip_addresses", String.Empty);
string accessIP = config.GetValue<string>("access_ip_addresses", String.Empty);
m_accessIP = new HashSet<string>();
if (accessIP != String.Empty)
@ -133,7 +127,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
m_application = openSim;
string bind_ip_address = config.GetString("bind_ip_address", "0.0.0.0");
string bind_ip_address = config.GetValue<string>("bind_ip_address", "0.0.0.0");
IPAddress ipaddr = IPAddress.Parse(bind_ip_address);
m_httpServer = MainServer.GetHttpServer((uint)port, ipaddr);
@ -183,7 +177,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
availableMethods["admin_get_agent_count"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentCount);
// Either enable full remote functionality or just selected features
string enabledMethods = config.GetString("enabled_methods", "all");
string enabledMethods = config.GetValue<string>("enabled_methods", "all");
// To get this, you must explicitly specify "all" or
// mention it in a whitelist. It won't be available
@ -284,10 +278,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Scene rebootedScene = null;
bool restartAll = false;
IConfig startupConfig = _configuration.Configs["Startup"];
IConfigurationSection startupConfig = _configuration.GetSection("Startup");
if (startupConfig != null)
{
if (startupConfig.GetBoolean("InworldRestartShutsDown", false))
if (startupConfig.GetValue<bool>("InworldRestartShutsDown", false))
{
rebootedScene = m_application.SceneManager.CurrentOrFirstScene;
restartAll = true;
@ -366,7 +360,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
notice = false;
}
if (startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false))
if (startupConfig.GetValue<bool>("SkipDelayOnEmptyRegion", false))
{
m_logger.LogInformation("[RADMIN]: Counting affected avatars");
int agents = 0;
@ -699,11 +693,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
lock (m_requestLock)
{
var config = _configuration.Configs["RemoteAdmin"];
var config = _configuration.GetSection("RemoteAdmin");
int m_regionLimit = config.GetInt("region_limit", 0);
bool m_enableVoiceForNewRegions = config.GetBoolean("create_region_enable_voice", false);
bool m_publicAccess = config.GetBoolean("create_region_public", true);
int m_regionLimit = config.GetValue<int>("region_limit", 0);
bool m_enableVoiceForNewRegions = config.GetValue<bool>("create_region_enable_voice", false);
bool m_publicAccess = config.GetValue<bool>("create_region_public", true);
CheckStringParameters(requestData, responseData, new string[]
{
@ -785,8 +779,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
// OpenSim.ini can specify a different regions dir
IConfig startupConfig = (IConfig)_configuration.Configs["Startup"];
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
IConfigurationSection startupConfig = _configuration.GetSection("Startup");
regionConfigPath = startupConfig.GetValue<string>("regionload_regionsdir", regionConfigPath).Trim();
}
catch (Exception)
{
@ -809,7 +803,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
regionIniPath = Path.Combine(regionConfigPath,
String.Format(
config.GetString("region_file_template", "{0}x{1}-{2}.ini"),
config.GetValue<string>("region_file_template", "{0}x{1}-{2}.ini"),
region.RegionLocX.ToString(),
region.RegionLocY.ToString(),
regionID.ToString(),
@ -2717,11 +2711,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
m_logger.LogDebug("[RADMIN]: updateUserAppearance");
var config = _configuration.Configs["RemoteAdmin"];
var config = _configuration.GetSection("RemoteAdmin");
string defaultMale = config.GetString("default_male", "Default Male");
string defaultFemale = config.GetString("default_female", "Default Female");
string defaultNeutral = config.GetString("default_female", "Default Default");
string defaultMale = config.GetValue<string>("default_male", "Default Male");
string defaultFemale = config.GetValue<string>("default_female", "Default Female");
string defaultNeutral = config.GetValue<string>("default_female", "Default Default");
string model = String.Empty;
// Has a gender preference been supplied?
@ -2809,8 +2803,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
return;
// Simple appearance copy or copy Clothing and Bodyparts folders?
var config = _configuration.Configs["RemoteAdmin"];
bool copyFolders = config.GetBoolean("copy_folders", false);
var config = _configuration.GetSection("RemoteAdmin");
bool copyFolders = config.GetValue<bool>("copy_folders", false);
if (!copyFolders)
{
@ -3157,12 +3151,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try
{
string defaultAppearanceFileName = null;
var config = _configuration.Configs["RemoteAdmin"];
var config = _configuration.GetSection("RemoteAdmin");
//config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini
if (config != null)
{
defaultAppearanceFileName = config.GetString("default_appearance", "default_appearance.xml");
defaultAppearanceFileName = config.GetValue<string>("default_appearance", "default_appearance.xml");
}
if (File.Exists(defaultAppearanceFileName))

View file

@ -1891,12 +1891,15 @@ namespace OpenSim.Framework
/// <returns></returns>
public static T GetConfigVarFromSections<T>(IConfiguration config, string varname, string[] sections, object val)
{
T configVal = (T)val;
foreach (string section in sections.AsSpan())
{
var cnf = config.GetSection(section);
if (cnf.Exists() is false)
if (!cnf.GetChildren().Any())
continue;
configVal = cnf.GetValue<T>(varname, configVal);
/*
if (typeof(T) == typeof(String))
val = cnf.GetValue<string>(varname, (string)val);
else if (typeof(T) == typeof(Boolean))
@ -1909,9 +1912,10 @@ namespace OpenSim.Framework
val = cnf.GetValue<double>(varname, (double)val);
//else
// m_log.ErrorFormat($"[UTIL]: Unhandled type {typeof(T)}");
*/
}
return (T)val;
return configVal;
}
/* XXX

View file

@ -53,7 +53,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_logger = logger;
}
public void Initialise( )
public void Initialise(IConfiguration pConfiguration)
{
}

View file

@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.Linden
++m_nscenes;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
public Type ReplaceableInterface { get { return null; } }
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
}

View file

@ -26,27 +26,18 @@
*/
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO.Compression;
using Microsoft.Extensions.Configuration;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Capabilities;
using System.IO.Compression;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Capabilities;
namespace OpenSim.Region.ClientStack.Linden
{

View file

@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.Linden
#region INonSharedRegionModule Members
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -62,7 +62,7 @@ namespace OpenSim.Region.ClientStack.Linden
#region INonSharedRegionModule Members
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -67,7 +67,7 @@ namespace OpenSim.Region.ClientStack.Linden
#region ISharedRegionModule Members
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.Linden
ProcessQueuedRequestsAsync = processQueuedResultsAsync;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config == null)
@ -135,7 +135,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_badRequests = new ExpiringKey<UUID>(30000);
if (ProcessQueuedRequestsAsync && m_workerpool == null)
m_workerpool = new ObjectJobEngine(DoInventoryRequests, "LibInventoryWorker", 2000, 2);
m_workerpool = new ObjectJobEngine(m_logger, DoInventoryRequests, "LibInventoryWorker", 2000, 2);
}
public void PostInitialise()

View file

@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.Linden
get { return null; }
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -27,10 +27,12 @@
using System.Net;
using System.Text;
using Microsoft.Extensions.Configuration;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -62,7 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden
Enabled = true;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("Mesh");
if (config.Exists() is false)

View file

@ -54,7 +54,7 @@ namespace OpenSim.Region.ClientStack.Linden
#region INonSharedRegionModule Members
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
}

View file

@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
get { return null; }
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
}

View file

@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.Linden
public event ConsoleMessage OnConsoleMessage;
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
m_commands.AddCommand( "Help", false, "help", "help [<item>]", "Display help on a particular command or on a list of commands in a category", Help);
}

View file

@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.Linden
get { return null; }
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
m_enabled = false; // whatever

View file

@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack.Linden
#region ISharedRegionModule Members
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("SimulatorFeatures");
if (config.Exists() is true)

View file

@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_logger = logger;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.Linden
ProcessQueuedRequestsAsync = processQueuedResultsAsync;
}
public void Initialise()
public void Initialise(IConfiguration pConfiguration)
{
var config = m_configuration.GetSection("ClientStack.LindenCaps");
if (config.Exists() is false)

View file

@ -29,7 +29,6 @@ using System.Collections.Concurrent;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
@ -71,7 +70,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return null; }
}
public virtual void Initialise()
public virtual void Initialise(IConfiguration pConfiguration)
{
}
@ -382,7 +381,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TickCountResolution += (float)(now - start);
}
m_logger.LogInformation($"[LLUDPSERVER]: Average Environment.TickCount resolution: {TickCountResolution * 0.1f}ms");
m_logger?.LogInformation($"[LLUDPSERVER]: Average Environment.TickCount resolution: {TickCountResolution * 0.1f}ms");
TickCountResolution = 0f;
for (int i = 0; i < 100; i++)
@ -395,7 +394,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
TickCountResolution = MathF.Round(TickCountResolution * 0.01f,6,MidpointRounding.AwayFromZero);
m_logger.LogInformation($"[LLUDPSERVER]: Average Util.GetTimeStampMS resolution: {TickCountResolution}ms");
m_logger?.LogInformation($"[LLUDPSERVER]: Average Util.GetTimeStampMS resolution: {TickCountResolution}ms");
#endregion Environment.TickCount Measurement
@ -468,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void StartInbound()
{
m_logger.LogInformation("[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server");
m_logger?.LogInformation("[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server");
base.StartInbound(m_recvBufferSize);
@ -485,7 +484,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public override void StartOutbound()
{
m_logger.LogInformation("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server");
m_logger?.LogInformation("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server");
base.StartOutbound();
@ -501,7 +500,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Stop()
{
m_logger.LogInformation($"[LLUDPSERVER]: Shutting down the LLUDP server for {Scene.Name}");
m_logger?.LogInformation($"[LLUDPSERVER]: Shutting down the LLUDP server for {Scene.Name}");
base.StopOutbound();
base.StopInbound();
//IpahEngine.Stop();
@ -517,13 +516,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (Scene is not null)
{
m_logger.LogError("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
m_logger?.LogError("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
return;
}
if (scene is not OpenSim.Region.Framework.Scenes.Scene)
{
m_logger.LogError($"[LLUDPSERVER]: AddScene() called with an unrecognized scene type {scene.GetType()}");
m_logger?.LogError($"[LLUDPSERVER]: AddScene() called with an unrecognized scene type {scene.GetType()}");
return;
}
@ -692,7 +691,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int packetCount = datas.Length;
if (packetCount < 1)
m_logger.LogError($"[LLUDPSERVER]: Failed to split {packet.Type} with estimated length {packet.Length}");
m_logger?.LogError($"[LLUDPSERVER]: Failed to split {packet.Type} with estimated length {packet.Length}");
for (int i = 0; i < packetCount; i++)
SendPacketData(udpClient, datas[i], packet.Type, category, method);
@ -785,7 +784,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// The packet grew larger than the bufferSize while zerocoding.
// Remove the MSG_ZEROCODED flag and send the unencoded data
// instead
m_logger.LogDebug($"[LLUDPSERVER]: Packet exceeded buffer size ({buffer.Data.Length}) during zerocoding for {type}. DataLength={dataLength}. Removing MSG_ZEROCODED flag");
m_logger?.LogDebug($"[LLUDPSERVER]: Packet exceeded buffer size ({buffer.Data.Length}) during zerocoding for {type}. DataLength={dataLength}. Removing MSG_ZEROCODED flag");
data[0] = (byte)(data[0] & ~Helpers.MSG_ZEROCODED);
}
}
@ -800,7 +799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
m_logger.LogError($"[LLUDPSERVER]: Packet exceeded MTU ({LLUDPServer.MTU}) Type={type}, DataLength={dataLength}");
m_logger?.LogError($"[LLUDPSERVER]: Packet exceeded MTU ({LLUDPServer.MTU}) Type={type}, DataLength={dataLength}");
// buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, dataLength);
buffer = GetNewUDPBuffer(udpClient.RemoteEndPoint);
Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
@ -1048,7 +1047,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void ResendUnacked(OutgoingPacket outgoingPacket)
{
//m_logger.LogDebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
//m_logger?.LogDebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
// outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);
// Set the resent flag
@ -1144,20 +1143,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
if (udpClient.DebugDataOutLevel > 0)
m_logger.LogDebug(
m_logger?.LogDebug(
$"[LLUDPSERVER]: Sending packet #{outgoingPacket.SequenceNumber} (rel: {isReliable}, res: {isResend}) to {udpClient.AgentID} from {Scene.Name}");
}
protected void RecordMalformedInboundPacket(IPEndPoint endPoint)
{
//if (m_malformedCount < 100)
// m_logger.LogDebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.Message);
// m_logger?.LogDebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.Message);
IncomingMalformedPacketCount++;
if ((IncomingMalformedPacketCount % 10000) == 0)
{
m_logger.LogWarning(
m_logger?.LogWarning(
$"[LLUDPSERVER]: Received {IncomingMalformedPacketCount} malformed packets so far, " +
"probable network attack. Last was from {endPoint}");
}
@ -1168,7 +1167,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Debugging/Profiling
//try { Thread.CurrentThread.Name = "PacketReceived (" + m_scene.RegionInfo.RegionName + ")"; }
//catch (Exception) { }
//m_logger.LogDebugFormat(
//m_logger?.LogDebugFormat(
// "[LLUDPSERVER]: Packet received from {0} in {1}", buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName);
Packet packet = null;
@ -1227,7 +1226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch (Exception e)
{
if (IncomingMalformedPacketCount < 100)
m_logger.LogDebug(e, "[LLUDPSERVER]: Dropped malformed packet");
m_logger?.LogDebug(e, "[LLUDPSERVER]: Dropped malformed packet");
}
// Fail-safe check
@ -1235,7 +1234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (IncomingMalformedPacketCount < 100)
{
m_logger.LogWarning($"[LLUDPSERVER]: Malformed data, cannot parse {buffer.DataLength} " +
m_logger?.LogWarning($"[LLUDPSERVER]: Malformed data, cannot parse {buffer.DataLength} " +
$"byte packet from {buffer.RemoteEndPoint}, data {Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)}");
}
@ -1261,7 +1260,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return;
}
//m_logger.LogDebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type);
//m_logger?.LogDebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type);
queue.Enqueue(buffer);
return;
}
@ -1297,13 +1296,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Determine which agent this packet came from
if (client == null || client is not LLClientView)
{
//m_logger.LogDebug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
//m_logger?.LogDebug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
IncomingOrphanedPacketCount++;
if ((IncomingOrphanedPacketCount % 10000) == 0)
{
m_logger.LogWarning($"[LLUDPSERVER]: Received {IncomingOrphanedPacketCount} orphaned packets so far. Last was from {endPoint}");
m_logger?.LogWarning($"[LLUDPSERVER]: Received {IncomingOrphanedPacketCount} orphaned packets so far. Last was from {endPoint}");
}
return;
@ -1313,7 +1312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!udpClient.IsConnected)
{
m_logger.LogDebug($"[LLUDPSERVER]: Received a {packet.Type} packet for a unConnected client in {Scene.Name}");
m_logger?.LogDebug($"[LLUDPSERVER]: Received a {packet.Type} packet for a unConnected client in {Scene.Name}");
return;
}
@ -1330,7 +1329,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Handle appended ACKs
if (packet.Header.AppendedAcks && packet.Header.AckList != null)
{
// m_logger.LogDebugFormat(
// m_logger?.LogDebugFormat(
// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
// packet.Header.AckList.Length, client.Name, m_scene.Name);
@ -1343,7 +1342,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
PacketAckPacket ackPacket = (PacketAckPacket)packet;
// m_logger.LogDebugFormat(
// m_logger?.LogDebugFormat(
// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}",
// ackPacket.Packets.Length, client.Name, m_scene.Name);
@ -1360,7 +1359,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Header.Reliable)
{
//m_logger.LogDebugFormat(
//m_logger?.LogDebugFormat(
// "[LLUDPSERVER]: Adding ack request for {0} {1} from {2} in {3}",
// packet.Type, packet.Header.Sequence, client.Name, m_scene.Name);
@ -1394,12 +1393,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (packet.Header.Resent)
{
m_logger.LogDebug(
m_logger?.LogDebug(
$"[LLUDPSERVER]: Received a resend of already processed packet #{packet.Header.Sequence}, type {packet.Type} from {client.Name}");
}
else
{
m_logger.LogWarning(
m_logger?.LogWarning(
$"[LLUDPSERVER]: Received a duplicate (not marked as resend) of packet #{packet.Header.Sequence}, type {packet.Type} from {client.Name}");
}
@ -1417,7 +1416,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Type == PacketType.StartPingCheck)
{
//m_logger.LogDebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name);
//m_logger?.LogDebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name);
// We don't need to do anything else with ping checks
StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
@ -1508,12 +1507,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
uint type = (uint)packetType;
type |= (uint)flags << 24;
// m_logger.LogDebug("1 LogPacketHeader(): Outside lock");
// m_logger?.LogDebug("1 LogPacketHeader(): Outside lock");
lock (binStatsLogLock)
{
DateTime now = DateTime.Now;
// m_logger.LogDebug("2 LogPacketHeader(): Inside lock. now is " + now.Ticks);
// m_logger?.LogDebug("2 LogPacketHeader(): Inside lock. now is " + now.Ticks);
try
{
if (PacketLog == null || (now > PacketLog.StartTime + binStatsMaxFilesize))
@ -1546,7 +1545,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (Exception ex)
{
m_logger.LogError(ex, $"Packet statistics gathering failed");
// m_logger?.LogError(ex, $"Packet statistics gathering failed");
if (PacketLog.Log != null)
{
PacketLog.Log.Close();
@ -1569,7 +1568,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
endPoint = (IPEndPoint)array[0];
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
m_logger.LogDebug(
m_logger?.LogDebug(
$"[LLUDPSERVER]: Handling UseCircuitCode request for circuit {uccp.CircuitCode.Code} to {Scene.Name} from IP {endPoint}");
if (IsClientAuthorized(uccp, out AuthenticateResponse sessionInfo))
@ -1581,11 +1580,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
IPAddress aIP = IPAddress.Parse(aCircuit.IPAddress);
if(!endPoint.Address.Equals(aIP))
m_logger.LogDebug($"[LLUDPSERVER]: HandleUseCircuitCode IP mismatch {endPoint.Address} != {aCircuit.IPAddress}");
m_logger?.LogDebug($"[LLUDPSERVER]: HandleUseCircuitCode IP mismatch {endPoint.Address} != {aCircuit.IPAddress}");
}
catch
{
m_logger.LogDebug($"[LLUDPSERVER]: HandleUseCircuitCode could not compare IP {endPoint.Address} {aCircuit.IPAddress}");
m_logger?.LogDebug($"[LLUDPSERVER]: HandleUseCircuitCode could not compare IP {endPoint.Address} {aCircuit.IPAddress}");
}
}
@ -1614,7 +1613,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return;
}
m_logger.LogDebug("[LLUDPSERVER]: Client created");
m_logger?.LogDebug("[LLUDPSERVER]: Client created");
Queue<UDPPacketBuffer> queue = null;
lock (m_pendingCache)
@ -1622,13 +1621,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_pendingCache.TryGetValue(endPoint, out queue))
m_pendingCache.Remove(endPoint);
else
m_logger.LogDebug("[LLUDPSERVER]: HandleUseCircuitCode with no pending queue present");
m_logger?.LogDebug("[LLUDPSERVER]: HandleUseCircuitCode with no pending queue present");
}
// Reinject queued packets
if(queue != null)
{
m_logger.LogDebug($"[LLUDPSERVER]: processing UseCircuitCode pending queue, {queue.Count} entries");
m_logger?.LogDebug($"[LLUDPSERVER]: processing UseCircuitCode pending queue, {queue.Count} entries");
while (queue.Count > 0)
{
UDPPacketBuffer buf = queue.Dequeue();
@ -1643,7 +1642,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
{
// Don't create clients for unauthorized requesters.
m_logger.LogWarning(
m_logger?.LogWarning(
$"[LLUDPSERVER]: Ignoring connection request for {uccp.CircuitCode.ID} to {Scene.RegionInfo.RegionName} "+
$"with unknown circuit code {uccp.CircuitCode.Code} from IP {endPoint}");
@ -1651,14 +1650,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_pendingCache.Remove(endPoint);
}
//m_logger.LogDebugFormat(
//m_logger?.LogDebugFormat(
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
}
catch (Exception e)
{
m_logger.LogError(
m_logger?.LogError(
e, $"[LLUDPSERVER]: UseCircuitCode handling from endpoint {(endPoint != null ? endPoint : "n/a")}, " +
$"client {(client != null ? client.Name : "unknown")} {(client != null ? client.AgentId.ToString() : "unknown")} failed.");
}
@ -1765,7 +1764,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ClientLogoutsDueToNoReceives++;
if (client.SceneAgent != null)
{
m_logger.LogWarning(
m_logger?.LogWarning(
$"[LLUDPSERVER]: No packets received from {(client.SceneAgent.IsChildAgent ? "child" : "root")} "+
$"agent of {client.Name} for {timeoutTicks}ms in {Scene.Name}. Disconnecting.");
}
@ -1801,7 +1800,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
*/
catch (Exception ex)
{
m_logger.LogError("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
m_logger?.LogError("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
}
Watchdog.UpdateThread();
@ -1809,7 +1808,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packetInbox.Count > 0)
{
m_logger.LogWarning($"[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping {packetInbox.Count} packets");
m_logger?.LogWarning($"[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping {packetInbox.Count} packets");
}
packetInbox.Dispose();
@ -1890,7 +1889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (Exception ex)
{
m_logger.LogError("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
m_logger?.LogError("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
}
}
@ -1927,7 +1926,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (Exception ex)
{
m_logger.LogError(
m_logger?.LogError(
string.Format("[LLUDPSERVER]: OutgoingPacketHandler iteration for {0} threw ", client.Name), ex);
}
}
@ -1973,13 +1972,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch(ThreadAbortException)
{
// If something is trying to abort the packet processing thread, take that as a hint that it's time to shut down
m_logger.LogInformation("[LLUDPSERVER]: Caught a thread abort, shutting down the LLUDP server");
m_logger?.LogInformation("[LLUDPSERVER]: Caught a thread abort, shutting down the LLUDP server");
Stop();
}
catch(Exception e)
{
// Don't let a failure in an individual client thread crash the whole sim.
m_logger.LogError(
m_logger?.LogError(
string.Format(
"[LLUDPSERVER]: Client packet handler for {0} for packet {1} threw ",
client.Name,packet.Type),

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{
public class AssetTransactionModule : INonSharedRegionModule,
@ -57,10 +56,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
public void Initialise(IConfiguration source)
{
IConfig sconfig = source.Configs["Startup"];
IConfigurationSection sconfig = source.GetSection("Startup");
if (sconfig != null)
{
m_levelUpload = sconfig.GetInt("LevelUpload", 0);
m_levelUpload = sconfig.GetValue<int>("LevelUpload", 0);
}
}

View file

@ -25,11 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;

View file

@ -28,20 +28,19 @@
using System.Drawing;
using System.Text;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using CSJ2K;
using Nini.Config;
using OpenSim.Server.Base;
namespace OpenSim.Region.CoreModules.Agent.TextureSender
{
@ -84,10 +83,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
public void Initialise(IConfiguration source)
{
IConfig startupConfig = source.Configs["Startup"];
IConfigurationSection startupConfig = source.GetSection("Startup");
if (startupConfig != null)
{
m_useCSJ2K = startupConfig.GetBoolean("UseCSJ2K", m_useCSJ2K);
m_useCSJ2K = startupConfig.GetValue<bool>("UseCSJ2K", m_useCSJ2K);
}
}

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Agent.Xfer
{
public class XferModule : INonSharedRegionModule, IXfer

View file

@ -30,6 +30,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Timers;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +43,6 @@ using OpenSim.Services.Interfaces;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Asset
{
public class FlotsamAssetCache : ISharedRegionModule, IAssetCache, IAssetService
@ -135,11 +134,11 @@ namespace OpenSim.Region.CoreModules.Asset
public void Initialise(IConfiguration source)
{
IConfig moduleConfig = source.Configs["Modules"];
IConfigurationSection moduleConfig = source.GetSection("Modules");
if (moduleConfig is not null)
{
string name = moduleConfig.GetString("AssetCaching", string.Empty);
string name = moduleConfig.GetValue<string>("AssetCaching", string.Empty);
if (name == Name)
{
@ -148,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Asset
m_logger.LogInformation($"[FLOTSAM ASSET CACHE]: {this.Name} enabled");
IConfig assetConfig = source.Configs["AssetCache"];
IConfigurationSection assetConfig = source.GetSection("AssetCache");
if (assetConfig is null)
{
m_logger.LogDebug(
@ -156,31 +155,31 @@ namespace OpenSim.Region.CoreModules.Asset
}
else
{
m_FileCacheEnabled = assetConfig.GetBoolean("FileCacheEnabled", m_FileCacheEnabled);
m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_CacheDirectory);
m_FileCacheEnabled = assetConfig.GetValue<bool>("FileCacheEnabled", m_FileCacheEnabled);
m_CacheDirectory = assetConfig.GetValue<string>("CacheDirectory", m_CacheDirectory);
m_CacheDirectory = Path.GetFullPath(m_CacheDirectory);
m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled);
m_MemoryExpiration = assetConfig.GetDouble("MemoryCacheTimeout", m_MemoryExpiration);
m_MemoryCacheEnabled = assetConfig.GetValue<bool>("MemoryCacheEnabled", m_MemoryCacheEnabled);
m_MemoryExpiration = assetConfig.GetValue<double>("MemoryCacheTimeout", m_MemoryExpiration);
m_MemoryExpiration *= 3600.0; // config in hours to seconds
m_negativeCacheEnabled = assetConfig.GetBoolean("NegativeCacheEnabled", m_negativeCacheEnabled);
m_negativeExpiration = assetConfig.GetInt("NegativeCacheTimeout", m_negativeExpiration);
m_negativeCacheEnabled = assetConfig.GetValue<bool>("NegativeCacheEnabled", m_negativeCacheEnabled);
m_negativeExpiration = assetConfig.GetValue<int>("NegativeCacheTimeout", m_negativeExpiration);
m_updateFileTimeOnCacheHit = assetConfig.GetBoolean("UpdateFileTimeOnCacheHit", m_updateFileTimeOnCacheHit);
m_updateFileTimeOnCacheHit = assetConfig.GetValue<bool>("UpdateFileTimeOnCacheHit", m_updateFileTimeOnCacheHit);
m_updateFileTimeOnCacheHit &= m_FileCacheEnabled;
m_LogLevel = assetConfig.GetInt("LogLevel", m_LogLevel);
m_HitRateDisplay = (ulong)assetConfig.GetLong("HitRateDisplay", (long)m_HitRateDisplay);
m_LogLevel = assetConfig.GetValue<int>("LogLevel", m_LogLevel);
m_HitRateDisplay = (ulong)assetConfig.GetValue<long>("HitRateDisplay", (long)m_HitRateDisplay);
m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
m_FileExpiration = TimeSpan.FromHours(assetConfig.GetValue<double>("FileCacheTimeout", m_DefaultFileExpiration));
m_FileExpirationCleanupTimer = TimeSpan.FromHours(
assetConfig.GetDouble("FileCleanupTimer", m_FileExpirationCleanupTimer.TotalHours));
assetConfig.GetValue<double>("FileCleanupTimer", m_FileExpirationCleanupTimer.TotalHours));
m_CacheDirectoryTiers = assetConfig.GetInt("CacheDirectoryTiers", m_CacheDirectoryTiers);
m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen);
m_CacheDirectoryTiers = assetConfig.GetValue<int>("CacheDirectoryTiers", m_CacheDirectoryTiers);
m_CacheDirectoryTierLen = assetConfig.GetValue<int>("CacheDirectoryTierLength", m_CacheDirectoryTierLen);
m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt);
m_CacheWarnAt = assetConfig.GetValue<int>("CacheWarnAt", m_CacheWarnAt);
}
if(m_updateFileTimeOnCacheHit)
@ -203,11 +202,11 @@ namespace OpenSim.Region.CoreModules.Asset
m_negativeExpiration *= 1000;
assetConfig = source.Configs["AssetService"];
assetConfig = source.GetSection("AssetService");
if(assetConfig is not null)
{
m_assetLoader = assetConfig.GetString("DefaultAssetLoader", string.Empty);
m_assetLoaderArgs = assetConfig.GetString("AssetLoaderArgs", string.Empty);
m_assetLoader = assetConfig.GetValue<string>("DefaultAssetLoader", string.Empty);
m_assetLoaderArgs = assetConfig.GetValue<string>("AssetLoaderArgs", string.Empty);
if (string.IsNullOrWhiteSpace(m_assetLoaderArgs))
m_assetLoader = string.Empty;
}

View file

@ -28,6 +28,7 @@
using System.Text;
using System.Xml;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +43,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
public class AttachmentsModule : IAttachmentsModule, INonSharedRegionModule
@ -70,11 +69,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<AttachmentsModule>>();
IConfig config = source.Configs["Attachments"];
IConfigurationSection config = source.GetSection("Attachments");
if (config is not null)
{
Enabled = config.GetBoolean("Enabled", true);
m_wearReplacesAllOption = config.GetBoolean("WearReplacesAll", true);
Enabled = config.GetValue<bool>("Enabled", true);
m_wearReplacesAllOption = config.GetValue<bool>("WearReplacesAll", true);
}
else
{

View file

@ -25,9 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Text;
using System.Collections.Concurrent;
using System.Timers;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -40,8 +41,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
@ -74,12 +73,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<AvatarFactoryModule>>();
IConfig appearanceConfig = config.Configs["Appearance"];
IConfigurationSection appearanceConfig = config.GetSection("Appearance");
if (appearanceConfig != null)
{
m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime)));
m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime)));
m_reusetextures = appearanceConfig.GetBoolean("ReuseTextures",m_reusetextures);
m_savetime = appearanceConfig.GetValue<int>("DelayBeforeAppearanceSave", m_savetime);
m_sendtime = appearanceConfig.GetValue<int>("DelayBeforeAppearanceSend", m_sendtime);
m_reusetextures = appearanceConfig.GetValue<bool>("ReuseTextures", m_reusetextures);
// m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime);
}

View file

@ -29,6 +29,7 @@ using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -41,8 +42,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
{
public class XBakesModule : INonSharedRegionModule, IBakedTextureModule
@ -60,11 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<XBakesModule>>();
IConfig config = configSource.Configs["XBakes"];
IConfigurationSection config = configSource.GetSection("XBakes");
if (config == null)
return;
m_URL = config.GetString("URL", String.Empty);
m_URL = config.GetValue<string>("URL", String.Empty);
if (m_URL.Length == 0)
return;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Chat
{
public class ChatModule : ISharedRegionModule
@ -58,28 +57,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
protected List<string> FreezeCache = new List<string>();
protected string m_adminPrefix = "";
protected object m_syncy = new object();
protected IConfig m_config;
protected IConfigurationSection m_config;
#region ISharedRegionModule Members
public virtual void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<ChatModule>>();
m_config = config.Configs["Chat"];
m_config = config.GetSection("Chat");
if (m_config != null)
{
if (!m_config.GetBoolean("enabled", true))
if (!m_config.GetValue<bool>("enabled", true))
{
m_log.Info("[CHAT]: plugin disabled by configuration");
m_logger.LogInformation("[CHAT]: plugin disabled by configuration");
m_enabled = false;
return;
}
m_whisperdistance = m_config.GetInt("whisper_distance", m_whisperdistance);
m_saydistance = m_config.GetInt("say_distance", m_saydistance);
m_shoutdistance = m_config.GetInt("shout_distance", m_shoutdistance);
m_adminPrefix = m_config.GetString("admin_prefix", "");
m_whisperdistance = m_config.GetValue<int>("whisper_distance", m_whisperdistance);
m_saydistance = m_config.GetValue<int>("say_distance", m_saydistance);
m_shoutdistance = m_config.GetValue<int>("shout_distance", m_shoutdistance);
m_adminPrefix = m_config.GetValue<string>("admin_prefix", "");
}
m_saydistanceSQ = m_saydistance * m_saydistance;

View file

@ -25,7 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;

View file

@ -26,8 +26,11 @@
*/
using System.Text.RegularExpressions;
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Dialog
{
public class DialogModule : IDialogModule, INonSharedRegionModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -37,9 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Friends
{
public class CallingCardModule : ISharedRegionModule, ICallingCardModule
@ -53,9 +51,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<CallingCardModule>>();
IConfig ccConfig = source.Configs["XCallingCard"];
IConfigurationSection ccConfig = source.GetSection("XCallingCard");
if (ccConfig != null)
m_Enabled = ccConfig.GetBoolean("Enabled", true);
m_Enabled = ccConfig.GetValue<bool>("Enabled", true);
}
public void AddRegion(Scene scene)

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +43,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Friends
{
public class FriendsModule : ISharedRegionModule, IFriendsModule
@ -155,10 +154,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<FriendsModule>>();
IConfig moduleConfig = config.Configs["Modules"];
IConfigurationSection moduleConfig = config.GetSection("Modules");
if (moduleConfig != null)
{
string name = moduleConfig.GetString("FriendsModule", "FriendsModule");
string name = moduleConfig.GetValue<string>("FriendsModule", "FriendsModule");
if (name == Name)
{
InitModule(config);
@ -171,12 +170,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected virtual void InitModule(IConfiguration config)
{
IConfig friendsConfig = config.Configs["Friends"];
IConfigurationSection friendsConfig = config.GetSection("Friends");
if (friendsConfig != null)
{
int mPort = friendsConfig.GetInt("Port", 0);
int mPort = friendsConfig.GetValue<int>("Port", 0);
string connector = friendsConfig.GetString("Connector", String.Empty);
string connector = friendsConfig.GetValue<string>("Connector", String.Empty);
Object[] args = new Object[] { config };
m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(connector, args);
@ -608,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
else
{
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
m_logger.LogWarning("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
}
}
@ -770,7 +769,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (region is not null)
m_FriendsSimConnector.FriendshipDenied(region, client.AgentId, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
m_logger.LogWarning("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
}
}

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -33,6 +34,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Hypergrid;
using OpenSim.Server.Base;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
@ -40,9 +42,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using Nini.Config;
using OpenSim.Server.Base;
namespace OpenSim.Region.CoreModules.Avatar.Friends
{
public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector
@ -94,10 +93,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
base.InitModule(config);
// Additionally to the base method
IConfig friendsConfig = config.Configs["HGFriendsModule"];
IConfigurationSection friendsConfig = config.GetSection("HGFriendsModule");
if (friendsConfig != null)
{
m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
m_levelHGFriends = friendsConfig.GetValue<int>("LevelHGFriends", 0);
// TODO: read in all config variables pertaining to
// HG friendship permissions

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Gestures
{
public class GesturesModule : INonSharedRegionModule

View file

@ -27,6 +27,7 @@
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -43,8 +44,6 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Gods
{
public class GodsModule : INonSharedRegionModule, IGodsModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Groups
{
public class GroupsModule : ISharedRegionModule
@ -64,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<GroupsModule>>();
IConfig groupsConfig = config.Configs["Groups"];
IConfigurationSection groupsConfig = config.GetSection("Groups");
if (groupsConfig == null)
{
@ -72,14 +71,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
}
else
{
m_Enabled = groupsConfig.GetBoolean("Enabled", false);
m_Enabled = groupsConfig.GetValue<bool>("Enabled", false);
if (!m_Enabled)
{
m_logger?.LogInformation("[GROUPS]: Groups disabled in configuration");
return;
}
if (groupsConfig.GetString("Module", "Default") != "Default")
if (groupsConfig.GetValue<string>("Module", "Default") != "Default")
{
m_Enabled = false;
return;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -39,8 +40,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector
@ -70,8 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HGMessageTransferModule>>();
IConfig cnf = config.Configs["Messaging"];
if (cnf != null && cnf.GetString("MessageTransferModule", "MessageTransferModule") != Name)
IConfigurationSection cnf = config.GetSection("Messaging");
if (cnf != null && cnf.GetValue<string>("MessageTransferModule", "MessageTransferModule") != Name)
{
m_logger?.LogDebug("[HG MESSAGE TRANSFER]: Disabled by configuration");
return;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public class InstantMessageModule : ISharedRegionModule
@ -57,9 +56,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
public virtual void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<InstantMessageModule>>();
if (config.Configs["Messaging"] != null)
if (config.GetSection("Messaging") != null)
{
if (config.Configs["Messaging"].GetString(
if (config.GetSection("Messaging").GetValue<string>(
"InstantMessageModule", "InstantMessageModule") !=
"InstantMessageModule")
return;

View file

@ -27,6 +27,7 @@
using System.Collections;
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -43,8 +44,6 @@ using OpenMetaverse;
using Nwc.XmlRpc;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule
@ -74,15 +73,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
public virtual void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<MessageTransferModule>>();
IConfig cnf = config.Configs["Messaging"];
IConfigurationSection cnf = config.GetSection("Messaging");
if (cnf != null)
{
if (cnf.GetString("MessageTransferModule", "MessageTransferModule") != "MessageTransferModule")
if (cnf.GetValue<string>("MessageTransferModule", "MessageTransferModule") != "MessageTransferModule")
{
return;
}
m_MessageKey = cnf.GetString("MessageKey", String.Empty);
m_MessageKey = cnf.GetValue<string>("MessageKey", String.Empty);
}
m_logger?.LogDebug("[MESSAGE TRANSFER]: Module enabled");
m_Enabled = true;

View file

@ -24,6 +24,7 @@
* (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 Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Services.Interfaces;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public class MuteListModule : ISharedRegionModule
@ -51,11 +50,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<MuteListModule>>();
IConfig cnf = config.Configs["Messaging"];
IConfigurationSection cnf = config.GetSection("Messaging");
if (cnf == null)
return;
if (cnf.GetString("MuteListModule", "None") != "MuteListModule")
if (cnf.GetValue<string>("MuteListModule", "None") != "MuteListModule")
return;
m_Enabled = true;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public struct SendReply
@ -61,20 +60,20 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<OfflineMessageModule>>();
IConfig cnf = config.Configs["Messaging"];
IConfigurationSection cnf = config.GetSection("Messaging");
if (cnf == null)
{
enabled = false;
return;
}
if (cnf != null && cnf.GetString("OfflineMessageModule", "None") !=
if (cnf != null && cnf.GetValue<string>("OfflineMessageModule", "None") !=
"OfflineMessageModule")
{
enabled = false;
return;
}
m_RestURL = cnf.GetString("OfflineMessageURL", "");
m_RestURL = cnf.GetValue<string>("OfflineMessageURL", "");
if (m_RestURL.Length == 0)
{
m_logger?.LogError("[OFFLINE MESSAGING] Module was enabled, but no URL is given, disabling");
@ -82,8 +81,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return;
}
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
m_UseNewAvnCode = cnf.GetBoolean("UseNewAvnCode", m_UseNewAvnCode);
m_ForwardOfflineGroupMessages = cnf.GetValue<bool>("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
m_UseNewAvnCode = cnf.GetValue<bool>("UseNewAvnCode", m_UseNewAvnCode);
}
public void AddRegion(Scene scene)

View file

@ -24,6 +24,7 @@
* (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 Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
public class PresenceModule : ISharedRegionModule, IPresenceModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,8 +39,6 @@ using OpenMetaverse;
using NDesk.Options;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
/// <summary>

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
public class InventoryTransferModule : ISharedRegionModule
@ -56,11 +55,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<InventoryTransferModule>>();
if (config.Configs["Messaging"] != null)
if (config.GetSection("Messaging") != null)
{
// Allow disabling this module in config
//
if (config.Configs["Messaging"].GetString(
if (config.GetSection("Messaging").GetValue<string>(
"InventoryTransferModule", "InventoryTransferModule") !=
"InventoryTransferModule")
{
@ -90,7 +89,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
if (m_TransferModule == null)
{
m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
m_logger.LogError("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
m_Enabled = false;
// m_Scenelist.Clear();

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.Avatar.Lure
@ -58,9 +57,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HGLureModule>>();
if (config.Configs["Messaging"] != null)
if (config.GetSection("Messaging") != null)
{
if (config.Configs["Messaging"].GetString("LureModule", string.Empty) == "HGLureModule")
if (config.GetSection("Messaging").GetValue<string>("LureModule", string.Empty) == "HGLureModule")
{
m_Enabled = true;
}

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Lure
{
public class LureModule : ISharedRegionModule
@ -51,9 +50,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<LureModule>>();
if (config.Configs["Messaging"] != null)
if (config.GetSection("Messaging") != null)
{
if (config.Configs["Messaging"].GetString(
if (config.GetSection("Messaging").GetValue<string>(
"LureModule", "LureModule") ==
"LureModule")
{

View file

@ -25,8 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Globalization;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,8 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.Profile
{
public class BasicProfileModule : IProfileModule, ISharedRegionModule
@ -57,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<BasicProfileModule>>();
if(config.Configs["UserProfiles"] != null)
if(config.GetSection("UserProfiles") != null)
return;
m_logger?.LogDebug("[PROFILE MODULE]: Basic Profile Module enabled");

View file

@ -27,8 +27,8 @@
using System.Collections.Concurrent;
using System.Globalization;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -45,9 +45,6 @@ using OpenSim.Server.Base;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
{
public class UserProfileModule : IProfileModule, INonSharedRegionModule
@ -274,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
Config = source;
ReplaceableInterface = typeof(IProfileModule);
IConfig profileConfig = Config.Configs["UserProfiles"];
IConfigurationSection profileConfig = Config.GetSection("UserProfiles");
if (profileConfig is null)
{
@ -285,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
// If we find ProfileURL then we configure for FULL support
// else we setup for BASIC support
ProfileServerUri = profileConfig.GetString("ProfileServiceURL", "");
ProfileServerUri = profileConfig.GetValue<string>("ProfileServiceURL", "");
if (string.IsNullOrEmpty(ProfileServerUri))
{
Enabled = false;
@ -295,13 +292,13 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
OSHTTPURI tmp = new(ProfileServerUri, true);
if (!tmp.IsResolvedHost)
{
m_log.ErrorFormat("[UserProfileModule: {0}", tmp.IsValidHost ? "Could not resolve ProfileServiceURL" : "ProfileServiceURL is a invalid host");
m_logger?.LogError("[UserProfileModule: {0}", tmp.IsValidHost ? "Could not resolve ProfileServiceURL" : "ProfileServiceURL is a invalid host");
throw new Exception("UserProfileModule init error");
}
ProfileServerUri = tmp.URI;
m_allowUserProfileWebURLs = profileConfig.GetBoolean("AllowUserProfileWebURLs", m_allowUserProfileWebURLs);
m_allowUserProfileWebURLs = profileConfig.GetValue<bool>("AllowUserProfileWebURLs", m_allowUserProfileWebURLs);
m_logger?.LogDebug("[UserProfileModule]: Full Profiles Enabled");
ReplaceableInterface = null;

View file

@ -26,9 +26,9 @@
*/
using System.Collections;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -43,9 +43,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework
{
public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes
{
public class DAExampleModule : INonSharedRegionModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes
{
/// <summary>

View file

@ -26,8 +26,8 @@
*/
using System.Net;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +42,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule, IDisposable
@ -245,10 +243,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual void Initialise(IConfiguration source)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<EntityTransferModule>>();
IConfig moduleConfig = source.Configs["Modules"];
IConfigurationSection moduleConfig = source.GetSection("Modules");
if (moduleConfig != null)
{
string name = moduleConfig.GetString("EntityTransferModule", "");
string name = moduleConfig.GetValue<string>("EntityTransferModule", "");
if (name == Name)
{
InitialiseCommon(source);
@ -263,14 +261,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="source"></param>
protected virtual void InitialiseCommon(IConfiguration source)
{
IConfig transferConfig = source.Configs["EntityTransfer"];
IConfigurationSection transferConfig = source.GetSection("EntityTransfer");
if (transferConfig != null)
{
DisableInterRegionTeleportCancellation
= transferConfig.GetBoolean("DisableInterRegionTeleportCancellation", false);
= transferConfig.GetValue<bool>("DisableInterRegionTeleportCancellation", false);
WaitForAgentArrivedAtDestination
= transferConfig.GetBoolean("wait_for_callback", WaitForAgentArrivedAtDestination);
= transferConfig.GetValue<bool>("wait_for_callback", WaitForAgentArrivedAtDestination);
}
m_entityTransferStateMachine = new EntityTransferStateMachine(this);

View file

@ -32,8 +32,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
/// <summary>

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -39,8 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@ -122,22 +119,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void Initialise(IConfiguration source)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HGEntityTransferModule>>();
IConfig moduleConfig = source.Configs["Modules"];
IConfigurationSection moduleConfig = source.GetSection("Modules");
if (moduleConfig != null)
{
string name = moduleConfig.GetString("EntityTransferModule", "");
string name = moduleConfig.GetValue<string>("EntityTransferModule", "");
if (name == Name)
{
IConfig transferConfig = source.Configs["EntityTransfer"];
IConfigurationSection transferConfig = source.GetSection("EntityTransfer");
if (transferConfig != null)
{
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
m_levelHGTeleport = transferConfig.GetValue<int>("LevelHGTeleport", 0);
m_RestrictAppearanceAbroad = transferConfig.GetBoolean("RestrictAppearanceAbroad", false);
m_RestrictAppearanceAbroad = transferConfig.GetValue<bool>("RestrictAppearanceAbroad", false);
if (m_RestrictAppearanceAbroad)
{
m_AccountName = transferConfig.GetString("AccountForAppearance", string.Empty);
m_AccountName = transferConfig.GetValue<string>("AccountForAppearance", string.Empty);
if (m_AccountName.Length == 0)
m_logger?.LogWarning("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is on, but no account has been given for avatar appearance!");
}

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,7 +37,6 @@ using OpenSim.Server.Base;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
@ -77,10 +75,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public override void Initialise(IConfiguration source)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HGInventoryAccessModule>>();
IConfig moduleConfig = source.Configs["Modules"];
IConfigurationSection moduleConfig = source.GetSection("Modules");
if (moduleConfig != null)
{
string name = moduleConfig.GetString("InventoryAccessModule", "");
string name = moduleConfig.GetValue<string>("InventoryAccessModule", "");
if (name == Name)
{
m_Enabled = true;
@ -89,13 +87,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
m_logger?.LogInformation("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name);
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
IConfigurationSection thisModuleConfig = source.GetSection("HGInventoryAccessModule");
if (thisModuleConfig != null)
{
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false);
m_LocalAssetsURL = thisModuleConfig.GetString("RegionHGAssetServerURI", string.Empty);
m_OutboundPermission = thisModuleConfig.GetValue<bool>("OutboundPermission", true);
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetValue<bool>("RestrictInventoryAccessAbroad", true);
m_CheckSeparateAssets = thisModuleConfig.GetValue<bool>("CheckSeparateAssets", false);
m_LocalAssetsURL = thisModuleConfig.GetValue<string>("RegionHGAssetServerURI", string.Empty);
m_LocalAssetsURL = m_LocalAssetsURL.Trim(new char[] { '/' });
}

View file

@ -26,8 +26,8 @@
*/
using System.Globalization;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +42,6 @@ using PermissionMask = OpenSim.Framework.PermissionMask;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule
@ -81,10 +79,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public virtual void Initialise(IConfiguration source)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<BasicInventoryAccessModule>>();
IConfig moduleConfig = source.Configs["Modules"];
IConfigurationSection moduleConfig = source.GetSection("Modules");
if (moduleConfig is not null)
{
string name = moduleConfig.GetString("InventoryAccessModule", string.Empty);
string name = moduleConfig.GetValue<string>("InventoryAccessModule", string.Empty);
if (name == Name)
{
m_Enabled = true;
@ -102,8 +100,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <param name="source"></param>
protected virtual void InitialiseCommon(IConfiguration source)
{
IConfig inventoryConfig = source.Configs["Inventory"];
CoalesceMultipleObjectsToInventory = inventoryConfig is null || inventoryConfig.GetBoolean("CoalesceMultipleObjectsToInventory", true);
IConfigurationSection inventoryConfig = source.GetSection("Inventory");
CoalesceMultipleObjectsToInventory = inventoryConfig is null || inventoryConfig.GetValue<bool>("CoalesceMultipleObjectsToInventory", true);
}
public virtual void PostInitialise()

View file

@ -24,6 +24,7 @@
* (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 Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.CoreModules.Framework.Library
@ -58,13 +57,13 @@ namespace OpenSim.Region.CoreModules.Framework.Library
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<LibraryModule>>();
m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled);
m_Enabled = config.GetSection("Modules").GetValue<bool>("LibraryModule", m_Enabled);
if (m_Enabled)
{
IConfig libConfig = config.Configs["LibraryService"];
IConfigurationSection libConfig = config.GetSection("LibraryService");
if (libConfig != null)
{
string dllName = libConfig.GetString("LocalServiceModule", string.Empty);
string dllName = libConfig.GetValue<string>("LocalServiceModule", string.Empty);
m_logger?.LogDebug("[LIBRARY MODULE]: Library service dll is " + dllName);
if (dllName != string.Empty)
{

View file

@ -26,8 +26,8 @@
*/
using System.Net;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -41,8 +41,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.Monitoring
{
public class MonitorModule : INonSharedRegionModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +37,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
namespace OpenSim.Region.CoreModules.Framework.Search
@ -59,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Framework.Search
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<BasicSearchModule>>();
string umanmod = config.Configs["Modules"].GetString("SearchModule", Name);
string umanmod = config.GetSection("Modules").GetValue<string>("SearchModule", Name);
if (umanmod == Name)
{
m_Enabled = true;

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -37,8 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.ServiceThrottle
{
public class ServiceThrottleModule : ISharedRegionModule, IServiceThrottleModule

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -35,8 +36,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.UserManagement
{
public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement
@ -48,8 +47,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public override void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HGUserManagementModule>>();
string umanmod = config.Configs["Modules"].GetString("UserManagementModule", null);
if (umanmod == Name)
string? umanmod = config?.GetSection("Modules")?.GetValue<string>("UserManagementModule", "");
if (!String.IsNullOrEmpty(umanmod) && umanmod == Name)
{
m_Enabled = true;
base.Init(config);

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,9 +39,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.UserManagement
{
public class UserManagementModule : ISharedRegionModule, IUserManagement, IPeople
@ -97,8 +95,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public virtual void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<UserManagementModule>>();
string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name);
if (umanmod == Name)
string umanmod = config.GetSection("Modules").GetValue<string>("UserManagementModule", "");
if (!String.IsNullOrEmpty(umanmod) && umanmod == Name)
{
m_Enabled = true;
Init(config);

View file

@ -29,6 +29,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -40,8 +41,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager
@ -337,11 +336,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<DynamicTextureModule>>();
IConfig texturesConfig = config.Configs["Textures"];
if (texturesConfig != null)
IConfigurationSection texturesConfig = config.GetSection("Textures");
if (texturesConfig is not null)
{
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false);
ReuseTextures = texturesConfig.GetValue<bool>("ReuseDynamicTextures", false);
ReuseLowDataTextures = texturesConfig.GetValue<bool>("ReuseDynamicLowDataTextures", false);
if (ReuseTextures)
{

View file

@ -26,9 +26,9 @@
*/
using System.Net.Security;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -43,8 +43,6 @@ using MailKit.Net.Smtp;
using MimeKit;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
{
public class EmailModule : ISharedRegionModule, IEmailModule
@ -120,29 +118,29 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<EmailModule>>();
IConfig startupConfig = config.Configs["Startup"];
IConfigurationSection startupConfig = config.GetSection("Startup");
if(startupConfig == null)
return;
if(startupConfig.GetString("emailmodule", "DefaultEmailModule") != "DefaultEmailModule")
if(startupConfig.GetValue<string>("emailmodule", "DefaultEmailModule") != "DefaultEmailModule")
return;
//Load SMTP SERVER config
try
{
IConfig SMTPConfig = config.Configs["SMTP"];
IConfigurationSection SMTPConfig = config.GetSection("SMTP");
if (SMTPConfig == null)
return;
if(!SMTPConfig.GetBoolean("enabled", false))
if(!SMTPConfig.GetValue<bool>("enabled", false))
return;
m_enableEmailToExternalObjects = SMTPConfig.GetBoolean("enableEmailToExternalObjects", m_enableEmailToExternalObjects);
m_enableEmailToSMTP = SMTPConfig.GetBoolean("enableEmailToSMTP", m_enableEmailToSMTP);
m_enableEmailToExternalObjects = SMTPConfig.GetValue<bool>("enableEmailToExternalObjects", m_enableEmailToExternalObjects);
m_enableEmailToSMTP = SMTPConfig.GetValue<bool>("enableEmailToSMTP", m_enableEmailToSMTP);
m_MailsToPrimAddressPerHour = SMTPConfig.GetInt("MailsToPrimAddressPerHour", m_MailsToPrimAddressPerHour);
m_MailsToPrimAddressPerHour = SMTPConfig.GetValue<int>("MailsToPrimAddressPerHour", m_MailsToPrimAddressPerHour);
m_MailsToPrimAddressRate = m_MailsToPrimAddressPerHour / 3600.0;
m_MailsFromOwnerPerHour = SMTPConfig.GetInt("MailsFromOwnerPerHour", m_MailsFromOwnerPerHour);
m_MailsFromOwnerPerHour = SMTPConfig.GetValue<int>("MailsFromOwnerPerHour", m_MailsFromOwnerPerHour);
m_MailsFromOwnerRate = m_MailsFromOwnerPerHour / 3600.0;
m_mailParseOptions = new ParserOptions()
@ -150,17 +148,17 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
AllowAddressesWithoutDomain = false,
};
m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname);
m_InterObjectHostname = SMTPConfig.GetValue<string>("internal_object_host", m_InterObjectHostname);
m_checkSpecName = !m_InterObjectHostname.Equals("lsl.secondlife.com");
if (m_enableEmailToSMTP)
{
m_SMTP_MailsPerDay = SMTPConfig.GetInt("SMTP_MailsPerDay", m_SMTP_MailsPerDay);
m_SMTP_MailsPerDay = SMTPConfig.GetValue<int>("SMTP_MailsPerDay", m_SMTP_MailsPerDay);
m_SMTP_MailsRate = m_SMTP_MailsPerDay / 86400.0;
m_MailsToSMTPAddressPerHour = SMTPConfig.GetInt("MailsToSMTPAddressPerHour", m_MailsToPrimAddressPerHour);
m_MailsToSMTPAddressPerHour = SMTPConfig.GetValue<int>("MailsToSMTPAddressPerHour", m_MailsToPrimAddressPerHour);
m_MailsToSMTPAddressRate = m_MailsToPrimAddressPerHour / 3600.0;
SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
SMTP_SERVER_HOSTNAME = SMTPConfig.GetValue<string>("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME);
OSHHTPHost hosttmp = new OSHHTPHost(SMTP_SERVER_HOSTNAME, true);
if(!hosttmp.IsResolvedHost)
{
@ -168,22 +166,22 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
return;
}
SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
SMTP_SERVER_TLS = SMTPConfig.GetBoolean("SMTP_SERVER_TLS", SMTP_SERVER_TLS);
SMTP_SERVER_PORT = SMTPConfig.GetValue<int>("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
SMTP_SERVER_TLS = SMTPConfig.GetValue<bool>("SMTP_SERVER_TLS", SMTP_SERVER_TLS);
string smtpfrom = SMTPConfig.GetString("SMTP_SERVER_FROM", string.Empty);
m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName);
string smtpfrom = SMTPConfig.GetValue<string>("SMTP_SERVER_FROM", string.Empty);
m_HostName = SMTPConfig.GetValue<string>("host_domain_header_from", m_HostName);
if (!string.IsNullOrEmpty(smtpfrom) && !MailboxAddress.TryParse(m_mailParseOptions, smtpfrom, out SMTP_MAIL_FROM))
{
m_logger?.LogError("[EMAIL]: Invalid SMTP_SERVER_FROM {0}", smtpfrom);
return;
}
SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
SMTP_SERVER_LOGIN = SMTPConfig.GetValue<string>("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
SMTP_SERVER_PASSWORD = SMTPConfig.GetValue<string>("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
bool VerifyCertChain = SMTPConfig.GetBoolean("SMTP_VerifyCertChain", true);
bool VerifyCertNames = SMTPConfig.GetBoolean("SMTP_VerifyCertNames", true);
bool VerifyCertChain = SMTPConfig.GetValue<bool>("SMTP_VerifyCertChain", true);
bool VerifyCertNames = SMTPConfig.GetValue<bool>("SMTP_VerifyCertNames", true);
m_SMTP_SslPolicyErrorsMask = VerifyCertChain ? 0 : SslPolicyErrors.RemoteCertificateChainErrors;
if (!VerifyCertNames)
m_SMTP_SslPolicyErrorsMask |= SslPolicyErrors.RemoteCertificateNameMismatch;
@ -195,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
m_logger?.LogWarning("[EMAIL]: SMTP disabled, set enableEmailSMTP to enable");
}
m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
m_MaxEmailSize = SMTPConfig.GetValue<int>("email_max_size", m_MaxEmailSize);
if(m_MaxEmailSize < 256 || m_MaxEmailSize > 1000000)
{
m_logger?.LogWarning("[EMAIL]: email_max_size out of range [256, 1000000], Changed to default 4096");

View file

@ -28,14 +28,17 @@
using System.Collections.Concurrent;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using Nini.Config;
using Microsoft.Extensions.Configuration;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using System.Security.Authentication;
/*****************************************************
*
@ -97,11 +100,11 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
if (m_jobEngine is null)
{
WebProxy proxy = null;
string proxyurl = config.Configs["Startup"].GetString("HttpProxy");
string proxyurl = config.GetSection("Startup").GetValue<string>("HttpProxy");
if (!string.IsNullOrEmpty(proxyurl))
{
string[] proxyexceptsArray = null;
string proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
string proxyexcepts = config.GetSection("Startup").GetValue<string>("HttpProxyExceptions");
if (!string.IsNullOrEmpty(proxyexcepts))
{
proxyexceptsArray = proxyexcepts.Split(';');
@ -113,21 +116,21 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
new WebProxy(proxyurl, true, proxyexceptsArray);
}
m_HttpBodyMaxLenMAX = config.Configs["Network"].GetInt("HttpBodyMaxLenMAX", m_HttpBodyMaxLenMAX);
m_HttpBodyMaxLenMAX = config.GetSection("Network").GetValue<int>("HttpBodyMaxLenMAX", m_HttpBodyMaxLenMAX);
m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config);
int maxThreads = 8;
IConfig httpConfig = config.Configs["ScriptsHttpRequestModule"];
IConfigurationSection httpConfig = config.GetSection("ScriptsHttpRequestModule");
int httpTimeout = 30000;
if (httpConfig is not null)
{
maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads);
m_primBurst = httpConfig.GetFloat("PrimRequestsBurst", m_primBurst);
m_primPerSec = httpConfig.GetFloat("PrimRequestsPerSec", m_primPerSec);
m_primOwnerBurst = httpConfig.GetFloat("PrimOwnerRequestsBurst", m_primOwnerBurst);
m_primOwnerPerSec = httpConfig.GetFloat("PrimOwnerRequestsPerSec", m_primOwnerPerSec);
httpTimeout = httpConfig.GetInt("RequestsTimeOut", httpTimeout);
maxThreads = httpConfig.GetValue<int>("MaxPoolThreads", maxThreads);
m_primBurst = httpConfig.GetValue<float>("PrimRequestsBurst", m_primBurst);
m_primPerSec = httpConfig.GetValue<float>("PrimRequestsPerSec", m_primPerSec);
m_primOwnerBurst = httpConfig.GetValue<float>("PrimOwnerRequestsBurst", m_primOwnerBurst);
m_primOwnerPerSec = httpConfig.GetValue<float>("PrimOwnerRequestsPerSec", m_primOwnerPerSec);
httpTimeout = httpConfig.GetValue<int>("RequestsTimeOut", httpTimeout);
if (httpTimeout > 60000)
httpTimeout = 60000;
else if (httpTimeout < 200)
@ -654,7 +657,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
if (totalBodyBytes > 0)
{
string tempString = Util.UTF8.GetString(buf, 0, totalBodyBytes);
string tempString = Util.UTF8.GetValue<string>(buf, 0, totalBodyBytes);
ResponseBody = tempString.Replace("\r", "");
}
}

View file

@ -30,6 +30,7 @@ using System.Collections.Specialized;
using System.Text;
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -42,8 +43,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
{
public class UrlData
@ -122,20 +121,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<UrlModule>>();
IConfig networkConfig = config.Configs["Network"];
IConfigurationSection? networkConfig = config.GetSection("Network");
m_enabled = false;
if (networkConfig != null)
{
m_lsl_shard = networkConfig.GetString("shard", m_lsl_shard);
m_lsl_user_agent = networkConfig.GetString("user_agent", m_lsl_user_agent);
m_lsl_shard = networkConfig.GetValue<string>("shard", m_lsl_shard);
m_lsl_user_agent = networkConfig.GetValue<string>("user_agent", m_lsl_user_agent);
ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
ExternalHostNameForLSL = networkConfig.GetValue<string>("ExternalHostNameForLSL", null);
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
bool ssl_enabled = networkConfig.GetValue<bool>("https_listener", false);
if (ssl_enabled)
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
m_HttpsPort = (uint)networkConfig.GetValue<int>("https_port", (int)m_HttpsPort);
}
else
{
@ -162,10 +161,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_enabled = true;
m_ErrorStr = String.Empty;
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
IConfigurationSection llFunctionsConfig = config.GetSection("LL-Functions");
if (llFunctionsConfig != null)
TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", DefaultTotalUrls);
TotalUrls = llFunctionsConfig.GetValue<int>("max_external_urls_per_simulator", DefaultTotalUrls);
else
TotalUrls = DefaultTotalUrls;
}

View file

@ -28,6 +28,7 @@
using System.Drawing;
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -39,8 +40,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
{
public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender
@ -112,10 +111,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<LoadImageURLModule>>();
m_outboundUrlFilter = new OutboundUrlFilter("Script dynamic texture image module", config);
string proxyurl = config.Configs["Startup"].GetString("HttpProxy");
string? proxyurl = config?.GetSection("Startup")?.GetValue<string>("HttpProxy");
if(!string.IsNullOrEmpty(proxyurl))
{
string proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
string? proxyexcepts = config?.GetSection("Startup")?.GetValue<string>("HttpProxyExceptions");
if (!string.IsNullOrEmpty(proxyexcepts))
{
string[] elist = proxyexcepts.Split(';');

View file

@ -28,6 +28,7 @@
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -37,8 +38,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
{
public class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms

View file

@ -30,6 +30,7 @@ using System.Drawing.Imaging;
using System.Globalization;
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -40,8 +41,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
//using Cairo;
namespace OpenSim.Region.CoreModules.Scripting.VectorRender
@ -109,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
{
if (m_textureManager == null)
{
m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function");
m_logger.LogWarning("[VECTORRENDERMODULE]: No texture manager. Can't function");
return false;
}
// XXX: This isn't actually being done asynchronously!
@ -141,10 +140,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<VectorRenderModule>>();
IConfig cfg = config.Configs["VectorRender"];
IConfigurationSection cfg = config.GetSection("VectorRender");
if (null != cfg)
{
m_fontName = cfg.GetString("font_name", m_fontName);
m_fontName = cfg.GetValue<string>("font_name", m_fontName);
}
m_logger?.LogDebug("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);

View file

@ -28,6 +28,7 @@
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -38,9 +39,6 @@ using OpenSim.Server.Base;
using OpenMetaverse;
using Nini.Config;
/*****************************************************
*
* WorldCommModule
@ -114,11 +112,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
// the config file doesn't specify otherwise.
try
{
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
m_maxlisteners = config.Configs["LL-Functions"].GetInt("max_listens_per_region", m_maxlisteners);
m_maxhandles = config.Configs["LL-Functions"].GetInt("max_listens_per_script", m_maxhandles);
IConfigurationSection chatConfig = config.GetSection("Chat");
m_whisperdistance = chatConfig.GetValue<int>("whisper_distance", m_whisperdistance);
m_saydistance = chatConfig.GetValue<int>("say_distance", m_saydistance);
m_shoutdistance = chatConfig.GetValue<int>("shout_distance", m_shoutdistance);
IConfigurationSection llFunctionsConfig = config.GetSection("LL-Functions");
m_maxlisteners = llFunctionsConfig.GetValue<int>("max_listens_per_region", m_maxlisteners);
m_maxhandles = llFunctionsConfig.GetValue<int>("max_listens_per_script", m_maxhandles);
}
catch (Exception)
{

View file

@ -29,6 +29,7 @@ using System.Collections;
using System.Net;
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -44,8 +45,6 @@ using Nwc.XmlRpc;
using OpenMetaverse;
using Nini.Config;
/*****************************************************
*
* XMLRPCModule
@ -115,16 +114,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
if (config.Configs["XMLRPC"] != null)
{
try
{
m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
}
catch (Exception)
{
}
}
IConfigurationSection xmlrpcConfig = config.GetSection("XMLRPC");
m_remoteDataPort = xmlrpcConfig.GetValue<int>("XmlRpcPort", m_remoteDataPort);
}
public void PostInitialise()

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
{
public class AssetServiceInConnectorModule : ISharedRegionModule
@ -43,7 +42,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
private static ILogger? m_logger;
private static bool m_Enabled = false;
private IConfiguration m_Config;
bool m_Registered = false;
#region Region Module interface
@ -51,16 +49,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<AssetServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("AssetServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("AssetServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[ASSET IN CONNECTOR]: AssetServiceInConnector enabled");
}
m_logger?.LogInformation("[ASSET IN CONNECTOR]: AssetServiceInConnector enabled");
}
}

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Handlers.Authentication;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
{
public class AuthenticationServiceInConnectorModule : ISharedRegionModule
@ -43,7 +42,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
private static ILogger? m_logger;
private static bool m_Enabled = false;
private IConfiguration m_Config;
bool m_Registered = false;
#region Region Module interface
@ -51,18 +49,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<AuthenticationServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("AuthenticationServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("AuthenticationServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[AUTHENTICATION IN CONNECTOR]: Authentication Service In Connector enabled");
}
m_logger?.LogInformation("[AUTHENTICATION IN CONNECTOR]: Authentication Service In Connector enabled");
}
}
public void PostInitialise()

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Handlers.Grid;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
{
public class GridInfoServiceInConnectorModule : ISharedRegionModule
@ -43,7 +42,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
private static ILogger? m_logger;
private static bool m_Enabled = false;
private IConfiguration m_Config;
bool m_Registered = false;
#region Region Module interface
@ -51,18 +49,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
public void Initialise(IConfiguration config)
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<GridInfoServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("GridInfoServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("GridInfoServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[GRIDINFO IN CONNECTOR]: GridInfo Service In Connector enabled");
}
m_logger?.LogInformation("[GRIDINFO IN CONNECTOR]: GridInfo Service In Connector enabled");
}
}
public void PostInitialise()

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -37,16 +36,14 @@ using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Hypergrid;
using OpenSim.Services.Interfaces;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
{
public class HypergridServiceInConnectorModule : ISharedRegionModule
{
private static ILogger? m_logger;
private static bool m_Enabled = false;
private static IConfiguration m_Config = null;
private IConfiguration m_Config;
private bool m_Registered = false;
private string m_LocalServiceDll = string.Empty;
private GatekeeperServiceInConnector m_HypergridHandler;
@ -58,21 +55,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<HypergridServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = m_Config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("HypergridServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("HypergridServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[HGGRID IN CONNECTOR]: Hypergrid Service In Connector enabled");
IConfig fconfig = config.Configs["FriendsService"];
if (fconfig != null)
{
m_LocalServiceDll = fconfig.GetString("LocalServiceModule", m_LocalServiceDll);
if (m_LocalServiceDll.Length == 0)
m_log.WarnFormat("[HGGRID IN CONNECTOR]: Friends LocalServiceModule config missing");
}
}
m_logger?.LogInformation("[HGGRID IN CONNECTOR]: Hypergrid Service In Connector enabled");
IConfigurationSection fconfig = m_Config.GetSection("FriendsService");
m_LocalServiceDll = fconfig.GetValue<string>("LocalServiceModule", m_LocalServiceDll);
if (String.IsNullOrEmpty(m_LocalServiceDll))
m_logger?.LogWarning("[HGGRID IN CONNECTOR]: Friends LocalServiceModule config missing");
}
}

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -36,8 +35,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
{
public class InventoryServiceInConnectorModule : ISharedRegionModule
@ -54,14 +51,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
{
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<InventoryServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("InventoryServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("InventoryServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[INVENTORY IN CONNECTOR]: Inventory Service In Connector enabled");
}
m_logger?.LogInformation("[INVENTORY IN CONNECTOR]: Inventory Service In Connector enabled");
}
}

View file

@ -25,8 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -40,9 +39,6 @@ using OpenSim.Services.Interfaces;
using OpenMetaverse;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
{
public class LandServiceInConnectorModule : ISharedRegionModule, ILandService
@ -61,17 +57,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<LandServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("LandServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("LandServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[LAND IN CONNECTOR]: LandServiceInConnector enabled");
}
m_logger?.LogInformation("[LAND IN CONNECTOR]: LandServiceInConnector enabled");
}
}
public void PostInitialise()

View file

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -34,8 +35,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Handlers.Login;
using OpenSim.Server.Base;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login
{
public class LLLoginServiceInConnectorModule : ISharedRegionModule
@ -54,17 +53,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login
m_logger ??= OpenSimServer.Instance.ServiceProvider.GetRequiredService<ILogger<LLLoginServiceInConnectorModule>>();
m_Config = config;
IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null)
IConfigurationSection moduleConfig = config.GetSection("Modules");
m_Enabled = moduleConfig.GetValue<bool>("LLLoginServiceInConnector", false);
if (m_Enabled)
{
m_Enabled = moduleConfig.GetBoolean("LLLoginServiceInConnector", false);
if (m_Enabled)
{
m_logger?.LogInformation("[LLLOGIN IN CONNECTOR]: LLLoginerviceInConnector enabled");
}
m_logger?.LogInformation("[LLLOGIN IN CONNECTOR]: LLLoginerviceInConnector enabled");
}
}
public void PostInitialise()

Some files were not shown because too many files have changed in this diff Show more