Пример #1
0
        private void parseFile()
        {
            string fileName = sourceFileTexBox.Text;

            if (File.Exists(fileName))
            {
                CppStructuralOutput output = new CppStructuralOutput();
                CppFileParser       parser = new CppFileParser(output, fileName);

                List <FunctionDefine> funList = output.getFunctionList();

                foreach (FunctionDefine item in funList)
                {
                    funcListBox.Items.Add(item.FunctionName);
                }

                if (!parser.Message.Equals("Successfully parsed file"))
                {
                    MessageBox.Show(parser.Message);
                }

                for (int i = 0; i < funcListBox.Items.Count; i++)
                {
                    funcListBox.SelectedIndex = i;
                }
            }
        }
Пример #2
0
        public void ParseFile(OpenFileDialog openFileDialog1)
        {
            CppStructuralOutput output = new CppStructuralOutput();
            CppFileParser       parser = new CppFileParser(output, openFileDialog1.FileName);

            //Folder Create
            string filePath = (AppDomain.CurrentDomain.BaseDirectory) + @"\obj";

            if (System.IO.Directory.Exists(filePath) == false)
            {
                System.IO.Directory.CreateDirectory(filePath);
            }

            //Gen rankun file
            string writen = AppDomain.CurrentDomain.BaseDirectory
                            + @"\obj\"
                            + System.IO.Path.GetFileNameWithoutExtension(openFileDialog1.FileName)
                            + ".rkn";

            System.IO.StreamWriter writtingfile = new System.IO.StreamWriter(writen);
            string input = "";

            foreach (string line in output.GetStrings())
            {
                writtingfile.WriteLine(line);
                input += line + "\n";
            }
            writtingfile.Close();

            RM.Initialization();
        }