Ejemplo n.º 1
0
from Tools.Json_unpacker import json_pack

def_data_fold = r"../SunlessSea_data/"
def_dir = "../SunlessSea_data/version04_2017/"

if __name__ == '__main__':

    dir_with_data = ""

    if len(sys.argv) < 2:
        dir_with_data = def_dir
    else:
        dir_with_data = def_data_fold + sys.argv[1] + "/"
        # os.system("bash " + def_data_fold + "init.bat" + " " + sys.argv[1])

    list_of_json_files = construct_file_three(dir_with_data + "/input_json_text")

    for file in list_of_json_files:
        print("Pack " + file.split(splitter)[-1])
        json_pack.pack_file(dir_with_data, file.split(splitter)[-1].split(".")[0])
        print("Packing done")
        print("==============")


    # os.system("python ")

    # On the first we should unpack resources files

    # print("Start resources unpack process")
    # os.system("python oxenfree_binary_unpack_resources.py " + dir_with_data)
    # print("Finish resources unpack")
Ejemplo n.º 2
0
#   out path
prefix_lvl = "result_lvl"  # folder in the result
prefix_dialog = "result_dialogs"  # folder in the result
postfix = "fileinfo"  # underfolder in the prefix folder (for file info)

if __name__ == "__main__":
    """ Block 0 """
    if len(sys.argv) < 2:
        pass
    else:
        dir_path = sys.argv[1]
        dir_lvl = sys.argv[1] + "/input_lvl"

    # Construct list of files (full route)
    file_list = ffind.construct_file_three(dir_lvl,
                                           ignoring_directories=["resources"])

    # get all file data
    binary_data = freader.read_binary_files(file_list)

    # get strings
    strings = bparser.parse_binary_list(binary_data)
    # now we can use filtres
    result_quo, result, removed = text_filter.oxenfree_filter_lvl(
        strings, start_str=r"\{\"_id.*")

    # ordering
    result_quo, ordering_result_quo = text_filter.ordering_by_filetype(
        result_quo, file_list)
    result, ordering_result = text_filter.ordering_by_filetype(
        result, file_list)
from Modules.BinaryParser import binary_parser as bparser
from Modules.FilesOperation import find as ffind
from Modules.FilesOperation import readFile as freader
from Modules.FilesOperation import writeFile as fwriter
from Modules.TextOperations import text_filter

filepatch = "/mnt/sda3/TT/TT_OF4/Unity_Assets_Files/"
# filepatch = "./examples"

#   out path
prefix = "testAll"     # folder in the result
postfix = "fileinfo"        # underfolder in the prefix folder (for file info)

if __name__ == "__main__":
    # Construct list of files (full route)
    file_list = ffind.construct_file_three(filepatch)

    # get all file data
    binary_data = freader.read_binary_files(file_list)

    # get strings
    strings = bparser.parse_binary_list(binary_data)

    # now we can use filtres
    result_quo, result, removed = text_filter.oxenfree_filter_lvl(strings)

    # ordering
    result_quo, ordering_result_quo = text_filter.ordering_by_filetype(result_quo, file_list)
    result, ordering_result = text_filter.ordering_by_filetype(result, file_list)
    removed, ordering_removed = text_filter.ordering_by_filetype(removed, file_list)
Ejemplo n.º 4
0
def del_file_from_list_of_types(del_list, directory):
    file_list = ffind.construct_file_three(directory)
    for ftype in del_list:
        for file in file_list:
            if ffind.find_filetype(file) == ftype:
                os.remove(file)
Ejemplo n.º 5
0
#   Дата:       10.04.17
#   Автор:      Lenferd ([email protected])

files_directory = r'./input'

from Modules.TextOperations import encoding_fix

from Modules.FilesOperation import readFile, writeFile, find
from Modules.TextOperations import text_filter
from Tools.Block_handler import block_util

if __name__ == '__main__':

    list_of_files = []

    list_of_files = find.construct_file_three(files_directory)

    for file in list_of_files:
        resultData = []
        file_data = readFile.read_file_rstrip(file)
        for line in file_data:
            resultData += block_util.oxf_search_string(line)

        for i in range(len(list_of_files)):
            k = 0
            while k < len(resultData):
                if resultData[k] == '\n' or resultData[k] == " \n":
                    resultData.pop(k)
                    k -= 1
                k += 1
Ejemplo n.º 6
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

#   Программа:  unpack select dialog
#   Назначение: Вытаскиваем текст из строк с кавычками и прочей дрянью
#   Версия:     2.0
#   Дата:       9.04.17
#   Автор:      Lenferd ([email protected])

from Modules.FilesOperation import find

path = "./result/lvl_to_transl/quotes/separated"

if __name__ == '__main__':
    list_of_files = find.construct_file_three(path)


postfix = "fileinfo"  # underfolder in the prefix folder (for file info)

if __name__ == "__main__":
    """ Block 0 """
    if len(sys.argv) < 2:
        pass
    else:
        dir_path = sys.argv[1]
        dir_resources = sys.argv[1] + "/input_resources"
    """ Block 1 open & read
        На выходе получаем list из листов соответствующих поданных на вход файлов (file_list)
        + данные внутри преобразованы в UTF8 из бинарного вида
    """
    # Construct list of files (full route)
    # TODO можно добавить возможность указывать маску, по которой будут искаться файлы (т.е. разрешение)
    file_list = ffind.construct_file_three(dir_resources)

    # get all file data
    binary_data = freader.read_binary_files(file_list)

    # get strings
    strings = bparser.parse_binary_list(binary_data)
    """ Block 2
        Использование фильтра для отсеивания лишних строг (грубая обработка)
        Фильтр настраивается
    """
    # now we can use filtres
    result, removed = text_filter.oxenfree_filter_resources(strings)
    """ Block 3
        Упорядочивание массивов данных по типу файлов
    """
Ejemplo n.º 8
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

#   Программа:  Oxenfree Packer
#   Назначение: Запихиваем всё это дерьмо обратно
#   Версия:     2.0
#   Дата:       10.04.17
#   Автор:      Lenferd ([email protected])

from Modules.BinaryParser import binary_filler
from Modules.FilesOperation import readFile, find

original_file = "input/original.txt"
translated_file = "input/translate.txt"

path = "/mnt/sda3/TT/TT_OF4/Unity_Assets_Files/resources"
outpath = "./result_hex"

if __name__ == '__main__':
    original_data = readFile.read_file_rstrip(original_file)
    translated_data = readFile.read_file_rstrip(translated_file)

    binary_file_list = find.construct_file_three(path)

    bin_original_data = binary_filler.convert_text_to_binary(original_data)
    bin_transl_data = binary_filler.convert_text_to_binary(translated_data)
    binary_filler.parse_and_fill_binary_list(binary_file_list,
                                             bin_original_data,
                                             bin_transl_data, binary_file_list,
                                             outpath)