コード例 #1
0
        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);
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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);
        }