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)); } }
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); } }
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)); }
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("")); } }
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)); } }
public void ProbeTime(DateTime time) { sendData((int)ParamCode.ProbeTime, PacketBase.GetBytes(time)); }
public void DownloadToPath(string downloadPath) { sendData((int)ParamCode.DownloadToLocal, PacketBase.GetBytes(downloadPath)); }