Ejemplo n.º 1
0
        public void SetLocations(string input)
        {
            string[] lines    = Regex.Split(input, "\r\n|\n|\r");
            int      currMoon = 0;

            char[] separatingChars = { '=', ',', '<', '>' };

            // for each line, get out the coordinates
            foreach (var line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }
                string[] words = line.Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);

                //MessageBox.Show(String.Join(" || ", words));

                moons[currMoon] = new Moon(words[1], words[3], words[5]);
                currMoon++;

                if (currMoon >= moons.Length)
                {
                    break;
                }
            }
        }