Beispiel #1
0
 /// <summary>
 /// Gets player data.
 /// </summary>
 public static PlayerData GetPlayerData(LeagueEntry entry)
 {
     string filename = GetPlayerFilename(entry);
     if (!File.Exists(filename))
     {
         PlayerData data = new PlayerData(entry.PlayerOrTeamId);
         SetPlayerData(entry, data);
         return data;
     }
     else
     {
         string json = File.ReadAllText(filename);
         PlayerData data = JsonConvert.DeserializeObject<PlayerData>(json);
         return data;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Stores player data.
 /// </summary>
 /// <param name="entry"></param>
 /// <param name="playerData"></param>
 public static void SetPlayerData(LeagueEntry entry, PlayerData playerData)
 {
     string filename = GetPlayerFilename(entry);
     string json = JsonConvert.SerializeObject(playerData, Formatting.Indented);
     File.WriteAllText(filename, json);
 }