public static OutlineDocumentViewModel Read(string path) { using (StreamReader file = File.OpenText(path)) { JsonSerializer serializer = new JsonSerializer(); OutlineDocumentViewModel doc = (OutlineDocumentViewModel)serializer.Deserialize(file, typeof(OutlineDocumentViewModel)); doc.RefreshParentalReferences(); doc.SavePath(path); return(doc); } }
public static void Write(OutlineDocumentViewModel outline, string path) { File.WriteAllText(path, JsonConvert.SerializeObject(outline)); outline.SavePath(path); }