Ejemplo n.º 1
0
        public ZSingleCompiler(FileInfo zlogoFileInfo)
        {
            srcFileInfo  = zlogoFileInfo;
            projectModel = new ZCompileProjectModel();
            classModel   = new ZCompileClassModel();

            projectModel.ProjectRootDirectoryInfo = srcFileInfo.Directory;
            projectModel.BinaryFileKind           = PEFileKinds.ConsoleApplication;
            projectModel.BinarySaveDirectoryInfo  = srcFileInfo.Directory;
            projectModel.ProjectPackageName       = "ZLangSingleFile";
            projectModel.EntryClassName           = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.BinaryFileNameNoEx       = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.NeedSave = true;
            projectModel.AddRefPackage("Z语言系统");
            //projectModel.AddRefDll(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ZLogoEngine.exe")));

            classModel.SourceFileInfo = srcFileInfo;

            /*   classModel.PreSourceCode =@"
             *
             * 使用包:ZLogoEngine;
             * 简略使用:颜色,补语控制;
             *
             * 属于:绘图窗体;
             *
             * ";*/
            projectModel.AddClass(classModel);
        }
Ejemplo n.º 2
0
        public ZLogoCompiler(FileInfo zlogoFileInfo)
        {
            srcFileInfo = zlogoFileInfo;

            /*if (!srcFileInfo.EndsWith(ZLogoExt, StringComparison.OrdinalIgnoreCase))
             * {
             *  srcFileInfo +=ZLogoExt;
             * }*/
            projectModel = new ZCompileProjectModel();
            classModel   = new ZCompileClassModel();

            projectModel.ProjectRootDirectoryInfo = srcFileInfo.Directory;// AppDomain.CurrentDomain.BaseDirectory;
            projectModel.BinaryFileKind           = PEFileKinds.Dll;
            projectModel.BinarySaveDirectoryInfo  = srcFileInfo.Directory;
            projectModel.ProjectPackageName       = "ZLogoIDE";
            projectModel.EntryClassName           = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.BinaryFileNameNoEx       = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.NeedSave = false;
            projectModel.AddRefPackage("Z语言系统");
            projectModel.AddRefDll(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ZLogoEngine.exe")));

            classModel.SourceFileInfo = srcFileInfo;
            classModel.PreSourceCode  =
                @"

使用包:ZLogoEngine;
简略使用:颜色,补语控制;

属于:绘图窗体;

";
            projectModel.AddClass(classModel);
        }
Ejemplo n.º 3
0
        void createSingleFileProject(FileInfo zlogoFileInfo)
        {
            initProject();
            projectModel.EntryClassName     = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.BinaryFileNameNoEx = Path.GetFileNameWithoutExtension(srcFileInfo.FullName);
            projectModel.BinaryFileKind     = PEFileKinds.Dll;
            projectModel.ProjectPackageName = "ZDevGen";
            projectModel.ProjectFileName    = zlogoFileInfo.Name;
            var classModel = new ZCompileClassModel();

            classModel.SourceFileInfo = srcFileInfo;
            projectModel.AddClass(classModel);
        }
Ejemplo n.º 4
0
        public ProjectCompileResult Parse(ZCompileProjectModel zCompileProject /*, ProjectCompileResult result*/)
        {
            ProjectCompileResult result = new ProjectCompileResult();

            string[] lines      = File.ReadAllLines(xmFileInfo.FullName);
            var      folderPath = zCompileProject.ProjectRootDirectoryInfo.FullName;

            //ProjectContext context = new ProjectContext();
            //Messager.Clear();
            //context.Analy();

            for (int i = 0; i < lines.Length; i++)
            {
                string code = lines[i];
                if (string.IsNullOrEmpty(code))
                {
                    continue;
                }
                else if (code.StartsWith("//"))
                {
                    continue;
                }
                else if (code.StartsWith("包名称:"))
                {
                    string name = code.Substring(4);
                    zCompileProject.ProjectPackageName = name;
                }
                else if (code.StartsWith("生成类型:"))
                {
                    string lx = code.Substring(5);
                    if (lx == "开发包")
                    {
                        zCompileProject.BinaryFileKind = PEFileKinds.Dll;
                    }
                    else if (lx == "控制台程序")
                    {
                        zCompileProject.BinaryFileKind = PEFileKinds.ConsoleApplication;
                    }
                    else if (lx == "桌面程序")
                    {
                        zCompileProject.BinaryFileKind = PEFileKinds.WindowApplication;
                    }
                }
                else if (code.StartsWith("编译:"))
                {
                    string   src         = code.Substring(3);
                    string   srcPath     = Path.Combine(folderPath, src);
                    FileInfo srcFileInfo = new FileInfo(srcPath);
                    //zCompileProject.SouceFileList.Add(srcFileInfo);
                    var classModel = new ZCompileClassModel();
                    classModel.SourceFileInfo = srcFileInfo;
                    zCompileProject.AddClass(classModel);
                }
                else if (code.StartsWith("设置启动:"))
                {
                    string name = code.Substring(5);
                    zCompileProject.EntryClassName = name;
                }
                else
                {
                    //throw new CompileException("无法识别项目编译指令:" + code);
                    errorf(result, xmFileInfo.Name, i + 1, 1, "无法识别项目编译指令:'{0}'", code);
                    continue;
                }
            }
            return(result);
        }