public byte[] GetBytes()
 {
     return(Qt.Concat(
                MAGIC_NUMBER,
                SCHEMA_VERSION,
                Qt.Encode((uint)MessageType.HIGHLIGHT_CALLSIGN_MESSAGE_TYPE),
                Qt.Encode(Id),
                Qt.Encode(Callsign),
                Qt.Encode(BackgroundColour),
                Qt.Encode(ForegroundColour),
                Qt.Encode(HighlightLast)));
 }
Ejemplo n.º 2
0
        public void EncodeColour()
        {
            /*
             *  qint8   s = color.cspec;
             *  quint16 a = color.ct.argb.alpha;
             *  quint16 r = color.ct.argb.red;
             *  quint16 g = color.ct.argb.green;
             *  quint16 b = color.ct.argb.blue;
             *  quint16 p = color.ct.argb.pad;
             */

            var bytes = Qt.Encode(new Colour {
                Red = 0xff, Green = 0x00, Blue = 0x00
            });

            Assert.Equal(new byte[] {
                0x01,       // spec, RGB
                0xff, 0xff, // alpha, 100%
                0xff, 0x00, // red, 100%
                0x00, 0x00, // green, 0%
                0x00, 0x00, // blue, 0%
                0x00, 0x00, // pad
            }, bytes);
        }
Ejemplo n.º 3
0
        public void EncodeUInt32One()
        {
            var bytes = Qt.Encode(1);

            Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x01 }, bytes);
        }
Ejemplo n.º 4
0
        public void EncodeUInt32Max()
        {
            var bytes = Qt.Encode(UInt32.MaxValue);

            Assert.Equal(new byte[] { 0xff, 0xff, 0xff, 0xff }, bytes);
        }
Ejemplo n.º 5
0
        public void EncodeString()
        {
            var bytes = Qt.Encode("hi");

            Assert.Equal(new byte[] { 0, 0, 0, 2, (byte)'h', (byte)'i' }, bytes);
        }
Ejemplo n.º 6
0
        public void EncodeFalseBool()
        {
            var bytes = Qt.Encode(false);

            Assert.Equal(new byte[] { 0x00 }, bytes);
        }
Ejemplo n.º 7
0
        public void EncodeTrueBool()
        {
            var bytes = Qt.Encode(true);

            Assert.Equal(new byte[] { 0x01 }, bytes);
        }