Example #1
0
def read_PD15_string(string, return_pd0=False):
    pd0_bytes = PD15_string_to_PD0(string)
    data = parse_pd0_bytearray(pd0_bytes)
    if return_pd0:
        return data, pd0_bytes
    else:
        return data
Example #2
0
def read_PD15_file(path, header_lines=0, return_pd0=False):
    pd0_bytes = PD15_file_to_PD0(path, header_lines)
    data = parse_pd0_bytearray(pd0_bytes)
    if return_pd0:
        return data, pd0_bytes
    else:
        return data
Example #3
0
def read_PD15_hex(hex_string, return_pd0=False):
    pd15_byte_string = hex_string.decode("hex")
    pd0_bytes = PD15_string_to_PD0(pd15_byte_string)
    data = parse_pd0_bytearray(pd0_bytes)
    if return_pd0:
        return data, pd0_bytes
    else:
        return data
Example #4
0
def read_PD0_file(path, header_lines=0, return_pd0=False):
    pd0_bytes = bytearray()
    with open(path, 'rb') as f:
        for i in xrange(0, header_lines):
            f.readline()

        pd0_bytes = bytearray(f.read())

    data = parse_pd0_bytearray(pd0_bytes)
    if return_pd0:
        return data, pd0_bytes
    else:
        return data
Example #5
0
def read_PD0_bytes(pd0_bytes, return_pd0=False, format='sentinel'):
    if format=='workhorse':
        data = parse_pd0_bytearray(pd0_bytes)
    elif format=='sentinel':
        data = parse_sentinelVpd0_bytearray(pd0_bytes)
    else:
        print('Unknown *.pd0 format')

    if return_pd0:
        ret = data, pd0_bytes
    else:
        ret = data

    return ret
Example #6
0
def file_walker(paths):
    nameDW = ''  # directory name was took before current cycle
    nameFW = ''  # file name without ext was took before current cycle
    bSavedStart = False

    for iname, nameFull in enumerate(paths):
        nameD, nameFE = os.path.split(nameFull)
        nameF, nameE = os.path.splitext(nameFE)
        pd0 = ''
        with open(nameFull, 'rb') as f:
            pd0 = f.read()
        pd0_bytes = bytearray(pd0)
        data = parse_pd0_bytearray(pd0_bytes)
        data.variable_leader
Example #7
0
def read_PD0_bytes(pd0_bytes, return_pd0=False):
    data = parse_pd0_bytearray(pd0_bytes)
    if return_pd0:
        return data, pd0_bytes
    else:
        return data