Exemplo n.º 1
0
    public static bool ReGenLuaTable(string exlPath)
    {
        Excel exl = GlobalCfg.Instance.GetParsedExcel(exlPath, true);

        if (exl == null)
        {
            return(false);
        }
        string md5 = ExcelParserFileHelper.GetMD5HashFromFile(exlPath);

        if (md5 == null)
        {
            return(false);
        }
        string md5str = "--md5:" + md5 + "\n";

        #region 生成服务器配置
        string serverContents = md5str + exl.ToString(true);
        FileUtil.WriteTextFile(serverContents, GlobalCfg.GetLocalServerLuaPath(exl.tableName));
        #endregion
        #region 生成客户端配置
        if (!exl.isServerTable)
        {
            string clientContents = md5str + exl.ToString(false);
            FileUtil.WriteTextFile(clientContents, GlobalCfg.GetLocalClientLuaPath(exlPath));
        }
        #endregion
        return(true);
    }
        public String GetCatalog(String catalogFromAnnotation, Table table)
        {
            // Get the catalog from the annotation ...
            String catalog = catalogFromAnnotation;
            // ... if empty, try using the default ...
            if (string.IsNullOrEmpty(catalog))
            {
                catalog = GlobalCfg.getDefaultCatalogName();

                // ... if still empty, use the same as the normal table.
                if (String.IsNullOrEmpty(catalog))
                {
                    catalog = table.Catalog;
                }
            }
            return catalog;
        }
        public String GetSchema(String schemaFromAnnotation, Table table)
        {
            // Get the schema from the annotation ...
            String schema = schemaFromAnnotation;
            // ... if empty, try using the default ...
            if (String.IsNullOrEmpty(schema))
            {
                schema = GlobalCfg.getDefaultSchemaName();

                // ... if still empty, use the same as the normal table.
                if (String.IsNullOrEmpty(schema))
                {
                    schema = table.Schema;
                }
            }
            return schema;
        }