def to_bytes(tag): out_stream = ABCFileOutputStream() out_stream.write(TagHeaderConverter.to_bytes(tag.type, tag.header)) out_stream.writeUI16(tag.characterId) out_stream.writeUI32(tag.reserved) out_stream.write(tag.data) return out_stream.getvalue()
def to_bytes(tag): out_stream = ABCFileOutputStream() out_stream.write(TagHeaderConverter.to_bytes(tag.type, tag.header)) out_stream.writeUI16(len(tag.symbols)) for symbol in tag.symbols: out_stream.writeUI16(symbol.tagId) out_stream.write(symbol.name + '\x00') return out_stream.getvalue()
def to_bytes(tag_type, header): out_stream = ABCFileOutputStream() if header.content_length < 0x3f: out_stream.writeUI16( (tag_type << 6) | header.content_length ) else: out_stream.writeUI16((tag_type << 6) | 0x3f) out_stream.writeUI32(header.content_length) return out_stream.getvalue()