Esempio n. 1
0
 public bool ReceiveData(byte[] data, int dataLength)
 {
     if (data == null || dataLength == 0 || m_fileStream == null)
     {
         return(false);
     }
     m_fileStream.Write(data, 0, dataLength);
     DownloadedLength += dataLength;
     m_downloadFileResult.downloadedLength    = DownloadedLength;
     m_downloadFileResult.downloadedLengthStr = HumanRead.HumanReadableFilesize(DownloadedLength);
     Progress(m_downloadFileResult);
     return(true);
 }
Esempio n. 2
0
        public HttpDownloadFileHandler(string download_url, string localPath_url)
        {
            m_download_url       = download_url;
            m_localPath_url      = localPath_url;
            m_downloadFileResult = new SDownloadFileResult();
            string dir = Path.GetDirectoryName(localPath_url);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            m_fileStream     = new FileStream(localPath_url + ".tmp", FileMode.Append, FileAccess.Write);
            DownloadedLength = (int)m_fileStream.Length;
            ContentLength    = 0;
            m_downloadFileResult.downloadedLength    = DownloadedLength;
            m_downloadFileResult.downloadedLengthStr = HumanRead.HumanReadableFilesize(DownloadedLength);
        }
Esempio n. 3
0
 public void ReceiveContentLength(int contentLength)
 {
     ContentLength = contentLength + DownloadedLength;
     m_downloadFileResult.contentLength    = ContentLength;
     m_downloadFileResult.contentLengthStr = HumanRead.HumanReadableFilesize(ContentLength);
 }