Events added for ploegen.cs (reset json files for next boot)

This commit is contained in:
Beppe
2019-08-03 21:29:23 +02:00
parent b3a4a7441a
commit 1fb0e5801b
5 changed files with 68 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ namespace Data
List<Bet> list = new List<Bet>();
try
{
using (StreamReader file = File.OpenText(@"Data/bets.json"))
using (StreamReader file = File.OpenText(@"../../Data/bets.json"))
{
JsonSerializer serializer = new JsonSerializer();
@@ -42,7 +42,7 @@ namespace Data
try
{
using (StreamReader file = File.OpenText(@"Data/games.json"))
using (StreamReader file = File.OpenText(@"../../Data/games.json"))
{
JsonSerializer serializer = new JsonSerializer();
list = (List<Game>)serializer.Deserialize(file, typeof(List<Game>));
@@ -61,7 +61,7 @@ namespace Data
List<Person> list = new List<Person>();
try {
using (StreamReader file = File.OpenText(@"Data/persons.json"))
using (StreamReader file = File.OpenText(@"../../Data/persons.json"))
{
JsonSerializer serializer = new JsonSerializer();
list = (List<Person>)serializer.Deserialize(file, typeof(List<Person>));
@@ -80,7 +80,7 @@ namespace Data
List<Ploeg> list = new List<Ploeg>();
try
{
using (StreamReader file = File.OpenText(@"Data/ploegen.json"))
using (StreamReader file = File.OpenText(@"../../Data/ploegen.json"))
{
JsonSerializer serializer = new JsonSerializer();
list = (List<Ploeg>)serializer.Deserialize(file, typeof(List<Ploeg>));
@@ -96,7 +96,7 @@ namespace Data
public void saveBets(List<Bet> b)
{
using (StreamWriter file = File.CreateText(@"Data/bets.json"))
using (StreamWriter file = File.CreateText(@"../../Data/bets.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, b);
@@ -105,7 +105,7 @@ namespace Data
public void saveGames(List<Game> g)
{
using (StreamWriter file = File.CreateText(@"Data/games.json"))
using (StreamWriter file = File.CreateText(@"../../Data/games.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, g);
@@ -114,7 +114,7 @@ namespace Data
public void savePersons(List<Person> p)
{
using (StreamWriter file = File.CreateText(@"Data/persons.json"))
using (StreamWriter file = File.CreateText(@"../../Data/persons.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, p);
@@ -123,7 +123,7 @@ namespace Data
public void savePloegen(List<Ploeg> p)
{
using (StreamWriter file = File.CreateText(@"Data/ploegen.json"))
using (StreamWriter file = File.CreateText(@"../../Data/ploegen.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, p);