public override int Serialize(byte[] codeplugContents, int address) { var contents = new byte[CONTENTS_LENGTH + (HasExtraByte ? 1 : 0)].AsSpan(); Unknown1.CopyTo(contents.Slice(UNKNOWN1, 13)); Unknown2.CopyTo(contents.Slice(UNKNOWN2, 9)); contents[RSSI] = (byte)(RssiAlignment & 0b01111111); Unknown3.CopyTo(contents.Slice(UNKNOWN3, 2)); contents[MIC_GAIN] = (byte)((InternalMicPreAmpGain & 0b111) << 5); contents[MIC_GAIN] |= (byte)((ExternalMicPreAmpGain & 0b111) << 2); contents[MIC_GAIN] |= (byte)(UnknownMicBits & 0b11); Unknown4.CopyTo(contents.Slice(UNKNOWN4, 9)); Unknown5.CopyTo(contents.Slice(UNKNOWN5, 4)); if (HasExtraByte) { contents[UNKNOWNEXTRABYTE] = UnknownExtraByte; } var nextAddress = address + contents.Length + BlockSizeAdjustment; nextAddress = SerializeChild(Block06, BLOCK_06_VECTOR, codeplugContents, nextAddress, contents); nextAddress = SerializeChild(Block03, BLOCK_03_VECTOR, codeplugContents, nextAddress, contents); nextAddress = SerializeChild(Block0C, BLOCK_0C_VECTOR, codeplugContents, nextAddress, contents); nextAddress = SerializeChild(Block0F, BLOCK_0F_VECTOR, codeplugContents, nextAddress, contents); nextAddress = SerializeChild(Block11, BLOCK_11_VECTOR, codeplugContents, nextAddress, contents); Serializer(codeplugContents, address, contents); return(nextAddress); }