示例#1
0
        private void DownloadtFinished(int iID)
        {
            if (m_ulConnID == iID)
            {
                NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);
                pbDownloadTime.Value      = 100;
                m_ulConnID                = 0;
                lbDownloadStatusTime.Text = "Download Finished";
                timerTime.Enabled         = false;
            }
            foreach (Download file in m_lstDownloadFile)
            {
                if (file.GetConnID() == iID)
                {
                    file.StopDownload();
                    m_lstDownloadFile.Remove(file);
                    for (int i = 0; i < lvFileData.Items.Count; i++)
                    {
                        string sFileName = lvFileData.Items[i].SubItems[1].Text.ToString();

                        if (sFileName == file.GetFilename())
                        {
                            lvFileData.Items[i].SubItems[6].Text = "Finished";
                        }
                    }

                    break;
                }
            }
            if (m_lstDownloadFile.Count == 0)
            {
                timerFile.Enabled = false;
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
 private void PlayForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     PLAYSDK.TC_Stop(m_iPlayerID);         //停止播放
     PLAYSDK.TC_StopAudio(m_iPlayerID);
     PLAYSDK.TC_DeletePlayer(m_iPlayerID); //删除播放器实例
     PLAYSDK.TC_DeleteSystem();
     NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);
 }
示例#4
0
        public void StopDownload()
        {
            int iret = NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);

            if (iret < 0)
            {
                MessageBox.Show("NetClient_NetFileStopDownloadFile faild!");
            }
        }
示例#5
0
 private void btnStopDownloadTime_Click(object sender, EventArgs e)
 {
     if (m_ClientInfo.m_iServerID != -1 && m_ulConnID != -1)
     {
         NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);
         pbDownloadTime.Value      = 0;
         m_ulConnID                = 0;
         lbDownloadStatusTime.Text = "Stop Download";
         timerTime.Enabled         = false;
     }
 }
示例#6
0
        public void StartDownloadByFile()
        {
            DoCallBack = new ReplayCallBackDelegate(DoCallBackFunction);

            int iRet = NVSSDK.NetClient_NetFileDownloadFile(ref m_ulConnID, m_ClientInfo.m_iServerID, m_szFileName.ToString(), "", 0, -1, 2);

            if (iRet >= 0)
            {
                IntPtr temp = IntPtr.Zero;
                int    irt  = NVSSDK.NetClient_SetNetFileDownloadFileCallBack(m_ulConnID, DoCallBack, temp);
            }
            else
            {
                //if (m_ulConnID != -1)  // INVALID_ID)
                {
                    NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID);
                    //m_ulConnID = -1;
                }
            }
        }
示例#7
0
        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;
        }