Pythonla uğraşanlar için rnek olsun diye yazıyorum gereksiz grünürse silinebilir. #! /usr/bin/python # # Generates striped MD5 fingerprints for BF2 content checking. # # Author: Andreas Fredriksson # Copyright 2005 Digital Illusions CE AB import os import os. path import md5 from optparse import OptionParser num_ordinals = 10 block_size = 16384 def ordinal_pass : ctx = for x in xrange(0, num_ordinals): ctx. append(md5. new for file in files: sz = os. stat . st_size num_blocks = + 1 inf = open for b_i in xrange(0, num_blocks+1, num_ordinals): for ordinal in xrange(0, num_ordinals): data = inf. read if len > 0: ctx . update #Take size into account as well. for ordinal in xrange(0, num_ordinals): ctx . update(str return ctx def run_fingerprint : ctx = ordinal_pass tmp = for o in xrange(0, num_ordinals): tmp. append('%d %s' % (o, ctx . hexdigest return tmp def visitor : for fn_ in names: fn = fn_. lower if fn 'server. zip' or fn 'client. zip': p = os. path. split . lower list = arcs. get list. append(os. path. join arcs = list return names parser = OptionParser parser. add_option = parser. parse_args try: mod_name = args except: print("\n Content Checking: Mod name missing - using mods/bf2 \n") mod_name = "bf2" mod_path = 'mods' + os. sep + mod_name files = files += files += std_archives = nite_archives = boost_archives = boost_nite_archives = if options. levels False: print for filename in files : of = open for line in of : list = line. split if len > 1 : archive = list archive = archive. replace archive = archive. replace if archive != 'mods' : archive = mod_path + os. sep + archive archive = archive. lower if archive. find >= 0: print("\nContent Checking: Found SHADER updating bf2 archives list...\n") bf2archive = "mods\\bf2\\shaders_client. zip" std_archives += # Use bf2 shaders as day shaders nite_archives += # Use mods shaders as nite shaders boost_archives += boost_nite_archives += else: if archive. find >= 0: print boost_archives += # only add to boster lists boost_nite_archives += else: std_archives += nite_archives += boost_archives += boost_nite_archives += of. close std_archives. sort nite_archives. sort boost_archives. sort boost_nite_archives. sort print for archive in std_archives : print archive print for narchive in nite_archives : print narchive print for barchive in boost_archives : print barchive print for bnarchive in boost_nite_archives : print bnarchive print of = open(mod_path + os. sep + 'std_archive. md5', 'w') std_fps = run_fingerprint for s in std_fps: of. write of. write of. close print of = open(mod_path + os. sep + 'std_archive_mod. md5', 'w') nite_fps = run_fingerprint for s in nite_fps: of. write of. write of. close print of = open(mod_path + os. sep + 'bst_archive. md5', 'w') std_fps = run_fingerprint for s in std_fps: of. write of. write of. close print of = open(mod_path + os. sep + 'bst_archive_mod. md5', 'w') std_fps = run_fingerprint for s in std_fps: of. write of. write of. close print lvl_archives = os. path. walk print("\n Content Checking: Found " + str(len + " " + mod_name + " Levels \n") print for level, arcs in lvl_archives. iteritems : arcs. sort fps = run_fingerprint of = open(mod_path + os. sep + 'levels' + os. sep + level + os. sep + 'archive. md5', 'w') for fpr in fps: of. write('%s %s\n' % of. close ; print