Exemple #1
0
 static CompileCmdModel ParseArgs(string[] args)
 {
     if (args.Length == 1)
     {
         CompileCmdModel model = new CompileCmdModel();
         model.SrcFile          = args[0];
         model.IsCompileProject = model.SrcFile.ToLower().EndsWith(Const.FileExt);
         model.IsRun            = true;
         model.IsShowError      = true;
         model.IsReadKey        = true;
         return(model);
     }
     else if (args.Length == 5)
     {
         CompileCmdModel model = new CompileCmdModel();
         model.SrcFile          = args[0];
         model.IsCompileProject = (args[1] == "1" || args[1].ToLower() == "true");
         model.IsRun            = (args[2] == "1" || args[1].ToLower() == "true");
         model.IsShowError      = (args[3] == "1" || args[1].ToLower() == "true");
         model.IsReadKey        = (args[4] == "1" || args[1].ToLower() == "true");
         return(model);
     }
     else
     {
         return(null);
     }
 }
Exemple #2
0
        static ProjectCompileResult Compile(CompileCmdModel model)
        {
            ProjectCompileResult result = null;

            if (model.IsCompileProject)
            {
                result = CompileFile(model.SrcFile);
            }
            else
            {
                result = CompileProject(model.SrcFile);
            }
            if (model.IsShowError)
            {
                if (result.HasError())
                {
                    ShowErrors(result);
                }
            }
            if (model.IsRun)
            {
                if (result.HasError() == false)
                {
                    Run(result);
                }
            }
            return(result);
        }
Exemple #3
0
        static ProjectCompileResult Compile(CompileCmdModel model)
        {
            CompileMessageCollection MessageCollection = new CompileMessageCollection();

            ProjectCompileResult result = null;

            if (model.IsCompileProject)
            {
                result = CompileFile(model.SrcFile, MessageCollection);
            }
            else
            {
                result = CompileProject(model.SrcFile, MessageCollection);
            }
            if (model.IsShowError)
            {
                if (MessageCollection.HasError())
                {
                    ShowErrors(result);
                }
            }
            if (model.IsRun)
            {
                if (MessageCollection.HasError() == false)
                {
                    Run(result);
                }
            }
            return(result);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            CompileCmdModel cmdm = ParseArgs(args);

            if (cmdm == null)
            {
                Console.WriteLine("命令行参数不正确");
                return;
            }
            Compile(cmdm);
            if (cmdm.IsReadKey)
            {
                Console.ReadKey();
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                //args = new string[] { "Sample/test.zyy" };
                //args = new string[] { "Sample/你好.zyy" };
                //args = new string[] { "Sample/测试重复.zyy" };
                //args = new string[] { "Sample/测试矩形构造函数.zyy" };
                //args = new string[] { "Sample/测试强制转换.zyy" };
                //args = new string[] { "Sample/测试属性默认值.zyy" };
                //args = new string[] { "Sample/测试Lambda1.zyy" };
                //args = new string[] { "Sample/测试打印乘法.zyy" };
                //args = new string[] { "Sample/测试过程A.zyy" };
                //args = new string[] { "Sample/测试列表每一个.zyy" };

                //args = new string[] { "Sample/ZExcel开发包测试/test1.zyy" };
                //args = new string[] { "Sample/ZExcel开发包测试/test2.zyy" };

                //args = new string[] { "Sample/Z标准包测试/操作系统/测试定时器.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试剪贴板.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试进程.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试进程窗口.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试快捷方式.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试设置桌面背景图.zyy" };
                //args = new string[] { "Sample/Z标准包测试/操作系统/测试注册表操作.zyy" };

                //args = new string[] { "Sample/Z标准包测试/绘图/测试字体.zyy" };
                //args = new string[] { "Sample/Z标准包测试/设备/测试驱动器.zyy" };
                //args = new string[] { "Sample/Z标准包测试/文件系统/测试文件创建.zyy" };
                //args = new string[] { "Sample/Z标准包测试/桌面控件/测试窗体.zyy" };

                //args = new string[] { "Sample/小飞机游戏/小飞机游戏.zxm" };
                args = new string[] { "Sample/Z测试包/测试学生.zyy" };
            }

            CompileCmdModel cmdm = ParseArgs(args);

            if (cmdm == null)
            {
                Console.WriteLine("命令行参数不正确");
                return;
            }
            Compile(cmdm);
            if (cmdm.IsReadKey)
            {
                Console.ReadKey();
            }
        }