Example #1
0
        public static void Main(String[] args)
        {
            Console.WriteLine("start");
            ExpComp.Clear();
            Scanner scanner = new Scanner("D:\\temp\\1.exp");

            ExpComp.parser = new Parser(scanner);
            ExpComp.parser.Parse();

//            foreach (DataFrame frame in ExpComp.dataFrames.Values) {
//                Console.WriteLine(frame.ToString());
//            }
            IModelBuilder modelBuilder = ModelBuilderFactory.getInstance().createBuilder(ModelBuilderFactory.KIF);

            converters.Converter converter = new converters.Converter(modelBuilder);
            IModel             model       = converter.convert(ExpComp.dataFrames.Values);
            SimpleKifFormatter formatter   = new SimpleKifFormatter();

            formatter.write(model, Console.Out);

            //           model.store(Console.Out);


/*
 *          string text = IOUtils.readText("d:\\test\\t.txt");
 *          Console.WriteLine(text);
 *          DependenciesManager dependenciesManager = new DependenciesManager("d:\\test\\t.txt");
 *          dependenciesManager.print();
 */

            Console.ReadKey();
        }
Example #2
0
        private string[] CONVERTER_TYPES = { ModelBuilderFactory.KIF, ModelBuilderFactory.ONTOLINGUA };//TODO:

        private void okButtonClick(object sender, EventArgs e)
        {
            //TODO: validate();
            string fileName = _outputPathField.Text;

            string converterType = CONVERTER_TYPES[_outputFormatBox.SelectedIndex];

//            IConverter converter = ConverterFactory.getInstance().getConverter(converterType);

            //TODO: ask rewrite if exists
            IOUtils.createOrRewriteFile(fileName);

            /*          IWriter writer = WriterFactory.createFileWriter(fileName);
             *        writer.open();*/
            StreamWriter writer = new StreamWriter(fileName);

            IModelBuilder modelBuilder = ModelBuilderFactory.getInstance().createBuilder(converterType);

            converters.Converter converter = new converters.Converter(modelBuilder);
            IModel             model       = converter.convert(ExpComp.dataFrames.Values);
            SimpleKifFormatter formatter   = new SimpleKifFormatter();

            formatter.write(model, writer);


//            ICollection<Object> convertedItems = converter.convert(getSourceModel());

//            writer.write(convertedItems);
            writer.Flush();
            writer.Close();
            Close();
            //ACTION

            DialogResult reply = MessageBox.Show("Would you like to view generated file?",
                                                 "Transformation finished", MessageBoxButtons.YesNo, MessageBoxIcon.Question);//TODO:

            if (reply == DialogResult.Yes)
            {
                Window textEditor = _environment.OpenFile(Constants.vsViewKindCode, fileName);
                textEditor.Visible = true;
                textEditor.Activate();
            }
        }