代码拉取完成,页面将自动刷新
同步操作将从 liyonghelpme/moba协议 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#coding:utf8
import os
import sys
license = '''
/*
Author: liyonghelpme
Email: 233242872@qq.com
*/
'''
#将代码转换成UTF8格式并且增加文件头
formats = {}
def UTF8(ret, name):
if ret.find('ASCII') != -1:
os.system('iconv -f US -t UTF8 %s > %s' % (name, name+".temp"))
os.system('mv %s %s' % (name+'.temp', name))
elif ret.find('UTF-16') != -1:
os.system('iconv -f UTF-16 -t UTF8 %s > %s' % (name, name+".temp"))
os.system('mv %s %s' % (name+'.temp', name))
elif ret.find('ISO-8859') != -1:
print ret
os.system('iconv -f GBK -t UTF8 %s > %s ' % (name, name+'.temp'))
os.system('mv %s %s' % (name+'.temp', name))
elif ret.find('Perl') != -1:
print ret
os.system('iconv -f GBK -t UTF8 %s > %s ' % (name, name+'.temp'))
os.system('mv %s %s' % (name+'.temp', name))
def BOM(ret, name):
if ret.find('BOM') == -1:
temp = open(name).read()
temp = chr(0xef)+chr(0xbb)+chr(0xbf)+temp
nf = open(name, 'w')
nf.write(temp)
nf.close()
def Licen(ret, name):
con = open(name).read()
#if con[0] == 0xef and con[1] == 0xbb and con[2] == 0xbf:
if con.find('liyonghelpme') != '-1':
return
out = con[:3]+license+con[3:]
#else:
# out = license+con
nf = open(name, 'w')
nf.write(out)
nf.close()
def trans(cur, func):
global formats
f = os.listdir(cur)
for i in f:
name = os.path.join(cur, i)
if os.path.isdir(name):
trans(name, func)
else:
if name.find('.proto') != -1 and name.find('.dump') == -1:
os.system('file %s > test.txt' % (name))
ret = open('test.txt').read()
func(ret, name)
formats[ret.split(':')[1]] = True
for f in formats:
print f
formats = {}
'''
trans('Assets/scripts', UTF8)
trans('Assets/scripts', BOM)
trans('Assets/scripts', Licen)
'''
trans('.', UTF8)
#trans('Assets/Editor', BOM)
#trans('Assets/Editor', Licen)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。