1
Vote

Conversions should use CultureInfo.InvariantCulture

description

Hi,

There is some problems regarding conversions.
I'm french, so my environment culture is the french one.
For coordinates, there is a problem converting some coordinate as string to a rectangle, because of this code :

Type: FotoFly.ImageRegion

Assembly: FotoFly, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null

    [XmlAttribute]
    public RectangleCoordinates RegionRectangle
    {
      get
      {
        RectangleCoordinates rectangleCoordinates = new RectangleCoordinates();
        if (string.IsNullOrEmpty(this.RectangleString))
        {
          rectangleCoordinates.Left = 0.0;
          rectangleCoordinates.Top = 0.0;
          rectangleCoordinates.Width = 0.0;
          rectangleCoordinates.Height = 0.0;
        }
        else
        {
          string[] strArray = this.RectangleString.Split(new char[1]
          {
            ','
          });
          if (strArray.Length != 4)
            throw new Exception("Invalid Rectangle Value: " + this.RectangleString);
          rectangleCoordinates.Left = Convert.ToDouble(strArray[0]);
          rectangleCoordinates.Top = Convert.ToDouble(strArray[1]);
          rectangleCoordinates.Width = Convert.ToDouble(strArray[2]);
          rectangleCoordinates.Height = Convert.ToDouble(strArray[3]);
        }
        return rectangleCoordinates;
      }
    }
The following code
Convert.ToDouble(strArray[0])
should be
Convert.ToDouble(strArray[0], CultureInfo.InvariantCulture)

comments