public Configuration(string filename) { if (File.Exists(filename)) { Config = JsonConvert.DeserializeObject <ClientCredentialsGrant>(File.ReadAllText(filename)); } else { Config = TUICfg.ClientCfg(); File.WriteAllText(filename, JsonConvert.SerializeObject(Config, Formatting.Indented)); } }
public PlayerConfig(string filename) { if (File.Exists(filename)) { Player = JsonConvert.DeserializeObject <PlayerInfo>(File.ReadAllText(filename)); } else { Player = TUICfg.PlayerCfg(); File.WriteAllText(filename, JsonConvert.SerializeObject(Player, Formatting.Indented)); } }