配置文件config.json
[
{
"key" : "jiebabuyuxiniubuyu",
"add_func_num" :1,
"lua_in_path":"../../../..",
"lua_out_path":"../../../../scirptdecode",
"lua_get_dir_path" : "/Users/li/mypro/xfront/Resources",
"lua_born_path" : "../../../../scirptdecode/main/game",
"cplus_get_dir_path":"/Users/li/mypro/xfront/Resources",
"cplus_born_path":"../../../../XnFramework/cocos/quick-3.3/quick/lib/XnGameSrc",
"oc_in_path":"",
"oc_out_path":"",
"client_config":"../../../../scirptdecode/main/res/client_config",
"config_list":{
"UnionID": 101,
"ChildUnionID": 1143,
"KindID": 404,
"ChannelID": 0,
"AppID": "80252127002"
},
"wxAppID":"wxacfcf61a237d3658",
"version":"2.15",
"functionOpen":{
"isaddfunc":"True",
"isaddfile":"True",
"isadddesc":"True",
"isaddfile_lua":"True"
}
}
]
**python文件autoBornCode.py**
import os,sys
import random
import string
import re
import md5
import time
import json
import shutil
import subprocess
import hashlib
import time
from os.path import join, getsize
s = os.sep
cplus_get_dir_path = '/Users/li/mypro/xfront/Resources'
lua_get_dir_path = '/Users/li/mypro/xfront/Resources'
cplus_born_path = '../../../../XnFramework/cocos/quick-3.3/quick/lib/XnGameSrc'
lua_born_path = '../../../../scirptdecode/main/game'
copyfilelist = ['luaFramework','main','package/BuYu/res','package/BuYu/src']
cplusFuncConut = 1
context = {
'key' : 'xiniu',
'add_func_num' : 10,
'lua_in_path' : '../../../..',
'lua_out_path' : '../../../../scirptdecode',
'lua_get_dir_path':lua_get_dir_path,
'lua_born_path':lua_born_path,
'cplus_get_dir_path':cplus_get_dir_path,
'cplus_born_path':cplus_born_path,
'oc_in_path':'',
'oc_out_path':'./',
'isaddfunc':True,
'isaddfile':True,
'isadddesc':True,
'isaddfile_lua':True,
'wxAppID':"wxacfcf61a237d3658",
'version':'2.15',
'config_list':{
"UnionID": 101,
"ChildUnionID": 1143,
"KindID": 404,
"ChannelID": 0,
"AppID": "80252127002"
}
}
add_file_count = 0
add_function_count = 0
add_desc_count = 0
class ProgressBar:
def __init__(self, count = 0, total = 0, width = 50):
self.count = count
self.total = total
self.width = width
def move(self):
self.count += 1
return self.count
def log(self, s = ""):
sys.stdout.write(' ' * (self.width + 9) + '\r')
sys.stdout.flush()
progress = self.width * self.count / self.total
sys.stdout.write('{0:3}/{1:3}: '.format(self.count, self.total))
sys.stdout.write('#' * progress + '-' * (self.width - progress) + '\r')
if progress == self.width:
sys.stdout.write('\n')
sys.stdout.flush()
def StrIsInFile(filepath,r):
fp =open(filepath,'r+')
for line in fp.readlines():
if r in line:
return True
fp.close()
return False
def getOneName(filename):
m1 = hashlib.md5()
m1.update(context['key']+filename.split(s)[-1])
text = m1.hexdigest()
text = text[0:7]
return str(text)
def getHeadName():
return random.choice ( ['get'])
def addDescimg():
text = [
'\n/** 佛祖保佑必过包',
'\n* .,:,,, .::,,,::. 佛祖保佑必过包',
'\n* .::::,,;;, .,;;:,,....:i: 佛祖保佑必过包',
'\n* :i,.::::,;i:. ....,,:::::::::,.... .;i:,. ......;i. 佛祖保佑必过包',
'\n* :;..:::;::::i;,,:::;:,,,,,,,,,,..,.,,:::iri:. .,:irsr:,.;i. 佛祖保佑必过包',
'\n* ;;..,::::;;;;ri,,,. ..,,:;s1s1ssrr;,.;r, 佛祖保佑必过包',
'\n* :;. ,::;ii;:, . ................... .;iirri;;;,,;i, 佛祖保佑必过包',
'\n* ,i. .;ri:. ... ............................ .,,:;:,,,;i: 佛祖保佑必过包',
'\n* :s,.;r:... ....................................... .::;::s; 佛祖保佑必过包',
'\n* ,1r::. .............,,,.,,:,,........................,;iir; 佛祖保佑必过包',
'\n* ,s;........... ..::.,;:,,. ...............,;1s 佛祖保佑必过包',
'\n* :i,..,. .,:,,::,. .......... .......;1, 佛祖保佑必过包',
'\n* ir,....:rrssr;:, ,,.,::. .r5S9989398G95hr;. ....,.:s, 佛祖保佑必过包',
'\n* ;r,..,s9855513XHAG3i .,,,,,,,. ,S931,.,,.;s;s&BHHA8s.,..,..:r: 佛祖保佑必过包',
'\n* :r;..rGGh, :SAG;;G@BS:.,,,,,,,,,.r83: hHH1sXMBHHHM3..,,,,.ir. 佛祖保佑必过包',
'\n* ,si,.1GS, sBMAAX&MBMB5,,,,,,:,,.:&8 3@HXHBMBHBBH#X,.,,,,,,rr 佛祖保佑必过包',
'\n* ;1:,,SH: .A@&&B#&8H#BS,,,,,,,,,.,5XS, 3@MHABM&59M#As..,,,,:,is, 佛祖保佑必过包',
'\n* .rr,,,;9&1 hBHHBB&8AMGr,,,,,,,,,,,:h&&9s; r9&BMHBHMB9: . .,,,,;ri. 佛祖保佑必过包',
'\n* :1:....:5&XSi;r8BMBHHA9r:,......,,,,:ii19GG88899XHHH&GSr. ...,:rs. 佛祖保佑必过包',
'\n* ;s. .:sS8G8GG889hi. ....,,:;:,.:irssrriii:,. ...,,i1, 佛祖保佑必过包',
'\n* ;1, ..,....,,isssi;, .,,. ....,.i1, 佛祖保佑必过包',
'\n* ;h: i9HHBMBBHAX9: . ...,,,rs, 佛祖保佑必过包',
'\n* ,1i.. :A#MBBBBMHB##s ....,,,;si. 佛祖保佑必过包',
'\n* .r1,.. ,..;3BMBBBHBB#Bh. .. ....,,,,,i1; 佛祖保佑必过包',
'\n* :h;.. .,..;,1XBMMMMBXs,.,, .. :: ,. ....,,,,,,ss. 佛祖保佑必过包'</