Beispiel #1
0
        static void ProcWorkSheet(string tableName, string excelFile, ExcelWorksheet sheet, string md5)
        {
            var sheetName = sheet.Name.ToLower();

            Console.WriteLine("{0}, {1}", tableName + " " + sheetName, sheet.Cells.Count());

            StringBuilder vars       = null;
            StringBuilder load_funcs = null;

            TableType tableType = TableType.Common;
            var       destPaths = new List <string>();

            if (sheetName == "client")
            {
                tableType  = TableType.Client;
                vars       = manager_vars_c;
                load_funcs = manager_load_funcs_c;
                destPaths.Add(clientCodePath);
            }
            else if (sheetName == "server")
            {
                tableType  = TableType.Server;
                vars       = manager_vars_s;
                load_funcs = manager_load_funcs_s;
                destPaths.Add(serverCodePath);
            }
            else
            {
                vars       = manager_vars;
                load_funcs = manager_load_funcs;
                destPaths.Add(clientCodePath);
                destPaths.Add(serverCodePath);
            }
            var varName = FirstCharToLower(tableName);

            vars.AppendLine("    public " + tableName + " " + varName + ";");
            load_funcs.AppendLine("        " + varName + " = LoadData<" + tableName + ">(\"Tables/" + tableName + ".bytes\");");
            load_funcs.AppendLine("        " + varName + ".Initialize();");

            if (IsNewOrUpdateTable(tableName, md5))
            {
                var tableCode = string.Empty;
                foreach (var path in destPaths)
                {
                    string destDir = path + "/Tables";
                    tableCode = CreateTableWithItemFile(tableName, excelFile, destDir, sheet);     //创建TABLE
                }
                var compileInfo = new TableCompileInfo();
                compileInfo.tableName = tableName;
                compileInfo.tablePath = excelFile;
                compileInfo.tableType = tableType;
                compileInfo.sheetName = sheetName;
                compileInfo.tableCode = tableCode;
                compileInfos.Add(compileInfo);
            }
        }
Beispiel #2
0
        static void HandleCSharpWorkSheet(string tableName, string sheetName, string excelFile, ExcelWorksheet sheet, string md5, TableType tableType, string destPath)
        {
            var varName = tableName.FirstCharToLower();

            vars.AppendLine("    	public "+ tableName + " " + varName + ";");
            load_funcs.AppendLine("        	" + varName + " = LoadData<" + tableName + ">(\"Tables/" + tableName + ".bytes\");");
            load_funcs.AppendLine("        	" + varName + ".Initialize();");

            if (IsNewOrUpdateTable(tableName, md5))
            {
                string destDir     = destPath + "/Tables";
                var    tableCode   = CreateCSharpTableWithItem(tableName, excelFile, destDir, sheet); //创建TABLE
                var    compileInfo = new TableCompileInfo();
                compileInfo.tableName = tableName;
                compileInfo.tablePath = excelFile;
                compileInfo.tableType = tableType;
                compileInfo.sheetName = sheetName;
                compileInfo.tableCode = tableCode;
                compileInfos.Add(compileInfo);
            }
        }