Example #1
0
    private void convertDB()
    {
        isConverting = true;

        TableConfig[] tableList = MySqlSettings.tableList;
        foreach (TableConfig tc in tableList)
        {
            string   tableName = tc.GetTableName();
            string[] items     = tc.GetItems();
            string[] cols      = tc.GetCols();
            string[] operation = tc.GetOperation();
            string[] values    = tc.GetValues();
            string[] keys      = tc.GetKeys();
            bool     isArray   = tc.IsArray();

            string JsonPath = pathRoot + MySqlSettings.OUTPUT_PATH + tableName + MySqlSettings.OUTPUT_TYPE;
            FileUtil.DeleteFileOrDirectory(JsonPath);

            DataSet ds = mySql.SelectWhere(tableName, items, cols, operation, values);
            if (ds != null)
            {
                if (isArray)
                {
                    convert2List(JsonPath, ds, keys);
                }
                else
                {
                    convert2Map(JsonPath, ds, keys);
                }
            }
        }
        isFinished   = true;
        isConverting = false;
        mySql.Close();
        mySql = null;

        AssetDatabase.Refresh();

        instance.Close();
    }