Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            List <Hero> heroes1 = InOutUtils.ReadHeroesFromRace("Elfs3.csv");
            List <Hero> heroes2 = InOutUtils.ReadHeroesFromRace("Humans3.csv");

            InOutUtils.PrintInputToCsv("Pradiniai1.txt", heroes1);
            InOutUtils.PrintInputToCsv("Pradiniai2.txt", heroes2);


            HeroRegister.AddRace(Races.Elf, heroes1);
            HeroRegister.AddRace(Races.Human, heroes2);
            InOutUtils.PrintClassesToCsv("Klases.csv", HeroRegister.GetAllClasses());
            InOutUtils.PrintMissingClasses("Trukstami.csv", HeroRegister.MissingClasses());
            InOutUtils.PrintStrongestHero(HeroRegister.StrongestRaceHero());


            Console.ReadKey();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// prints missing classes from each race
        /// </summary>
        /// <param name="fileName">file name</param>
        /// <param name="missingClasses">missing classes</param>
        static public void PrintMissingClasses(string fileName, Dictionary <Races, List <Classes> > missingClasses)
        {
            string[] lines = new string[HeroRegister.GetNumberOfLinesToPrint(missingClasses)];
            int      index = 0;

            foreach (var missingRaceClasses in missingClasses)
            {
                lines[index] = "Race: " + missingRaceClasses.Key.ToString();
                index++;
                foreach (var @class in missingRaceClasses.Value)
                {
                    lines[index] = @class.ToString();
                    index++;
                }
                if (missingRaceClasses.Value.Count == 0)
                {
                    lines[index] = "Visi";
                }
            }

            File.WriteAllLines(fileName, lines);
        }