コード例 #1
0
def folder_and_file_creator():
	import os
	import random
	import dirs
	import files

	original_path = os.path.realpath(os.path.dirname(__file__))
	os.chdir(original_path)
	os.chdir("..")
	mapnames = []
	f1 = open("some_city_names.txt", "r", 1, "utf-8")
	for cityname in f1:
		cityname1 = cityname.replace("\n", "")
		mapnames.append(cityname1)

	home_dirs, appdata_dirs = dirs.dirs_reader('paths.txt')
	dirs.dirs_checker(home_dirs)
	dirs.dirs_checker(appdata_dirs)
	file_list = files.files_reader('files.txt')
	os.chdir(original_path)
	app_dir_indices = [0, 1, 0, 1]
	file_dir_indices = [0, 2, 1, 3]
	os.chdir(home_dirs[8])
	for i in range(10):
		files.files_checker(file_list[5].format(i))
	os.chdir(home_dirs[6])
	for i in range(5):
		if len(os.listdir(home_dirs[6])) < 5:
			mapname = random.choice(mapnames)
			files.files_checker(file_list[4].format(mapname))
		else:
			break
コード例 #2
0
ファイル: __init__.py プロジェクト: OpenSkyCity/OpenSkyCity
def folder_and_file_creator():
    try:
        original_path = os.path.realpath(os.path.dirname(__file__))
        os.chdir(original_path)
        os.chdir("..")
        mapnames = []
        with open("some_city_names.txt", "r", encoding="utf-8") as f1:
            for cityname in f1:
                cityname1 = cityname.replace("\n", "")
                mapnames.append(cityname1)
        home_dirs, appdata_dirs = dirs.dirs_reader('paths.txt')
        dirs.dirs_checker(home_dirs)
        dirs.dirs_checker(appdata_dirs)
        file_list = files.files_reader('files.txt')
        os.chdir(original_path)
        app_dir_indices = [0, 1, 0, 1]
        file_dir_indices = [0, 2, 1, 3]
        switch_dirs(app_dir_indices, file_dir_indices, appdata_dirs, home_dirs,
                    file_list)
        os.chdir(home_dirs[8])
        for i in range(1, 10):
            files.files_checker(file_list[5].format(i))
        os.chdir(home_dirs[6])
        for i in range(5):
            if len(os.listdir(home_dirs[6])) < 5:
                mapname = random.choice(mapnames)
                files.files_checker(file_list[4].format(mapname))
            else:
                break
    except Exception as e:
        return False
    else:
        return True
コード例 #3
0
def special_sandbox_mode_test():
    original_path = os.path.realpath(os.path.dirname(__file__))
    os.chdir("..")
    x, u = dirs.dirs_reader('paths.txt')
    y = files.files_reader('files.txt')
    os.chdir(original_path)
    f1 = open(y[2], 'r')
    os.chdir(x[1])
    f2 = open(y[2], 'w')
    os.chdir(original_path)
    var0 = file.file_read(y[2])
    os.chdir(x[1])
    f2.write(var0[0])
    f2.close()
    os.chdir(original_path)
    file_input = os.path.join(x[1], y[2])
    file_output = os.path.join(u[1], y[3])
    os.chdir("..")
    decrypt_file(file_input, file_output)
    os.chdir(original_path)
    # su.special_sandbox_mode_users_writer()
    # x2 = su.special_sandbox_mode_users_checker()
    # if x2 is not None:
    #     print(x2)
    # else:
    #     t.sleep(2)
    #     print("\n\nExited successfully!")
    file_input = os.path.join(u[1], y[3])
    file_output = os.path.join(original_path, y[2])
    os.chdir('..')
    encrypt_file(file_input, file_output)
    os.chdir(original_path)
コード例 #4
0
def premium_users_checker():
    original_path = os.getcwd()
    os.chdir("..")
    x, u = dirs.dirs_reader('paths.txt')
    os.chdir(u[0])
    x1 = rc.users_checker('premium', 'premium_users.txt')
    os.chdir(original_path)
    return x1
コード例 #5
0
def special_sandbox_mode_users_checker():

    original_path = os.getcwd()
    os.chdir("..")
    x, u = dirs.dirs_reader('paths.txt')
    os.chdir(u[1])
    x1 = rc.users_checker('special sandbox', 'special_sandbox_mode_users.txt')
    os.chdir(original_path)
    return x1
コード例 #6
0
def premium_users_writer():

    original_path = os.getcwd()
    os.chdir("..")
    x, u = dirs.dirs_reader('paths.txt')
    os.chdir(u[0])
    rc.user_writer('premium_users.txt', 'premium', 10000000000, 99999999999,
                   25)
    os.chdir(original_path)
コード例 #7
0
def special_sandbox_mode_users_writer():

    original_path = os.getcwd()
    os.chdir("..")
    x, u = dirs.dirs_reader('paths.txt')
    os.chdir(u[1])
    rc.user_writer('special_sandbox_mode_users.txt', 'special sandbox',
                   100000000000000000000000000000,
                   999999999999999999999999999999, 35)
    os.chdir(original_path)