private void SearchPlayBackFile() { int m_lChannel = CurVideo.ChannelNo; m_struFileCond.lChannel = m_lChannel; m_struFileCond.dwFileType = 0xff; m_struFileCond.struStartTime.dwYear = dtStart.Year; m_struFileCond.struStartTime.dwMonth = dtStart.Month; m_struFileCond.struStartTime.dwDay = dtStart.Day; m_struFileCond.struStartTime.dwHour = dtStart.Hour; m_struFileCond.struStartTime.dwMinute = dtStart.Minute; m_struFileCond.struStartTime.dwSecond = dtStart.Second; m_struFileCond.struStopTime.dwYear = dtEnd.Year; m_struFileCond.struStopTime.dwMonth = dtEnd.Month; m_struFileCond.struStopTime.dwDay = dtEnd.Day; m_struFileCond.struStopTime.dwHour = dtEnd.Hour; m_struFileCond.struStopTime.dwMinute = dtEnd.Minute; m_struFileCond.struStopTime.dwSecond = dtEnd.Second; m_struFileCond.dwUseCardNo = 0; m_struFileCond.dwVolumeNum = 0; m_struFileCond.byFindType = 0; m_struFileCond.byStreamType = 0; m_struFileCond.byAudioFile = 0; m_struFileCond.dwIsLocked = 0xff; for (int i = 0; i < m_struFileCond.byWorkingDeviceGUID.Length; i++) { m_struFileCond.byWorkingDeviceGUID[i] = 0; } byte[] byTemp = new byte[CHCNetSDK.GUID_LEN]; byTemp = System.Text.Encoding.UTF8.GetBytes("0000000000000000"); byTemp.CopyTo(m_struFileCond.byWorkingDeviceGUID, 0); m_struFileCond.dwUseCardNo = 0; byte[] byTemp2 = new byte[CHCNetSDK.CARDNUM_LEN_OUT]; byTemp2 = System.Text.Encoding.UTF8.GetBytes(""); byTemp2.CopyTo(m_struFileCond.sCardNumber, 0); if (m_struFileCond.dwUseCardNo > 0) { m_struFileCond.bySpecialFindInfoType = 1; m_struFileCond.uSpecialFindInfo.struATMFindInfo.byTransactionType = 0; m_struFileCond.uSpecialFindInfo.struATMFindInfo.dwTransationAmount = byte.Parse(""); } int dwSize = Marshal.SizeOf(m_struFileCond); int m_lFileHandle = CHCNetSDK.NET_DVR_FindFile_V40(m_lUserID, ref m_struFileCond); if (m_lFileHandle < 0) { string strTemp = string.Format("NET_DVR_FindFile_V40 FAIL, ERROR CODE {0}", CHCNetSDK.NET_DVR_GetLastError()); return; } //处理查找到的文件 CHCNetSDK.NET_DVR_FINDDATA_V40 struFileInfo = new CHCNetSDK.NET_DVR_FINDDATA_V40(); int lRet = -1; string filestarttime = "", fileendtime; while (true) { lRet = CHCNetSDK.NET_DVR_FindNextFile_V40(m_lFileHandle, ref struFileInfo); if (lRet == CHCNetSDK.NET_DVR_FILE_SUCCESS) { filestarttime = struFileInfo.struStartTime.dwYear.ToString("D4") + "-" + struFileInfo.struStartTime.dwMonth.ToString("D2") + "-" + struFileInfo.struStartTime.dwDay.ToString("D2") + " " + struFileInfo.struStartTime.dwHour.ToString("D2") + ":" + struFileInfo.struStartTime.dwMinute.ToString("D2") + ":" + struFileInfo.struStartTime.dwSecond.ToString("D2"); fileendtime = struFileInfo.struStopTime.dwYear.ToString("D4") + "-" + struFileInfo.struStopTime.dwMonth.ToString("D2") + "-" + struFileInfo.struStopTime.dwDay.ToString("D2") + " " + struFileInfo.struStopTime.dwHour.ToString("D2") + ":" + struFileInfo.struStopTime.dwMinute.ToString("D2") + ":" + struFileInfo.struStopTime.dwSecond.ToString("D2"); DateTime dtfile = Convert.ToDateTime(filestarttime); DateTime endfile = Convert.ToDateTime(fileendtime); PlayBackFileInfo pbfi = new PlayBackFileInfo() { DtStart = dtfile, DtEnd = endfile }; ListPlayBackFileTime.Add(pbfi); } else { if (lRet == CHCNetSDK.NET_DVR_ISFINDING) { Thread.Sleep(5); continue; } else { break; } } } GetPlayBackTime(); CHCNetSDK.NET_DVR_FindClose_V30(m_lFileHandle); }