Esempio n. 1
0
        public void GetBytes()
        {
            string messageString = ",#\u000f";
            var    bytes         = MdvrMessageHelper.GetBytes(messageString);

            bytes = MdvrMessageHelper.Escape(bytes, false);
            var expected = new byte[] { 0x00, 0x0f, 0x01, 0x0f, 0x02, 0x0f };

            CollectionAssert.AreEqual(expected, bytes);
        }
Esempio n. 2
0
        private void SendMessage(List <byte> byteList)
        {
            using (var ms = new MemoryStream())
            {
                using (var br = new BinaryWriter(ms))
                {
                    br.Write(MdvrMessageHelper.GetBytes(MdvrMessageHelper.MediaMessageStart));
                    br.Write(byteList.Count);
                    br.Write(byteList.ToArray());
                    br.Write(MdvrMessageHelper.GetBytes(MdvrMessageHelper.MediaMessageEnd));

                    var bytes = ms.ToArray();

                    Send(bytes);
                }
            }
        }