using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace Phenix.DynamicCompiler
{
    public class ExecutorBuilder
    {
        //顺序执行列表
        private List<string> listFunctionName;
        StringCollection importNameSpace;
        public ExecutorBuilder(List<string> listFunctionName, StringCollection importNameSpace)
        {
            this.listFunctionName = listFunctionName;
            this.importNameSpace = importNameSpace;
        }
        public string CodeString
        {
            get
            {
                List<string> list=new List<string>();
                StringBuilder sb = new StringBuilder();
                sb.Append("    ");
                sb.Append("public static void SequenceExecute()");
                sb.Append("    ");
                sb.AppendLine("{");
                foreach (var item in listFunctionName)
                {
                    sb.AppendLine(item);
                }
                
                sb.Append("    ");
                sb.AppendLine("}");
                list.Add(sb.ToString());
                CodeBuilder codeBuilder = new CodeBuilder(importNameSpace, "DynamicCompilerExecutor"
                    , list, "DynamicCompiler");
                return codeBuilder.CodeString;

            }
        }
    }
}
