Added culture independent parsing code in TEXTURES/DECORATE parsers to fix problems reading values in different languages

This commit is contained in:
codeimp 2009-04-18 08:30:15 +00:00
parent 151c5ee530
commit 1c2045e42e
3 changed files with 10 additions and 10 deletions

View file

@ -163,7 +163,7 @@ namespace CodeImp.DoomBuilder.ZDoom
else
{
// Check if numeric
if(!int.TryParse(token, out doomednum))
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out doomednum))
{
// Not numeric!
parser.ReportError("Expected numeric editor thing number or start of actor scope");
@ -276,7 +276,7 @@ namespace CodeImp.DoomBuilder.ZDoom
{
// Try parsing as integer value
int intvalue;
int.TryParse(value, out intvalue);
int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out intvalue);
// Set the property
switch(token)

View file

@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// Next is the patch width
parser.SkipWhitespace(true);
tokenstr = parser.ReadToken();
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, out offsetx))
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, NumberStyles.Integer, CultureInfo.InvariantCulture, out offsetx))
{
parser.ReportError("Expected offset in pixels");
return;
@ -112,7 +112,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// Next is the patch height
parser.SkipWhitespace(true);
tokenstr = parser.ReadToken();
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, out offsety))
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, NumberStyles.Integer, CultureInfo.InvariantCulture, out offsety))
{
parser.ReportError("Expected offset in pixels");
return;
@ -169,7 +169,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!string.IsNullOrEmpty(strvalue))
{
// Try parsing as value
if(!float.TryParse(strvalue, out value))
if(!float.TryParse(strvalue, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
{
parser.ReportError("Expected numeric value for property '" + propertyname + "'");
return false;
@ -198,7 +198,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!string.IsNullOrEmpty(strvalue))
{
// Try parsing as value
if(!int.TryParse(strvalue, out value))
if(!int.TryParse(strvalue, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
{
parser.ReportError("Expected integral value for property '" + propertyname + "'");
return false;

View file

@ -107,7 +107,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// Next is the texture width
parser.SkipWhitespace(true);
tokenstr = parser.ReadToken();
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, out width))
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, NumberStyles.Integer, CultureInfo.InvariantCulture, out width))
{
parser.ReportError("Expected width in pixels");
return;
@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// Next is the texture height
parser.SkipWhitespace(true);
tokenstr = parser.ReadToken();
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, out height))
if(string.IsNullOrEmpty(tokenstr) || !int.TryParse(tokenstr, NumberStyles.Integer, CultureInfo.InvariantCulture, out height))
{
parser.ReportError("Expected height in pixels");
return;
@ -205,7 +205,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!string.IsNullOrEmpty(strvalue))
{
// Try parsing as value
if(!float.TryParse(strvalue, out value))
if(!float.TryParse(strvalue, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
{
parser.ReportError("Expected numeric value for property '" + propertyname + "'");
return false;
@ -234,7 +234,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!string.IsNullOrEmpty(strvalue))
{
// Try parsing as value
if(!int.TryParse(strvalue, out value))
if(!int.TryParse(strvalue, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
{
parser.ReportError("Expected integral value for property '" + propertyname + "'");
return false;