Beispiel #1
0
 def create_lua_table():
     filelist = set()
     with open(
             '/Users/joli/Desktop/apps/三国杀名将传/assets/package1_filelist.txt',
             'r') as fp:
         for item in fp.read().split('\n'):
             if item:
                 name = item[item.find(':') + 1:]
                 fext = FS.extensions(name)
                 if fext == '.png' or fext == '.jpg':
                     filelist.add('"%s"' % name)
     with open('/Users/joli/Desktop/apps/三国杀名将传/assets/patch_filelist.txt',
               'r') as fp:
         for item in fp.read().split('\n'):
             if item:
                 name = item[item.find(':') + 1:]
                 fext = FS.extensions(name)
                 if fext == '.png' or fext == '.jpg':
                     filelist.add('"%s"' % name)
     filelist = sorted(filelist)
     print(len(filelist))
     fileroot = '/Users/joli/Documents/AndroidStudio/DeviceExplorer/emulator-5554/data/user/0/com.tencent.tmgp.sanguosha.mjz/files'
     resroot = '/Users/joli/Desktop/apps/apk/res'
     n = 0
     for i in range(len(filelist)):
         filename = filelist[i][1:-1]
         hackname = 'hackimage_%d.%s' % (i + 1, filename[-3:])
         hackpath = os.path.join(fileroot, hackname)
         if os.path.isfile(hackpath):
             dst = os.path.join(resroot, filename)
             FS.make_parent(dst)
             shutil.copy2(hackpath, dst)
         else:
             n += 1
             print("miss", n, i, filename, hackname)
Beispiel #2
0
 def fullpath(parent, info):
     for key in info:
         obj = info[key]
         if isinstance(obj, dict):
             fullpath('%s/%s' % (parent, key), obj)
         else:
             ext = FS.extensions(key)
             isetc = False
             if ext == '.etc':
                 isetc = True
                 ext = '.png'
             filename = '%s_%s%s' % (FS.filename(key), obj, ext)
             if not _httpload(parent, filename):
                 if isetc:
                     filename = '%s_%s%s' % (FS.filename(key), obj,
                                             '.jpg')
                     if not _httpload(parent, filename):
                         filename = '%s_%s%s' % (FS.filename(key), obj,
                                                 '.etc')
                         if not _httpload(parent, filename):
                             failurl = parent + '/' + filename
                             log.e('fail', failurl)
                             errors.append(failurl)
                 else:
                     failurl = parent + '/' + filename
                     log.e('fail', failurl)
                     errors.append(failurl)
Beispiel #3
0
 def copy_files(self):
     src = os.path.join(self.idir, 'Data')
     dst = os.path.join(self.odir, 'Data')
     files = FS.walk_files(src, cut=len(src) + 1)
     for f in files:
         if f[0] == '.':
             continue
         if FS.extensions(f) == '.bin':
             continue
         d = os.path.join(dst, f)
         if os.path.isfile(d):
             continue
         FS.moveto(os.path.join(src, f), d)
Beispiel #4
0
 def pull_files(self):
     fs = '/Users/joli/Documents/AndroidStudio/DeviceExplorer/meizu-m3s-Y15QKBPR242LL/data/data/com.youzu.snsgz2.aligames/files'
     files = self.read_files()
     misss = []
     for i in range(len(files)):
         fn = files[i]
         i += 1
         src = os.path.join(fs, 'hack%d%s' % (i, FS.extensions(fn)))
         if os.path.isfile(src):
             dst = os.path.join(self.odir, fn)
             FS.moveto(src, dst)
         else:
             misss.append(i)
     print(misss)