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))); }
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); }
public void EncodeUInt32One() { var bytes = Qt.Encode(1); Assert.Equal(new byte[] { 0x00, 0x00, 0x00, 0x01 }, bytes); }
public void EncodeUInt32Max() { var bytes = Qt.Encode(UInt32.MaxValue); Assert.Equal(new byte[] { 0xff, 0xff, 0xff, 0xff }, bytes); }
public void EncodeString() { var bytes = Qt.Encode("hi"); Assert.Equal(new byte[] { 0, 0, 0, 2, (byte)'h', (byte)'i' }, bytes); }
public void EncodeFalseBool() { var bytes = Qt.Encode(false); Assert.Equal(new byte[] { 0x00 }, bytes); }
public void EncodeTrueBool() { var bytes = Qt.Encode(true); Assert.Equal(new byte[] { 0x01 }, bytes); }