Пример #1
0
        /// <summary>
        /// 生成代码
        /// </summary>
        public static void GenCode(string outputPath)
        {
            var xlslFiles = Excel2SQLiteTools.GetAllConfigFiles();

            //
            if (xlslFiles.Count == 0)
            {
                EditorUtility.DisplayDialog("提示", "未发现xlsx文件,请注意不是xls", "确定");
                return;
            }

            //同名文件判断
            var fnlist = xlslFiles.Select((s) => Path.GetFileName(s).ToLower()).ToList();

            foreach (var fn in fnlist)
            {
                var rets = fnlist.FindAll((f) => f == fn);
                if (rets.Count > 1)
                {
                    EditorUtility.DisplayDialog("提示", "Sqlite表名 字段名不区分大小写,请处理重名exel! ->" + fn, "OK");

                    return;
                }
            }

            //导出excel
            foreach (var f in xlslFiles)
            {
                GenClassByExcel(outputPath, f, "Local");
                GenClassByExcel(outputPath, f, "Server");
            }

            EditorUtility.DisplayDialog("提示", "生成完成!", "确定");
            AssetDatabase.Refresh();
        }
Пример #2
0
        public static void GenJson2SQLite()
        {
            var jsonFiles = Excel2SQLiteTools.GetAllConfigFiles("*.json");

            //连接数据库
            SqliteLoder.LoadOnEditor(Application.streamingAssetsPath, Application.platform);
            {
                foreach (var f in jsonFiles)
                {
                    string content = File.ReadAllText(f);
                    JsonContent2Sqlite(f, content);
                }
            }
            SqliteLoder.Close();
            EditorUtility.ClearProgressBar();
            Debug.Log("导出Sqlite完成!");
        }