def parse_tag_group(f, endian='big'): """Parse the root TagGroup of the given DM3 file f. Returns the tuple (is_sorted, is_open, n_tags). endian can be either 'big' or 'little'. """ is_sorted = binIO.read_byte(f, endian) is_open = binIO.read_byte(f, endian) n_tags = binIO.read_long(f, endian) return bool(is_sorted), bool(is_open), n_tags
def parse_tag_group(f, endian="big"): """Parse the root TagGroup of the given DM3 file f. Returns the tuple (is_sorted, is_open, n_tags). endian can be either 'big' or 'little'. """ is_sorted = binIO.read_byte(f, endian) is_open = binIO.read_byte(f, endian) n_tags = binIO.read_long(f, endian) return bool(is_sorted), bool(is_open), n_tags
def parse_tag_entry(f, endian='big'): """Parse a tag entry of the given DM3 file f. Returns the tuple (tag_id, tag_name_length, tag_name). endian can be either 'big' or 'little'. """ tag_id = binIO.read_byte(f, endian) tag_name_length = binIO.read_short(f, endian) str_infoarray = (18, tag_name_length) tag_name_arr = read_string(f, str_infoarray, endian) if len(tag_name_arr): tag_name = reduce(lambda x, y: x + y, tag_name_arr) else: tag_name = '' return tag_id, tag_name_length, tag_name
def parse_tag_entry(f, endian="big"): """Parse a tag entry of the given DM3 file f. Returns the tuple (tag_id, tag_name_length, tag_name). endian can be either 'big' or 'little'. """ tag_id = binIO.read_byte(f, endian) tag_name_length = binIO.read_short(f, endian) str_infoarray = (18, tag_name_length) tag_name_arr = read_string(f, str_infoarray, endian) if len(tag_name_arr): tag_name = reduce(lambda x, y: x + y, tag_name_arr) else: tag_name = "" return tag_id, tag_name_length, tag_name