예제 #1
0
    void  PushDownFile(List <DownResInfo> downList, string url)
    {
        DownResInfo node = new DownResInfo();

        node.url = url;
        CHttpDown.GetDownFileSize(url, out node.nFileSize);
        downList.Add(node);
    }
예제 #2
0
 bool PopDownFileInfo(out DownResInfo resInfo)
 {
     resInfo = null;
     if (m_bNeedStop)
     {
         return(false);
     }
     lock (this)
     {
         if (m_nNextDownIndex < m_nDownCount)
         {
             resInfo = m_DownList[m_nNextDownIndex++];
         }
     }
     return(resInfo != null);
 }
예제 #3
0
    void DownThread()
    {
        DownResInfo resInfo = null;
        CHttp       http    = new CHttp();

        while (!m_bNeedStop)
        {
            if (PopDownFileInfo(out resInfo))
            {
                DownFile(http, resInfo.url, resInfo.nFileSize, resInfo.nDownSize);
            }
            else
            {
                break;
            }
        }
        http.Close();
        // 线程退出,线程数减一
        System.Threading.Interlocked.Decrement(ref m_nDownThreadNumb);
    }