public void StartDownloadByTime() { DoCallBack = new ReplayCallBackDelegate(DoCallBackFunction); int iRet = NVSSDK.NetClient_NetFileDownloadByTimeSpanEx(ref m_ulConnID, m_ClientInfo.m_iServerID, null, m_iRealChannel, ref m_begintime, ref m_endtime, 0, -1, 2); if (iRet < 0) { if (m_ulConnID != -1) { NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID); m_ulConnID = 0; } return; } else { IntPtr tmep = IntPtr.Zero; iRet = NVSSDK.NetClient_SetNetFileDownloadFileCallBack(m_ulConnID, DoCallBack, tmep); } }
private void btnDownloadTime_Click(object sender, EventArgs e) { if (dtStartTimeTime.Value >= dtEndTimeTime.Value) { MessageBox.Show("Start Time > End Time!"); return; } m_StartTime.m_iYear = Convert.ToUInt16(dtStartTimeTime.Value.Year); m_StartTime.m_iMonth = Convert.ToUInt16(dtStartTimeTime.Value.Month); m_StartTime.m_iDay = Convert.ToUInt16(dtStartTimeTime.Value.Day); m_StartTime.m_iHour = Convert.ToUInt16(dtStartTimeTime.Value.Hour); m_StartTime.m_iMinute = Convert.ToUInt16(dtStartTimeTime.Value.Minute); m_StartTime.m_iSecond = Convert.ToUInt16(dtStartTimeTime.Value.Second); m_EndTime.m_iYear = Convert.ToUInt16(dtEndTimeTime.Value.Year); m_EndTime.m_iMonth = Convert.ToUInt16(dtEndTimeTime.Value.Month); m_EndTime.m_iDay = Convert.ToUInt16(dtEndTimeTime.Value.Day); m_EndTime.m_iHour = Convert.ToUInt16(dtEndTimeTime.Value.Hour); m_EndTime.m_iMinute = Convert.ToUInt16(dtEndTimeTime.Value.Minute); m_EndTime.m_iSecond = Convert.ToUInt16(dtEndTimeTime.Value.Second); string localfile = "Demo_Download" + m_StartTime.m_iYear.ToString() + m_StartTime.m_iMonth.ToString() + m_StartTime.m_iDay.ToString() + m_StartTime.m_iHour.ToString() + m_StartTime.m_iMinute.ToString() + m_StartTime.m_iSecond.ToString() + "-" + m_EndTime.m_iYear.ToString() + m_EndTime.m_iMonth.ToString() + m_EndTime.m_iDay.ToString() + m_EndTime.m_iHour.ToString() + m_EndTime.m_iMinute.ToString() + m_EndTime.m_iSecond.ToString() + ".sdv"; if (!System.IO.Directory.Exists("E:\\netclientdemo_download")) { System.IO.Directory.CreateDirectory("E:\\netclientdemo_download"); } string path = "E:\\netclientdemo_download\\" + localfile; int iChannelNo = cbPassNOTime.SelectedIndex; int iStreamNo = cbBitStreamType.SelectedIndex; int iChannelNum = 0; NVSSDK.NetClient_GetChannelNum(m_ClientInfo.m_iServerID, ref iChannelNum); int iRealChannel = iStreamNo * iChannelNum + iChannelNo; int iRet = NVSSDK.NetClient_NetFileDownloadByTimeSpanEx(ref m_ulConnID, m_ClientInfo.m_iServerID, path, iRealChannel, ref m_StartTime, ref m_EndTime, 0, -1, 16); if (iRet < 0) { if (m_ulConnID != -1) { NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID); //m_ulConnID = 0; } return; } else { iRet = NVSSDK.NetClient_NetFileDownloadByTimeSpanEx(ref m_ulConnID, m_ClientInfo.m_iServerID, path, iRealChannel, ref m_StartTime, ref m_EndTime, 1, -1, 16); } pbDownloadTime.Value = 0; timerTime.Enabled = true; }