public void LoadFromFile(string filename) { foreach (string line in File.ReadAllLines(filename)) { // disgusting code right here int x = int.Parse(line.Substring(3, Alg.FindNth(line, ',', 0) - 3)); int y = int.Parse(line.Substring(Alg.FindNth(line, ',', 0) + 4, Alg.FindNth(line, ',', 1) - (Alg.FindNth(line, ',', 0) + 4))); int z = int.Parse(line.Substring(Alg.FindNth(line, ',', 1) + 4, (line.Length - 1) - (Alg.FindNth(line, ',', 1) + 4))); // debug: //Console.WriteLine(": {0} {1} {2}", x, y, z); planets.Add(new Planet(x, y, z)); planetsOrigin.Add(new Planet(x, y, z)); } }