using System; using System.Collections.Generic; using System.IO; using Newtonsoft.Json; using Schedulable; namespace director { public class Scratch { private const string path = "scratch.json"; public List agenda { get; set; } = new List(); public Dictionary Calendars { get; set; } = new Dictionary(); //calendar ICSs public static Scratch LoadScratch() { if (File.Exists(path)) { return JsonConvert.DeserializeObject(File.ReadAllText(path)); } else { var toReturn = new Scratch(); toReturn.Save(); return toReturn; } } public void Save() { File.WriteAllText(path, JsonConvert.SerializeObject(this, Formatting.Indented)); } } }