public ArrayList read(string Path) { ArrayList temp = new ArrayList(); Directory.CreateDirectory("tmp"); String Wfolder = Directory.GetCurrentDirectory() + "\\tmp"; try { using (ZipFile zip = ZipFile.Read(Path)) { zip.ExtractAll(Wfolder, true); } AutomateReader reader = new AutomateReader(); foreach (String file in Directory.GetFiles(Wfolder)) { temp.Add(reader.read(file)); } try { Directory.Delete(Wfolder, true); } catch (Exception) { } } catch (ZipException ex) { MessageBox.Show("Fichier endomager ", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } return temp; }
private void ouvrirMI_Click(object sender, EventArgs e) { if (openAutoDialog.ShowDialog() != DialogResult.Cancel) { AutomateReader Reader = new AutomateReader(); Auto Auto = Reader.read(openAutoDialog.FileName); switch (Auto.type) { case Automata.TYPE.Dfa: AjouterDfa(Auto); break; case Automata.TYPE.Nfa: AjouterNfa(Auto); break; case Automata.TYPE.PGfa: AjouterPGfa(Auto); break; case Automata.TYPE.Gfa: AjouterGfa(Auto); break; default: break; } } }