Beispiel #1
0
 static void InformationViewAboutShips(ASpaceship ship, double distance)
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.Write(" " + ship.Name.PadRight(15, ' '));
     Console.ForegroundColor = ConsoleColor.Blue;
     Console.Write("\t" + ship.GetType().Name);
     Console.ForegroundColor = ConsoleColor.DarkYellow;
     Console.Write("\t\t" + distance.ToString().PadRight(20, ' '));
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("\t\t" + ship.CurrentCargo);
     Console.ForegroundColor = ConsoleColor.White;
 }
Beispiel #2
0
        static void FillingLists(List <Planet> planets, List <ASpaceship> ships)
        {
            var data      = File.ReadAllLines("data.txt");
            var shipsRead = false;

            foreach (var line in data)
            {
                if (string.IsNullOrEmpty(line))
                {
                    shipsRead = true;

                    continue;
                }

                if (shipsRead)
                {
                    planets.Add(Planet.Create(line));
                }
                else
                {
                    ships.Add(ASpaceship.Create(line));
                }
            }
        }