ios拒审4.3 python自动生成辣鸡代码

配置文件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**

#! /usr/bin/python
# -*- coding: UTF-8 -*-

# author : liqiang
# desc : 自动生成辣鸡代码

# 逻辑重理
# 此脚本功能有
# 1.生成文件(lua,c++)
# 2.混入方法(lua)
# 3.混入注释(lua,oc,c++)
# 4.修改打包配置
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 #多平台 路径分割符号是'\',在Linux上是‘/’

# 模拟生成文件目录的源目录
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']
# 生成单个c++文件内的方法数量
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,     #加注释开关   c++添加没有用   会被过滤掉
    '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

# 配置文件解释
        # "key" : "jiebabuyuxiniubuyu",
        # "add_func_num" :10,
        # "lua_in_path":"../../../../scirptdecode/main/res/client_config",
        # "lua_out_path":"../../../../scirptdecode",
        # "config_list":{
   
        #     "UnionID": 101,
        #     "ChildUnionID": 1143,
        #     "KindID": 404,
        #     "ChannelID": 0,
        #     "AppID": "80252127002"
        # },
        # "wxAppID":"wxacfcf61a237d3658",
        # "version":"2.15",
#----------------------------------------------------通用模块------------------------------------------------
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()
        # print s
        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()
# 判断文件是否存在key r
def StrIsInFile(filepath,r):
    fp =open(filepath,'r+')
    # print name
    for line in fp.readlines():
        if r in line:
            return True
    fp.close()
    return False
# 得到一个md5加密名字
def getOneName(filename):
    # 随机方法
    # num = random.randint(10, 20) 
    # random.uniform  
    # random.randint   
    # random.randrange(0, 101, 2)   
    # random.choice('abcdefg&#%^*f')  
    # random.sample('abcdefghij',3) 

    # m1 = md5.new()
    m1 = hashlib.md5()
    m1.update(context['key']+filename.split(s)[-1])   #更新一次 改变一次  filename格式为  文件名 + 方法行号 + 方法当前方法行数
    # print filename.split("/")[-1]
    text =  m1.hexdigest()
    text = text[0:7]
    # return string.join(random.sample(m1.hexdigest(),random.randint(4,10)),"")
    # print text,context['key']+filename.split(s)[-1]
    return str(text)
        # names[asciis] = chr(asciis)
# 得到字段头   为了好查找   暂时先只加一个
def getHeadName():
    return random.choice ( ['get'])
#----------------------------------------------------通用模块end------------------------------------------------



#----------------------------------------------------生成文件信息模块start------------------------------------------------
# 生成一个图形注释 适用于.h .cpp  .mm   .m   .hpp  
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.   佛祖保佑必过包'</
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值