public static Kartenset LoadFrom(string file) { var json = ""; using (var stream = File.OpenRead(file)) { using (var reader = new StreamReader(stream)) { json = reader.ReadToEnd(); } } Kartenset kartenset = JsonConvert.DeserializeObject <Kartenset>(json); kartenset.Check(); return(kartenset); }
// Initialisierung private void LadeKartenset() { Console.WriteLine("Lade {0}...", file.Split('\\').Last().Replace(".json", "")); kartenset = Kartenset.LoadFrom(file); Console.WriteLine("{0} geladen!", file.Split('\\').Last().Replace(".json", "")); }