Beispiel #1
0
        public AutomateSaver.AutomtateSaveResult save(ArrayList Automate_list, String Path)
        {
            Directory.CreateDirectory("tmp");
            String Wfolder = Directory.GetCurrentDirectory() + "\\tmp";
            AutomateSaver Saver = new AutomateSaver();
            using (ZipFile Zip = new ZipFile())
            {
                foreach (Auto Auto in Automate_list)
                {
                    if (((Automata)Auto.Automate).getType() == Automata.TYPE.Gfa)
                    {
                        ((Automata)Auto.Automate).Name = "Automate" + (Automate_list.IndexOf(Auto) % 5).ToString();
                        AutomateSaver.AutomtateSaveResult ret = Saver.Save((Automata)(Auto.Automate), Wfolder + "\\" + Auto.ToString() + ".aut");
                        if (ret == AutomateSaver.AutomtateSaveResult.ERROR)
                        {
                            MessageBox.Show("Erreur saving the worspace");
                            return AutomateSaver.AutomtateSaveResult.ERROR;
                        }
                    }
                }

                foreach (string file in Directory.GetFiles("tmp"))
                {
                    Zip.AddFile(file, ".");

                }
                Zip.Save(Path);
                try
                {
                    Directory.Delete("tmp", true);
                }
                catch (Exception)
                {

                }

            }
            return AutomateSaver.AutomtateSaveResult.NEW;
        }
Beispiel #2
0
        private void enregistrerMI_Click(object sender, EventArgs e)
        {
            if (saveAutomateDialog.ShowDialog() != DialogResult.Cancel)
            {
                AutomateSaver Saver = new AutomateSaver();
                Saver.Save((Automata)Selected.Automate, saveAutomateDialog.FileName);

            }
        }