public void TallennaTiedostoon(string tiedosto, string tyyppi) { try { if (tyyppi == ".xml") { BLSerialisoija.TallennaXml(Pelaajat, tiedosto); } else if (tyyppi == ".txt") { BLSerialisoija.TallennaTxt(Pelaajat, tiedosto); } else { throw new Exception("Tuntematon tiedostomuoto"); } } catch (Exception ex) { throw ex; } }
public void LataaTiedostosta(string tiedosto, string tyyppi) { try { if (tyyppi == ".xml") { List <BLPelaaja> luetut = BLSerialisoija.LataaXml(tiedosto); Pelaajat = luetut; } else if (tyyppi == ".txt") { List <BLPelaaja> luetut = BLSerialisoija.LataaTxt(tiedosto); Pelaajat = luetut; } else { throw new Exception("Tuntematon tiedostomuoto"); } } catch (Exception ex) { throw ex; } }