37 lines
965 B
C#
37 lines
965 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.Schedulable> agenda { get; set; } = new List<Schedulable.Schedulable>();
|
||
|
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));
|
||
|
}
|
||
|
}
|
||
|
}
|