Esempio n. 1
0
        public void TestPacketBase_string_more()
        {
            string str = "testString";

            byte[] nullBuffer = PacketBase.GetBytes(str);
            using (MemoryStream ms = new MemoryStream(nullBuffer))
            {
                Assert.AreEqual(str, PacketBase.ReadString(ms));
            }
        }
Esempio n. 2
0
        public void TestPacketBase_DateTime()
        {
            DateTime time   = new DateTime(2016, 5, 25, 17, 28, 10, 123);
            var      buffer = PacketBase.GetBytes(time);

            using (MemoryStream ms = new MemoryStream(buffer))
            {
                var time2 = PacketBase.ReadTime(ms);
                Assert.AreEqual(time, time2);
            }
        }
Esempio n. 3
0
 public void GetVideoTreeNodesAsync()
 {
     if (!SourceValid)
     {
         throw new ErrorMessageException("尚未设置数据源地址。");
     }
     if (_src.SrcType == SourceType.Remote)
     {
         throw new ErrorMessageException("此方法不能获取远程数据源视频录像信息。");
     }
     EnsureStart();
     Client.Send((int)ParamCode.LocalDownloadPath, PacketBase.GetBytes(_src.LocalSourcePath));
 }
Esempio n. 4
0
 private void sendDownloadPath(IOnlinePlayback onlineDownload)
 {
     if (onlineDownload == null)
     {
         return;
     }
     if (onlineDownload.IsLocalDownload)
     {
         send(ParamCode.LocalDownloadPath, PacketBase.GetBytes(onlineDownload.DownloadInfo.DownloadPath));
     }
     else
     {
         send(ParamCode.LocalDownloadPath, PacketBase.GetBytes(""));
     }
 }
Esempio n. 5
0
        public void TestPacketBase_string_null()
        {
            string str = null;

            byte[] nullBuffer = PacketBase.GetBytes(str);
            using (MemoryStream ms = new MemoryStream(nullBuffer))
            {
                Assert.IsNull(PacketBase.ReadString(ms));
            }
            str = string.Empty;
            byte[] buffer = PacketBase.GetBytes(str);
            using (MemoryStream ms = new MemoryStream(buffer))
            {
                Assert.AreEqual(string.Empty, PacketBase.ReadString(ms));
            }
        }
Esempio n. 6
0
 public void ProbeTime(DateTime time)
 {
     sendData((int)ParamCode.ProbeTime, PacketBase.GetBytes(time));
 }
Esempio n. 7
0
 public void DownloadToPath(string downloadPath)
 {
     sendData((int)ParamCode.DownloadToLocal, PacketBase.GetBytes(downloadPath));
 }