private void CreatePngSave() { if (File.Exists(pngsave_file)) { pngsave = PngSave.Load(pngsave_file); pngsave.UpdateID(); } else { pngsave = new PngSave(); } pngSaveItemBindingSource.DataSource = pngsave.items; int position = 0; foreach (PngSaveItem item in pngsave.items) { pngSaveItemBindingSource.Position = position; viewer.LoadAnyFile(Path.Combine(save_path, item.File), true); Animate(item); position++; } if (pngSaveItemBindingSource.Count == 0) { CreatePngSaveItem("system.tdcgsav.png"); } pngSaveItemBindingSource.Position = 0; }
public static PngSave Load(string source_file) { XmlReader reader = XmlReader.Create(source_file); XmlSerializer serializer = new XmlSerializer(typeof(PngSave)); PngSave program = serializer.Deserialize(reader) as PngSave; reader.Close(); return(program); }