Esempio n. 1
0
        public ProjectCompileResult Compile(ZProjectModel zCompileProjectModel)
        {
            this.projectModel = zCompileProjectModel;
            //result = new ProjectCompileResult();
            projectContext = new ContextProject(projectModel);
            //projectContext.ProjectModel = projectModel;
            LoadProjectRef();
            CompileUtil.GenerateBinary(projectContext);

            ParseFiles();

            CompileEnum();
            AnalyImportUse();
            AnalyDimAndClassName();
            EmitDimAndClassName();

            CompileFileDim();
            CompileClass();

            //result.CompiledTypes.AddRange(this.projectContext.GeneratedTypeManager.EmitedZDescTypeDictionary.Values);
            SetEntry();
            if (zCompileProjectModel.NeedSave)
            {
                SaveBinary();
            }

            return(projectContext.CompileResult);
        }
Esempio n. 2
0
 private void SaveBinary()
 {
     if (!this.projectContext.CompileResult.HasError())
     {
         string binFileName = projectContext.GetBinaryNameEx();
         projectContext.EmitContext.AssemblyBuilder.Save(binFileName);
         CompileUtil.MoveBinary(projectContext);
         CompileUtil.DeletePDB(projectContext);
         string exBinFileName  = projectContext.GetBinaryNameEx();
         string toFileFullPath = Path.Combine(projectContext.ProjectModel.BinarySaveDirectoryInfo.FullName, exBinFileName);
     }
 }
Esempio n. 3
0
 private void SaveBinary()
 {
     if (!this.MessageCollection.HasError())
     {
         string binFileName = ProjectContext.ProjectModel.GetBinaryNameEx();
         ProjectContext.EmitContext.AssemblyBuilder.Save(binFileName);
         CompileUtil.MoveBinary(ProjectContext);
         CompileUtil.DeletePDB(ProjectContext);
         string toFileFullPath = Path.Combine(ProjectContext.ProjectModel.BinarySaveDirectoryInfo.FullName, binFileName);
         this.result.BinaryFilePath = toFileFullPath;
     }
 }
Esempio n. 4
0
        public static void MoveBinary(ContextProject projectContext)
        {
            string exBinFileName    = projectContext.GetBinaryNameEx();
            string fromFileFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exBinFileName);
            string toFileFullPath   = Path.Combine(projectContext.ProjectModel.BinarySaveDirectoryInfo.FullName, exBinFileName);

            if (File.Exists(toFileFullPath))
            {
                File.Delete(toFileFullPath);
            }
            if (File.Exists(fromFileFullPath) && fromFileFullPath != toFileFullPath)
            {
                File.Move(fromFileFullPath, toFileFullPath);
                File.Delete(fromFileFullPath);
            }
            CompileUtil.DeletePDB(projectContext);
        }
Esempio n. 5
0
        public ProjectCompileResult Compile()
        {
            if (this.projectModel == null || ProjectContext.ProjectModel == null)
            {
                throw new CCException();
            }

            LoadProjectRef();
            CompileUtil.GenerateBinary(ProjectContext);
            CompileFiles();

            SetEntry();
            if (this.projectModel.NeedSave)
            {
                SaveBinary();
            }

            result.CompiledTypes.Clear();
            result.CompiledTypes.Add(this.ProjectContext.CompiledTypes);

            return(result);
        }