Ejemplo n.º 1
0
        private void btnCompileSelect_Click(object sender, EventArgs e)
        {
            //编译选定的表
            Console.Clear();

            var startPath = Environment.CurrentDirectory;

            Console.WriteLine("当前目录:{0}", startPath);
            var compiler = new Compiler();

            int comileCount = 0;

            foreach (var filePath in fileList)
            {
                Console.WriteLine(filePath);
                var savePath = GenTmlPath + "\\" + SimpleExcelFile.GetOutFileName(filePath) + TmlExtensions;
                //编译表时,生成代码
                TableCompileResult compileResult = compiler.Compile(filePath, savePath);
                Console.WriteLine("编译结果:{0}---->{1}", filePath, savePath);
                Console.WriteLine();
                //生成代码
                BatchCompiler batchCompiler = new BatchCompiler();
                //NOTE 替换成相对路径(保证最后只有文件名)
                string repStr = Directory.GetParent(compileResult.TabFileRelativePath).FullName + "\\";
                compileResult.TabFileRelativePath = compileResult.TabFileRelativePath.Replace(repStr, "");
                batchCompiler.GenCodeFile(compileResult, DefaultTemplate.GenSingleClassCodeTemplate, GenCodePath, NameSpace, TmlExtensions, null, true);

                if (compileResult != null)
                {
                    comileCount += 1;
                }
            }

            ShowCompileResult(comileCount);
        }
Ejemplo n.º 2
0
        }                                                    // column + Default Values

        public TableTemplateVars(TableCompileResult compileResult, string extraString)
            : base()
        {
            var tabFilePath = compileResult.TabFileRelativePath;

            Paths.Add(compileResult.TabFileRelativePath);

            ClassName = DefaultClassNameParse(tabFilePath);
            // 可自定义Class Name
            if (CustomClassNameFunc != null)
            {
                ClassName = CustomClassNameFunc(ClassName, tabFilePath);
            }

            FieldsInternal       = compileResult.FieldsInternal;
            PrimaryKey           = compileResult.PrimaryKey;
            Columns2DefaultValus = new List <Hash>();

            Extra = extraString;
        }
Ejemplo n.º 3
0
        public TableTemplateVars(TableCompileResult compileResult, string extraString)
            : base()
        {
            var tabFilePath = compileResult.TabFileRelativePath;
            Paths.Add(compileResult.TabFileRelativePath);

            ClassName = DefaultClassNameParse(tabFilePath);
            // 可自定义Class Name
            if (CustomClassNameFunc != null)
                ClassName = CustomClassNameFunc(ClassName, tabFilePath);

            FieldsInternal = compileResult.FieldsInternal;
            PrimaryKey = compileResult.PrimaryKey;
            Columns2DefaultValus = new List<Hash>();

            Extra = extraString;
        }