Esempio n. 1
0
        public static PokemonTeam From0791(string path)
        {
            PokemonData[] pokemons;
            using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                pokemons = From0791(fs).ToArray();
                fs.Close();
            }
            var team = new PokemonTeam(pokemons);

            team.Name = Path.GetFileNameWithoutExtension(path);
            return(team);
        }
Esempio n. 2
0
        public static void WriteToFile(string path, PokemonTeam pt)
        {
            var team = new Team();

            team.Pokemons = pt.Pokemons.Select(ToPokemon).ToArray();
            try
            {
                using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    var xs = new XmlSerializer(typeof(Team));
                    xs.Serialize(fs, team);
                    fs.Close();
                }
            }
            catch { }
        }