public static List <Path> LoadPathsFromFile(string file) { XmlSerializer ser = new XmlSerializer(typeof(PathBulk)); PathBulk loaded = null; using (FileStream stream = new FileStream(file, FileMode.Open)) { loaded = (PathBulk)ser.Deserialize(stream); stream.Close(); } return(loaded.paths); }
public static void SavePathsToFile(string file, List <Path> paths) { XmlSerializer ser = new XmlSerializer(typeof(PathBulk)); PathBulk bulk = new PathBulk(); bulk.paths.AddRange(paths); using (FileStream stream = new FileStream(file, FileMode.Create)) { ser.Serialize(stream, bulk); stream.Flush(); stream.Close(); } }
public static List <Path> LoadPathsFromFile(string file) { XmlSerializer ser = new XmlSerializer(typeof(PathBulk)); PathBulk loaded = null; using (FileStream stream = new FileStream(file, FileMode.Open)) { loaded = (PathBulk)ser.Deserialize(stream); stream.Close(); } // Setup parenting foreach (Path p in loaded.paths) { for (int i = p.points.Count - 1; i > 0; i--) { p.points [i].parent = p.points [i - 1]; } } return(loaded.paths); }