Ejemplo n.º 1
0
        private void btn_Compile_Click(object sender, EventArgs e)
        {
            RunScript runScript = new RunScript();

            if (lbl_Existed.Visible is true)
            {
                MessageBox.Show("Khởi chạy container trước khi compile ! ");
                return;
            }
            if (tbx_InsertParameter.TextLength < 1)
            {
                MessageBox.Show("Điền tham số !");
                return;
            }
            FileAccess fileAccess = new FileAccess();


            List <string> lines = new List <string>();

            foreach (var line in tbx_InsertCode.Lines)
            {
                if (line.Contains("class ") is true)
                {
                    int firstPos = line.IndexOf(" ") + 1;
                    int lastPost = line.IndexOf("{");
                    fileAccess.fileName = line.Substring(firstPos, lastPost - firstPos);
                }
                lines.Add(line);
            }

            fileAccess.Write(lines);
            fileAccess.CreateShScriptFile();
            string str = runScript.Compile(tbx_InsertParameter.Text);

            MessageBox.Show(str);
        }