* Fixed Culture-variant parsing of config options
parent
8231ac72ec
commit
2219ccc5b0
|
@ -9,6 +9,7 @@ using libsecondlife;
|
||||||
|
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Configuration.Interfaces;
|
using OpenSim.Framework.Configuration.Interfaces;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Configuration
|
namespace OpenSim.Framework.Configuration
|
||||||
{
|
{
|
||||||
|
@ -295,7 +296,7 @@ namespace OpenSim.Framework.Configuration
|
||||||
break;
|
break;
|
||||||
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
|
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
|
||||||
float floatResult;
|
float floatResult;
|
||||||
if (float.TryParse(console_result, out floatResult))
|
if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult))
|
||||||
{
|
{
|
||||||
convertSuccess = true;
|
convertSuccess = true;
|
||||||
return_result = floatResult;
|
return_result = floatResult;
|
||||||
|
@ -304,7 +305,7 @@ namespace OpenSim.Framework.Configuration
|
||||||
break;
|
break;
|
||||||
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
|
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
|
||||||
double doubleResult;
|
double doubleResult;
|
||||||
if (Double.TryParse(console_result, out doubleResult))
|
if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult))
|
||||||
{
|
{
|
||||||
convertSuccess = true;
|
convertSuccess = true;
|
||||||
return_result = doubleResult;
|
return_result = doubleResult;
|
||||||
|
@ -332,12 +333,12 @@ namespace OpenSim.Framework.Configuration
|
||||||
{
|
{
|
||||||
if (configOption.configurationUseDefaultNoPrompt)
|
if (configOption.configurationUseDefaultNoPrompt)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("Default given for '" + configOption.configurationKey + "' is not valid; the configuration result must be " + errorMessage + ". Will skip this option...");
|
MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename));
|
||||||
convertSuccess = true;
|
convertSuccess = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("configuration","Incorrect result given, the configuration option must be " + errorMessage + ". Prompting for same option...");
|
MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename));
|
||||||
ignoreNextFromConfig = true;
|
ignoreNextFromConfig = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class Culture
|
||||||
|
{
|
||||||
|
private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true);
|
||||||
|
|
||||||
|
public static NumberFormatInfo NumberFormatInfo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_cultureInfo.NumberFormat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetCurrentCulture()
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.CurrentCulture = m_cultureInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ using System.IO;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Configuration;
|
using OpenSim.Framework.Configuration;
|
||||||
using OpenSim.Framework.Utilities;
|
using OpenSim.Framework.Utilities;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Types
|
namespace OpenSim.Framework.Types
|
||||||
{
|
{
|
||||||
|
@ -719,7 +720,8 @@ namespace OpenSim.Framework.Types
|
||||||
this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result);
|
this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result);
|
||||||
break;
|
break;
|
||||||
case "water_height":
|
case "water_height":
|
||||||
float.TryParse(((double)configuration_result).ToString(),out this.m_waterHeight);
|
double tmpVal = (double) configuration_result;
|
||||||
|
this.m_waterHeight = (float) tmpVal;
|
||||||
break;
|
break;
|
||||||
case "terrain_image_id":
|
case "terrain_image_id":
|
||||||
this.m_terrainImageID = (LLUUID)configuration_result;
|
this.m_terrainImageID = (LLUUID)configuration_result;
|
||||||
|
|
|
@ -29,6 +29,8 @@ using System;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
using System.Threading;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
|
@ -55,9 +57,7 @@ namespace OpenSim
|
||||||
|
|
||||||
Console.WriteLine("Starting...\n");
|
Console.WriteLine("Starting...\n");
|
||||||
|
|
||||||
// Set current culture
|
Culture.SetCurrentCulture();
|
||||||
|
|
||||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(""); // en
|
|
||||||
|
|
||||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ using OpenSim.Region.Communications.OGS1;
|
||||||
using OpenSim.Region.Environment;
|
using OpenSim.Region.Environment;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using System.Globalization;
|
||||||
|
using RegionInfo=OpenSim.Framework.Types.RegionInfo;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
public partial class Scene : SceneBase
|
public partial class Scene : SceneBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate bool FilterAvatarList(ScenePresence avatar);
|
public delegate bool FilterAvatarList(ScenePresence avatar);
|
||||||
|
|
||||||
protected Timer m_heartbeatTimer = new Timer();
|
protected Timer m_heartbeatTimer = new Timer();
|
||||||
|
@ -160,12 +161,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new Scene class, and a region to go with it.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clientThreads">Dictionary to contain client threads</param>
|
|
||||||
/// <param name="regionHandle">Region Handle for this region</param>
|
|
||||||
/// <param name="regionName">Region Name for this region</param>
|
|
||||||
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
|
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
|
||||||
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
||||||
ModuleLoader moduleLoader)
|
ModuleLoader moduleLoader)
|
||||||
|
|
|
@ -33,6 +33,8 @@ using System.IO;
|
||||||
using libTerrain;
|
using libTerrain;
|
||||||
using OpenJPEGNet;
|
using OpenJPEGNet;
|
||||||
using OpenSim.Framework.Interfaces;
|
using OpenSim.Framework.Interfaces;
|
||||||
|
using System.Globalization;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Region.Terrain
|
namespace OpenSim.Region.Terrain
|
||||||
{
|
{
|
||||||
|
@ -603,8 +605,8 @@ namespace OpenSim.Region.Terrain
|
||||||
if (args.GetLength(0) > 2)
|
if (args.GetLength(0) > 2)
|
||||||
{
|
{
|
||||||
int.TryParse(args[2].ToString(), out count);
|
int.TryParse(args[2].ToString(), out count);
|
||||||
double.TryParse(args[3].ToString(), out sizeMin);
|
double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeMin);
|
||||||
double.TryParse(args[4].ToString(), out sizeRange);
|
double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeRange);
|
||||||
bool.TryParse(args[5].ToString(), out island);
|
bool.TryParse(args[5].ToString(), out island);
|
||||||
bool.TryParse(args[6].ToString(), out additive);
|
bool.TryParse(args[6].ToString(), out additive);
|
||||||
bool.TryParse(args[7].ToString(), out noisy);
|
bool.TryParse(args[7].ToString(), out noisy);
|
||||||
|
|
Loading…
Reference in New Issue