CSEvilTestor.Form1.Build C# (CSharp) Method

Build() public method

public Build ( string path, bool useTry ) : void
path string
useTry bool
return void
        public void Build(string path, bool useTry)
        {
            //if (builded) return;


            string[] allfile = System.IO.Directory.GetFiles(path, "*.cs", System.IO.SearchOption.AllDirectories);
            int succ = 0;
            Dictionary<string, IList<CSLE.Token>> project = new Dictionary<string, IList<CSLE.Token>>();
            foreach (var file in allfile)
            {
                IList<CSLE.Token> tokens = null;
                if (useTry)
                {

                    try
                    {
                        tokens = env.ParserToken(System.IO.File.ReadAllText(file));

                    }
                    catch (Exception err)
                    {
                        this.Log_Error("ErrInFile:" + file);
                        MessageBox.Show(err.ToString());
                        continue;
                    }
                }
                else
                {
                    tokens = env.ParserToken(System.IO.File.ReadAllText(file));
                }

                project[file] = tokens;
                succ++;
            }
            Log("file parse:" + succ + "/" + allfile.Length);
            if (succ == allfile.Length)
            {
                if (useTry)
                {
                    try
                    {
                        env.Project_Compile(project, true);
                    }
                    catch (Exception err)
                    {

                        MessageBox.Show(err.ToString());
                    }
                }
                else
                {
                    env.Project_Compile(project, true);
                }
            }
            builded = true;
            Log("build OK.");
            this.Text = "builded=" + builded;
        }