From 00800c59d35662d65aeb61a17de0d56fa6196509 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Feb 2010 23:13:35 +0000 Subject: [PATCH] Apply last two patches from http://opensimulator.org/mantis/view.php?id=3522 These patch should allow people using systems that do not have their locale set to En_US or similar to use OpenSim without suffering effects such as being a million miles up in the air on login. The problem was caused by parsing strings without forcing that parse to be En_US (hence different decimal and digit group symbols were causing problems). Thanks very much to VikingErik for doing the legwork on this fix and phacelia for spotting it in the first place. --- .../Rest/Regions/GETHandler.cs | 5 +-- OpenSim/Client/Linden/LLProxyLoginModule.cs | 6 ++-- .../Communications/Services/LoginService.cs | 4 +-- OpenSim/Framework/Culture.cs | 2 +- .../External/RegionSettingsSerializer.cs | 24 ++++++------- .../Grid/UserServer.Modules/UserManager.cs | 24 ++++++------- OpenSim/Region/Application/OpenSim.cs | 6 ++-- .../ClientStack/LindenUDP/LLClientView.cs | 36 +++++++++---------- .../Communications/OGS1/OGS1UserDataPlugin.cs | 12 +++---- .../Framework/InterfaceCommander/Command.cs | 2 +- .../World/Estate/EstateManagementModule.cs | 4 +-- .../TreePopulator/TreePopulatorModule.cs | 6 ++-- .../Shared/Instance/ScriptSerializer.cs | 2 +- .../Region/ScriptEngine/Shared/LSL_Types.cs | 32 ++++++++--------- .../Handlers/Grid/HypergridServerConnector.cs | 6 ++-- 15 files changed, 86 insertions(+), 85 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index 9c90a7ef08..ed18207216 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Xml.Serialization; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; @@ -156,8 +157,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions Vector3 min, max; try { - min = new Vector3((float)Double.Parse(subregion[0]), (float)Double.Parse(subregion[1]), (float)Double.Parse(subregion[2])); - max = new Vector3((float)Double.Parse(subregion[3]), (float)Double.Parse(subregion[4]), (float)Double.Parse(subregion[5])); + min = new Vector3((float)Double.Parse(subregion[0], Culture.NumberFormatInfo), (float)Double.Parse(subregion[1], Culture.NumberFormatInfo), (float)Double.Parse(subregion[2], Culture.NumberFormatInfo)); + max = new Vector3((float)Double.Parse(subregion[3], Culture.NumberFormatInfo), (float)Double.Parse(subregion[4], Culture.NumberFormatInfo), (float)Double.Parse(subregion[5], Culture.NumberFormatInfo)); } catch (Exception) { diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 14ce682084..7c36a9ba84 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -218,9 +218,9 @@ namespace OpenSim.Client.Linden { //m_log.Debug("[CLIENT]: Main agent detected"); agentData.startpos = - new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), - (float)Convert.ToDecimal((string)requestData["startpos_y"]), - (float)Convert.ToDecimal((string)requestData["startpos_z"])); + new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_z"], Culture.NumberFormatInfo)); agentData.child = false; } diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 57ca704e73..71b38edde8 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -1015,8 +1015,8 @@ namespace OpenSim.Framework.Communications.Services } else { - theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value), - float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["z"].Value)); + theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value, Culture.NumberFormatInfo), + float.Parse(uriMatch.Groups["y"].Value, Culture.NumberFormatInfo), float.Parse(uriMatch.Groups["z"].Value, Culture.NumberFormatInfo)); } } response.LookAt = "[r0,r1,r0]"; diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs index 2066794671..3d78fac2d4 100644 --- a/OpenSim/Framework/Culture.cs +++ b/OpenSim/Framework/Culture.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework { public class Culture { - private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); + private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", false); public static NumberFormatInfo NumberFormatInfo { diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index b5901e1bf8..6ba4c5a55e 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -109,7 +109,7 @@ namespace OpenSim.Framework.Serialization.External settings.AgentLimit = int.Parse(xtr.ReadElementContentAsString()); break; case "ObjectBonus": - settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString()); + settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; } } @@ -134,28 +134,28 @@ namespace OpenSim.Framework.Serialization.External settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString()); break; case "ElevationLowSW": - settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowNW": - settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowSE": - settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowNE": - settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighSW": - settings.Elevation2SW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighNW": - settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighSE": - settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighNE": - settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; } } @@ -168,13 +168,13 @@ namespace OpenSim.Framework.Serialization.External switch (xtr.Name) { case "WaterHeight": - settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString()); + settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "TerrainRaiseLimit": - settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString()); + settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "TerrainLowerLimit": - settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString()); + settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "UseEstateSun": settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString()); diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index 36c6297440..a2032dcdcb 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -503,7 +503,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); + userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -514,7 +514,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); + userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -525,7 +525,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); + userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -536,7 +536,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); + userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -547,7 +547,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); + userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -558,7 +558,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); + userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -634,13 +634,13 @@ namespace OpenSim.Grid.UserServer.Modules UUID RegionID = new UUID((string)requestData["region_uuid"]); ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); Vector3 position = new Vector3( - (float)Convert.ToDecimal((string)requestData["region_pos_x"]), - (float)Convert.ToDecimal((string)requestData["region_pos_y"]), - (float)Convert.ToDecimal((string)requestData["region_pos_z"])); + (float)Convert.ToDecimal((string)requestData["region_pos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["region_pos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["region_pos_z"], Culture.NumberFormatInfo)); Vector3 lookat = new Vector3( - (float)Convert.ToDecimal((string)requestData["lookat_x"]), - (float)Convert.ToDecimal((string)requestData["lookat_y"]), - (float)Convert.ToDecimal((string)requestData["lookat_z"])); + (float)Convert.ToDecimal((string)requestData["lookat_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["lookat_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["lookat_z"], Culture.NumberFormatInfo)); handlerLogOffUser = OnLogOffUser; if (handlerLogOffUser != null) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index eccd2765cc..a86a83146d 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1183,14 +1183,14 @@ namespace OpenSim } if (cmdparams.Length > 4) { - loadOffset.X = (float) Convert.ToDecimal(cmdparams[4]); + loadOffset.X = (float)Convert.ToDecimal(cmdparams[4], Culture.NumberFormatInfo); if (cmdparams.Length > 5) { - loadOffset.Y = (float) Convert.ToDecimal(cmdparams[5]); + loadOffset.Y = (float)Convert.ToDecimal(cmdparams[5], Culture.NumberFormatInfo); } if (cmdparams.Length > 6) { - loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); + loadOffset.Z = (float)Convert.ToDecimal(cmdparams[6], Culture.NumberFormatInfo); } MainConsole.Instance.Output(String.Format("loadOffsets = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e38232ca4a..e39323f549 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8307,8 +8307,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), - Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), - (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), + Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)), + (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); } @@ -8356,8 +8356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (splitField.Length == 3) { Int16 corner = Convert.ToInt16(splitField[0]); - float lowValue = (float)Convert.ToDecimal(splitField[1]); - float highValue = (float)Convert.ToDecimal(splitField[2]); + float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo); + float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo); OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); } @@ -8380,19 +8380,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float WaterHeight = (float)Convert.ToDecimal(tmp); + float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); + float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); + float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); - float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); + float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo); bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); - float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); + float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo); OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); @@ -13924,8 +13924,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), - Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), - (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), + Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)), + (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); } @@ -13973,8 +13973,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (splitField.Length == 3) { Int16 corner = Convert.ToInt16(splitField[0]); - float lowValue = (float)Convert.ToDecimal(splitField[1]); - float highValue = (float)Convert.ToDecimal(splitField[2]); + float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo); + float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo); OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); } @@ -13997,19 +13997,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float WaterHeight = (float)Convert.ToDecimal(tmp); + float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); + float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); + float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); - float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); + float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo); bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); - float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); + float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo); OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs index 776d5d14ce..cb1766a22c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs @@ -673,13 +673,13 @@ namespace OpenSim.Region.Communications.OGS1 else userData.HomeRegionID = UUID.Zero; userData.HomeLocation = - new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), - (float)Convert.ToDecimal((string)data["home_coordinates_y"]), - (float)Convert.ToDecimal((string)data["home_coordinates_z"])); + new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_coordinates_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_coordinates_z"], Culture.NumberFormatInfo)); userData.HomeLookAt = - new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]), - (float)Convert.ToDecimal((string)data["home_look_y"]), - (float)Convert.ToDecimal((string)data["home_look_z"])); + new Vector3((float)Convert.ToDecimal((string)data["home_look_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_look_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_look_z"], Culture.NumberFormatInfo)); if (data.Contains("user_flags")) userData.UserFlags = Convert.ToInt32((string)data["user_flags"]); if (data.Contains("god_level")) diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs index 9fe669af1f..4004135dbe 100644 --- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs +++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); break; case "Double": - m_args[i].ArgumentValue = Double.Parse(arg.ToString()); + m_args[i].ArgumentValue = Double.Parse(arg.ToString(), OpenSim.Framework.Culture.NumberFormatInfo); break; case "Boolean": m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 695cced293..03da2690c4 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -974,8 +974,8 @@ namespace OpenSim.Region.CoreModules.World.Estate if (y == -1 || m_scene.RegionInfo.RegionLocY == y) { int corner = int.Parse(num); - float lowValue = float.Parse(min); - float highValue = float.Parse(max); + float lowValue = float.Parse(min, Culture.NumberFormatInfo); + float highValue = float.Parse(max, Culture.NumberFormatInfo); m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index e3fbb6ee09..c8e6e4b979 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -104,9 +104,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator this.m_name = field[1].Trim(); this.m_frozen = (copsedef[0] == 'F'); this.m_tree_quantity = int.Parse(field[2]); - this.m_treeline_high = float.Parse(field[3]); - this.m_treeline_low = float.Parse(field[4]); - this.m_range = double.Parse(field[5]); + this.m_treeline_high = float.Parse(field[3], Culture.NumberFormatInfo); + this.m_treeline_low = float.Parse(field[4], Culture.NumberFormatInfo); + this.m_range = double.Parse(field[5], Culture.NumberFormatInfo); this.m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]); this.m_seed_point = Vector3.Parse(field[7]); this.m_initial_scale = Vector3.Parse(field[8]); diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs index bf3d335b34..bcdc7bf5dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs @@ -389,7 +389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance break; case "MinEventDelay": double minEventDelay = 0.0; - double.TryParse(part.InnerText, out minEventDelay); + double.TryParse(part.InnerText, NumberStyles.Float, Culture.NumberFormatInfo, out minEventDelay); instance.MinEventDelay = minEventDelay; break; } diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index faf9c4041a..e87b1f4d90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -72,9 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared return; } bool res; - res = Double.TryParse(tmps[0], out x); - res = res & Double.TryParse(tmps[1], out y); - res = res & Double.TryParse(tmps[2], out z); + res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x); + res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y); + res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z); } #endregion @@ -309,10 +309,10 @@ namespace OpenSim.Region.ScriptEngine.Shared return; } bool res; - res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.FormatProvider, out x); - res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.FormatProvider, out y); - res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.FormatProvider, out z); - res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.FormatProvider, out s); + res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x); + res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y); + res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z); + res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.NumberFormatInfo, out s); if (x == 0 && y == 0 && z == 0 && s == 0) s = 1; } @@ -1015,7 +1015,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { if (entry < minimum) minimum = entry; } @@ -1029,7 +1029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { if (entry > maximum) maximum = entry; } @@ -1048,7 +1048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { count++; } @@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < src.Data.Length - 1; i++) { - if (double.TryParse(src.Data[i].ToString(), out entry)) + if (double.TryParse(src.Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { ret.Add(entry); } @@ -1076,7 +1076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { sum = sum + entry; } @@ -1090,7 +1090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { sum = sum + Math.Pow(entry, 2); } @@ -1213,11 +1213,11 @@ namespace OpenSim.Region.ScriptEngine.Shared { double a; double b; - if (!double.TryParse(x.ToString(), out a)) + if (!double.TryParse(x.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out a)) { a = 0.0; } - if (!double.TryParse(y.ToString(), out b)) + if (!double.TryParse(y.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out b)) { b = 0.0; } @@ -1857,7 +1857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared else if (v.EndsWith(".")) v = v + "0"; - this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.FormatProvider); + this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.NumberFormatInfo); } #endregion diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index 115ac29a2d..7cc0dfacef 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -132,9 +132,9 @@ namespace OpenSim.Server.Handlers.Grid userData.SurName = (string)requestData["lastname"]; userData.ID = new UUID((string)requestData["agent_id"]); UUID sessionID = new UUID((string)requestData["session_id"]); - userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), - (float)Convert.ToDecimal((string)requestData["startpos_y"]), - (float)Convert.ToDecimal((string)requestData["startpos_z"])); + userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_z"], Culture.NumberFormatInfo)); userData.UserServerURI = (string)requestData["userserver_id"]; userData.UserAssetURI = (string)requestData["assetserver_id"];