/// <summary> /// Loads an argument in any of the known formats. /// </summary> /// <param name="filename"></param> public void loadAXLorRE3(string filename) { if (filename.ToLower().EndsWith(".axl")) { loadArg(filename); } else if (filename.ToLower().EndsWith(".re3")) { this.loadRE3Map(filename); } else if (filename.ToLower().EndsWith(".rtnl")) { Rationale rat = new Rationale(); Argument arat = rat.importFromRationale(filename); currentArg = arat; } else { return; } loadTree(); verifyTree(false); }
/// <summary> /// Open an argument file with a standard open file dialog box. /// </summary> /// <returns></returns> public ArgMapInterface openArgument() { System.Windows.Forms.OpenFileDialog openFileDialog1; ArgMapInterface ai; // if this object needs to be re-created DialogResult r; string fn; openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); openFileDialog1.Filter = "Argumentative files (*.axl)|*.axl|Reasonable files (*.re3)|*.re3" + "|Araucaria (*.aml;*.scm)|*.aml;*.scm|All Argument files (.axl;.re3;.rtnl)|*.axl;*.re3;*.rtnl"; openFileDialog1.FilterIndex = 4; try { r = openFileDialog1.ShowDialog(); } catch { r = DialogResult.Cancel; } if (r == DialogResult.OK) { fn = openFileDialog1.FileName; if (fn.ToLower().EndsWith(".axl") || fn.ToLower().EndsWith(".re3")) { ai = new ArgMapInterface(false, theTV, editArea); ai.loadAXLorRE3(fn); currentfilename = fn; return(ai); } else if (fn.ToLower().EndsWith(".aml")) // Araucaria file { Araucaria ara = new Araucaria(); ara.load(fn); CurrentArg.setArg(ara.A.findHead()); loadTree(); currentfilename = fn; return(this); } else if (fn.ToLower().EndsWith(".scm")) // Read scheme set { Araucaria ara = new Araucaria(); MessageBox.Show("Araucaria Scheme Sets are read but are not yet supported."); ara.load(fn); // TODO What to do with the scheme set } else if (fn.ToLower().EndsWith(".rtnl")) // Read scheme set { Rationale rat = new Rationale(); Argument arat = rat.importFromRationale(fn); if (arat == null) { return(null); } CurrentArg.setArg(arat.findHead()); loadTree(); currentfilename = fn; return(this); } else { MessageBox.Show(String.Format("Do not know how to open file type {0}", System.IO.Path.GetExtension(fn))); } } return(null); }