public static void Initialize() { Task.Run(async() => { SavedData = await Get(); }); }
public static async Task <bool> SavePlayer(Player player) { try { if (SavedData == null) { SavedData = new SaveGameCollection { Players = new List <SavedPlayer>() } } ; SavedData.Players = SavedData.Players.Where(s => s.Name != player.Name).ToList(); SavedData.Players.Add(new SavedPlayer(player)); await Save(); return(true); } catch (Exception e) { return(false); } }