def main():
    allTsFile = et.getFileName(tsFile, ["ts"], [])
    allExmlFile = et.getFileName(exmlFile, ["exml"], [])
    tsIDIdx = 1231
    xmlIDIdx = 729
    xml_t = {}
    for xml in allExmlFile:
        line = ""
        with open(xml, 'r') as f:
            line = f.read()
            #line = line.replace(EXMLTRANSLATESTR, "xmlList_")
            #用两点 拆分 如果有中文 / 如果 有 19... 说明有问题 打印出来 没有直接替换
            dd = line.split('"')
            for i in range(len(dd)):
                if i % 2 != 0:
                    s = dd[i]
                    if et.isIncludeChinese(s):
                        if s.find(EXMLTRANSLATESTR) > -1:
                            print("文件有问题 = >" + xml, "s = >" + s)
                        else:
                            k = getTableKey(xml_t, s)
                            # 是否已经换过的值
                            if k:
                                _k = k.replace("_", "")
                            else:
                                xml_t["_" + str(xmlIDIdx)] = s
                                _k = xmlIDIdx
                                xmlIDIdx = xmlIDIdx + 1
                            print("xmlID = > ", _k, "replace Str = > ", s,
                                  "file = >" + xml)
                            line = line.replace(
                                s, str(EXMLTRANSLATESTR + str(_k)))
            # strList = et.getChineseStr(line)
            # if len(strList) > 0:
            #     for s in strList:
            #         k = getTableKey(xml_t, s)
            #         # 是否已经换过的值
            #         _k = 0
            #         if k:
            #             _k = k.replace("_","")
            #         else:
            #             xml_t["_"+str(xmlIDIdx) ] = s
            #             _k = xmlIDIdx
            #             xmlIDIdx = xmlIDIdx+1
            #         print("xmlID = > ", _k, "replace Str = > ", s)
            #         line = line.replace(s, str(EXMLTRANSLATESTR + str(_k) ))
        with open(xml, 'w') as f:
            f.write(line)
예제 #2
0
# -*- coding: utf-8 -*-
# @Time    : 2019/2/20 下午8:20

import pymysql
from collections import OrderedDict
import os
import fileinput
import re
import xlrd
import xlwt

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et

allchilesexlsFile = et.getFileName(
    '/Users/admin/Documents/ljworkspace/local/egret/design/stone_age/RussianStone/peizhi',
    ["xls", "xlsx"], [])
for f in allchilesexlsFile:
    if not os.path.isfile(f.replace("xlsx", "xls")):
        et.copyfile(f, f.replace("xlsx", "xls"))

    fp, fn = os.path.split(f)
    ft = fn.split(".")[1]
    if ft == 'xlsx':
        os.remove(f)
예제 #3
0
# -*- coding: utf-8 -*-
# @Time    : 2019/1/23 上午11:49

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et
import easyGameTool.projectConfig as cf
import os
import json
import pymysql
import shutil

resourceFile = cf.MACMINI_EGRET_STONE_PRO + "/resource"
allExmlFile = et.getFileName(resourceFile, ["exml"])


def getTableFormMysql(host, port, user, passwd, database, sqlStr):
    db = pymysql.connect(host=host,
                         port=port,
                         user=user,
                         passwd=passwd,
                         db=database)
    cursor = db.cursor()
    sql = sqlStr
    try:
        # 执行SQL语句
        cursor.execute(sql)
        # 获取所有记录列表
        results = cursor.fetchall()
        obj = []
        for row in results:
            itme = {}
            itme["Id"] = str(row[0])
예제 #4
0
    with open(filelow, 'r') as enf:
        cont = enf.read()
    with open(fileMore, 'r') as f:
        li = f.readlines()
        for l in li:
            if l.find("->") > -1:
                if cont.find(l) == -1:
                    print("错误文件 ==>   " + fileMore)
                    print(l)


if __name__ == '__main__':
    # cont = ''
    # with open(enFile, 'r') as enf:
    #     cont = enf.read()
    # with open(chFile, 'r') as f:
    #     li = f.readlines()
    #     for l in li:
    #         if l.find("EasyCommon") > -1:
    #             if cont.find(l) == -1:
    #                 print(l)

    print("done")

    print("其他文件")

    allcncoffee = et.getFileName(chFile, ['coffee'], [])
    allEnCoffee = et.getFileName(enFile, ['coffee'], [])

    for f in allcncoffee:
        printDiffFunc(f, f.replace(chFile, enFile))
예제 #5
0
# -*- coding: utf-8 -*-
# @Time    : 2019/2/28 下午4:46

# TODO 期望获取文件中的 中文  打到提取中文 并且替换中文 到新的 id 新的id  会insert 到 数据库里面
chFile = '/Users/admin/Documents/ljworkspace/local/cocos/project/Pikachu/app/static/coffee'  # /commons/EasyCommon.coffee
enFile = '/Users/admin/Documents/ljworkspace/local/cocos/project/pikachu_englishGit/pikachu_english/app/static/coffee'  # /commons/EasyCommon.coffee

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et
import os
import copy

allCoffee = et.getFileName(enFile, ["coffee"], [])

ex = ["log"]  # '{0}' WHERE Id={1}
allCoffeeData = None
allCoffeeData = et.processSql(
    "SELECT Id,Chinese from coffeeTranslate WHERE Id IS NOT NULL and Id != 0")

insterSql = "INSERT INTO coffeeTranslate (Id,Chinese, FilePth) VALUES ('{0}','{1}','{2}')"

insertCount = 0

needInsert = []


def getIdFormData(allData, chStr):
    for row in allData:
        if row[1] == chStr:
            print("id == > " + str(row[0]) + "  str = > " + row[1])
            return row[0]
예제 #6
0
    resObj = {}
    resObj["pkgID"] = tree._root.attrib["id"]
    resList = []
    nodes = xmlTool.find_nodes(tree, "resources/")
    for node in nodes:
        if node.tag == 'image':
            if not node.attrib:
                continue
            if 'exported' in node.attrib:
                if node.attrib['exported'] == 'true':
                    resList.append(node.attrib)
    resObj["imgList"] = resList
    resObj['localFile'] = pkgXml
    return resObj


if __name__ == '__main__':
    localPkg = {}
    assestFile = fairyGuiProFile + 'assets/'
    allPackageFile = Et.getFileName(assestFile, ['xml'], [])
    allpkgxml = list(filter(isPackAgeXml, allPackageFile))
    # 把所有的packagexml 解析一遍 看 引用 对不对
    for i in allpkgxml:
        pkgName = getPackAgeNameByPath(i)
        if pkgName not in localPkg:
            localPkg[pkgName] = []
            localPkg[pkgName] = getPkgImgID(i)
    # 每个 组件 单独处理一下 查看是否有 id 引用错误的
    for fi in allPackageFile:
        checkErrorID(fi, localPkg)
예제 #7
0
# -*- coding: utf-8 -*-
# @Time    : 2018/12/19 下午6:01

# 冬季皮肤替换
import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et
import os

ch = "/Users/admin/Documents/ljworkspace/local/cocos/project/Pikachu/tools/pikachuCCB/ccb"

en = "/Users/admin/Documents/ljworkspace/local/cocos/project/pikachu_englishGit/pikachu_english/tools/pikachuCCB/ccb"

ccbname = "FormChooseLevelPart"
#
#

if __name__ == '__main__':

    allImgFile = et.getFileName(ch, ["ccb"])

    for f in allImgFile:
        fp, fn = os.path.split(f)
        if fn == ccbname + ".ccb":
            et.copyfile(f, en + "/" + fn)

    pass

#ccbList_352
예제 #8
0
# -*- coding: utf-8 -*-
# @Time    : 2018/10/17 下午2:58
'''  发布 ccb 的   '''
import os

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et

alsh = et.getFileName(
    '/Users/admin/Documents/ljworkspace/local/cocos/project/pikachu_vietnam/pikachu_english/tools/pikachuFontAndPlist/bin',
    ["sh"], [])
for i in alsh:
    os.system("sh " + i)
예제 #9
0
# -*- coding: utf-8 -*-
# @Time    : 2019/2/16 下午4:17

#把 所有的图片  放一块 找没翻译的...  c

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et
import easyGameTool.projectConfig as cf
import os

if __name__ == '__main__':
    allTsFile = et.getFileName(
        "/Users/admin/Documents/ljworkspace/local/egret/ProStoneAge/ProStoneAge/tools/sheets",
        ["png", "jpg"], [])
    allTsFile = et.getFileName(
        "/Users/admin/Documents/ljworkspace/local/egret/ProStoneAge/ProStoneAge/StoneAppPro/resource/images",
        ["png", "jpg"], allTsFile)
    for f in allTsFile:
        fp, fn = os.path.split(f)
        et.copyfile(f, "/Users/admin/Desktop/ffushiqitupian/" + fn)
    pass
예제 #10
0
def checkIsHasBtnCb(fileName, btnName):
    if fileName.find("Mediator") > -1 or fileName.find(
            "Meditor") > -1:  # meditor  btnexit1
        if btnName.find('btnExit') == 0 or btnName.find('btnClose') == 0:
            return True
    with open(fileName, 'r') as f:
        line = f.readlines()
        for i in range(0, len(line)):
            l = line[i]
            if l.find(btnName + ".setCall") > -1:
                return True
    return False


if __name__ == '__main__':
    allExmlFile = et.getFileName(pro, ["exml"], [])
    allTsFile = et.getFileName(ts, ["ts"], [])
    allXlsCount = len(allExmlFile)
    idx = 0

    for exml in allExmlFile:
        # if exml.find("NodeActivityShenShou") > -1:
        #     print("ssss")
        idx = idx + 1
        btnID = fundAllBtnExit(exml)

        # print(exml + "不存在 btnid ") 不存在的 不管
        print("执行了==>>" + str(idx / allXlsCount))
        if btnID:
            exmlFp, exmlFn = os.path.split(exml)
            # 先通过 xml z找到 ts
예제 #11
0
outFile = ''

imgList = [
    'UI_VIP_zishebeijing.jpg',
    'cz_zti3.png',
    'ui_zhaunsdj.png',
    'zzz_yff.png',
    "qy_204k.png",
    "ui_dshoq.png",
    "doq_diksmgz.jpg",
]

if __name__ == '__main__':

    allPsdFile = et.getFileName(CF.MACMINI_COCOS_ALLPSDPATH, ["psd"], [])
    allImgDir = {}
    for _path in imgList:
        allImgDir[_path] = 0

    for _path in allPsdFile:
        fp, fn = os.path.split(_path)
        if fn.split('.').pop() == 'psd':
            if fn.replace("psd", "png") in imgList:
                et.copyfile(_path, '/Users/admin/Desktop/psd/' + fn)
                allImgDir[fn.replace("psd", "png")] = 1
            if fn.replace("psd", "jpg") in imgList:
                et.copyfile(_path, '/Users/admin/Desktop/psd/' + fn)
                allImgDir[fn.replace("psd", "jpg")] = 1

    for _name in allImgDir:
예제 #12
0
# 所有 文件 加一个 xls 的文件夹  

'''

import pymysql
from collections import OrderedDict
import os
import fileinput
import re
import xlrd
import xlwt

import easyGameTool.foreignTools.cocosPikachuTools.ExcelTools as et

allchilesexlsFile = et.getFileName(
    '/Users/admin/Documents/ljworkspace/local/egret/design/stone_age/石器时代数值配置',
    ["xls", "xlsx"], [])
for f in allchilesexlsFile:
    if not os.path.isfile(f.replace("xlsx", "xls")):
        et.copyfile(f, f.replace("xlsx", "xls"))

# rootDataDir = '/Users/songbin/sanguo/aiweiyou_pokmon/EnglishResources/资源表0512'
# rootDataDir = '/Users/songbin/sanguo/aiweiyou_pokmon/RussionResources/资源表0512'
# rootDataDir = '/Users/songbin/sanguo/aiweiyou_pokmon/FrenchResources/资源表0512'
rootDataDirList = {
    2:
    "/Users/admin/Documents/ljworkspace/local/egret/design/stone_age/石器时代数值配置",
    3:
    '/Users/admin/Documents/ljworkspace/local/egret/design/stone_age/石器时代数值配置',
    4:
    '/Users/admin/Documents/ljworkspace/local/egret/design/stone_age/RussianStone/peizhi',