* Fixed Culture-variant parsing of config options
parent
8231ac72ec
commit
2219ccc5b0
|
@ -9,6 +9,7 @@ using libsecondlife;
|
|||
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Configuration.Interfaces;
|
||||
using System.Globalization;
|
||||
|
||||
namespace OpenSim.Framework.Configuration
|
||||
{
|
||||
|
@ -295,7 +296,7 @@ namespace OpenSim.Framework.Configuration
|
|||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
|
||||
float floatResult;
|
||||
if (float.TryParse(console_result, out floatResult))
|
||||
if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = floatResult;
|
||||
|
@ -304,7 +305,7 @@ namespace OpenSim.Framework.Configuration
|
|||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
|
||||
double doubleResult;
|
||||
if (Double.TryParse(console_result, out doubleResult))
|
||||
if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = doubleResult;
|
||||
|
@ -332,12 +333,12 @@ namespace OpenSim.Framework.Configuration
|
|||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 OpenSim.Framework.Configuration;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using System.Globalization;
|
||||
|
||||
namespace OpenSim.Framework.Types
|
||||
{
|
||||
|
@ -719,7 +720,8 @@ namespace OpenSim.Framework.Types
|
|||
this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result);
|
||||
break;
|
||||
case "water_height":
|
||||
float.TryParse(((double)configuration_result).ToString(),out this.m_waterHeight);
|
||||
double tmpVal = (double) configuration_result;
|
||||
this.m_waterHeight = (float) tmpVal;
|
||||
break;
|
||||
case "terrain_image_id":
|
||||
this.m_terrainImageID = (LLUUID)configuration_result;
|
||||
|
|
|
@ -29,6 +29,8 @@ using System;
|
|||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using Nini.Config;
|
||||
using System.Threading;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
|
@ -55,9 +57,7 @@ namespace OpenSim
|
|||
|
||||
Console.WriteLine("Starting...\n");
|
||||
|
||||
// Set current culture
|
||||
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(""); // en
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ using OpenSim.Region.Communications.OGS1;
|
|||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using System.Globalization;
|
||||
using RegionInfo=OpenSim.Framework.Types.RegionInfo;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
public partial class Scene : SceneBase
|
||||
{
|
||||
|
||||
public delegate bool FilterAvatarList(ScenePresence avatar);
|
||||
|
||||
protected Timer m_heartbeatTimer = new Timer();
|
||||
|
@ -160,12 +161,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
#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,
|
||||
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
||||
ModuleLoader moduleLoader)
|
||||
|
|
|
@ -33,6 +33,8 @@ using System.IO;
|
|||
using libTerrain;
|
||||
using OpenJPEGNet;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using System.Globalization;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Terrain
|
||||
{
|
||||
|
@ -603,8 +605,8 @@ namespace OpenSim.Region.Terrain
|
|||
if (args.GetLength(0) > 2)
|
||||
{
|
||||
int.TryParse(args[2].ToString(), out count);
|
||||
double.TryParse(args[3].ToString(), out sizeMin);
|
||||
double.TryParse(args[4].ToString(), out sizeRange);
|
||||
double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeMin);
|
||||
double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeRange);
|
||||
bool.TryParse(args[5].ToString(), out island);
|
||||
bool.TryParse(args[6].ToString(), out additive);
|
||||
bool.TryParse(args[7].ToString(), out noisy);
|
||||
|
|
Loading…
Reference in New Issue