private static void RewriteMessageLocalized(ReadOnlySpan <byte> input, CircularBuffer <byte> output, out int length)
        {
            var isAffix = input[0] == 0xCC;

            var reader = new SpanReader(input);

            reader.Seek(3, SeekOrigin.Current);
            var serial  = (Serial)reader.ReadUInt32();
            var graphic = reader.ReadInt16();
            var type    = (MessageType)reader.ReadByte();
            var hue     = reader.ReadInt16();
            var font    = reader.ReadInt16();
            var label   = reader.ReadInt32();
            var flags   = isAffix ? (AffixType)reader.ReadByte() : AffixType.System;
            var name    = reader.ReadAscii(30);
            var affix   = isAffix ? reader.ReadAscii() : string.Empty;
            var args    = isAffix ? reader.ReadBigUni() : reader.ReadLittleUni();

            if (!ZhConfig.Messaging.Cliloc.ContainsKey(label))
            {
                length = NetworkCompression.Compress(input, output);
                return;
            }

            var text = ClilocList.Translate(label, args);

            if (isAffix)
            {
                text = flags switch
                {
                    AffixType.Append => $"{text}{affix}",
                    AffixType.Prepend => $"{affix}{text}",
                    _ => $"{text}{affix}"
                };

                if ((flags & AffixType.System) != 0)
                {
                    type = MessageType.System;
                }
            }

            var buffer  = stackalloc byte[GetMaxMessageLength(text)].InitializePacket();
            var pLength = CreateMessage(
                buffer,
                serial,
                graphic,
                type,
                hue,
                font,
                true,
                null,
                name,
                text
                );

            buffer = buffer.SliceToLength(pLength);

            length = NetworkCompression.Compress(buffer, output);
        }
    }
        private static void RewriteUnicodeMessage(ReadOnlySpan <byte> input, CircularBuffer <byte> output, out int length)
        {
            var reader = new SpanReader(input);

            reader.Seek(3, SeekOrigin.Current);

            var serial  = reader.ReadUInt32();
            var graphic = reader.ReadInt16();
            var type    = (MessageType)reader.ReadByte();
            var hue     = reader.ReadInt16();
            var font    = reader.ReadInt16();
            var lang    = reader.ReadAscii(4);
            var name    = reader.ReadAscii(30);
            var text    = reader.ReadBigUni();

            var buffer  = stackalloc byte[GetMaxMessageLength(text)].InitializePacket();
            var pLength = CreateMessage(
                buffer,
                serial,
                graphic,
                type,
                hue,
                font,
                true,
                null,
                name,
                text
                );

            buffer = buffer.SliceToLength(pLength);
            length = NetworkCompression.Compress(buffer, output);
        }