director/Scratch.cs
Adam R. Grey c4d994f76b rework progress
todo: don't have containers, just have each line be "text" if you want
2021-10-13 09:25:03 -04:00

37 lines
961 B
C#

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<schedulable.Scheduled> agenda { get; set; } = new List<schedulable.Scheduled>();
public Dictionary<string, string> Calendars { get; set; } = new Dictionary<string, string>();
//calendar ICSs
public static Scratch LoadScratch()
{
if (File.Exists(path))
{
return JsonConvert.DeserializeObject<Scratch>(File.ReadAllText(path));
}
else
{
var toReturn = new Scratch();
toReturn.Save();
return toReturn;
}
}
public void Save()
{
File.WriteAllText(path, JsonConvert.SerializeObject(this, Formatting.Indented));
}
}
}