private static void Parse(String path)
{
Regex pattern = new Regex(@"^([0-9]+),([^,]+),([0-9a-fA-F]{6})\s*(?:#.*)?$");
String[] lines = File.ReadAllLines(path);
foreach (String line in lines)
{
Match m = pattern.Match(line);
if (m.Groups.Count == 4)
{
byte id = byte.Parse(m.Groups[1].Value);
if (id >= 0 && id < 255)
{
biomes[id] = new BiomeType(id, m.Groups[2].Value, Convert.ToInt32(m.Groups[3].Value, 16));
}
}
#if DEBUG
else
{
if (line.Trim().Length > 0 && line[0] != '#')
throw new Exception(String.Format("Malformed line:\"{0}\"", line));
}
#endif
}
}