public static Tag Parse(byte[] data, int index, out int length) { TagType id = (TagType)data[index]; length = sizeof(byte); if (id == TagType.End) { return(EndTag); } StringValue name = StringValue.Parse(data, index + sizeof(byte), out int nameLength); length += nameLength; TagValue value = TagValue.Parse(id, data, index + length, out int valueLength); length += valueLength; return(new Tag(id, name, value)); }