nishantkagrawal / gcontactsynch

Automatically exported from code.google.com/p/gcontactsynch
0 stars 0 forks source link

Bad settings store way in PropertyFileLib #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Save data ends with the '=' into property with any name, and you can't read 
this value.

Error in function ReadValues()

way to solve: replace String.Split() to String.IndexOf() and 
String.Substring() as following

private void ReadValues()
        {
            if (File.Exists(FilePath))
            {
                foreach (var row in File.ReadAllLines(FilePath))
                {
                    int splitPos = row.IndexOf('=');
                    string[] rowData = new string[] { row.Substring(0, 
splitPos), row.Substring(splitPos+1) };
                    Values[rowData[0]] = rowData[1];
                }
            }
            else
                throw new PropertyFileException(FilePath + " is invalid");
        }

Original issue reported on code.google.com by AlexeusP...@gmail.com on 31 May 2010 at 7:46