Ejemplo n.º 1
0
        public void BeginRetreive(ILocation sourceLocation, Action<byte[]> bufferCallback, Action copyDone)
        {
            var ftpRequest = new FtpDownloadRequest (BufferSize);
            ftpRequest.Buffering += bufferCallback;
            ftpRequest.CopyDone += copyDone;

            GetFileSize (sourceLocation, ftpRequest);
            BeginDownload (sourceLocation, ftpRequest);
        }
Ejemplo n.º 2
0
        private void BeginDownload(ILocation source, FtpDownloadRequest ftpRequest)
        {
            ftpRequest.Request = CreateRequest (source.ItemUri, WebRequestMethods.Ftp.DownloadFile, Credentials);
            ftpRequest.Response = (FtpWebResponse)ftpRequest.Request.GetResponse ();

            ftpRequest.FileStream = ftpRequest.Response.GetResponseStream ();
            ftpRequest.Buffer = new byte[BufferSize];

            Debug.Assert (ftpRequest.FileStream != null, "FileStream shall be not null.");
            ftpRequest.FileStream.BeginRead (ftpRequest.Buffer, 0, BufferSize, DownloadCallback, ftpRequest);
        }
Ejemplo n.º 3
0
 private void GetFileSize(ILocation source, FtpDownloadRequest ftpRequest)
 {
     ftpRequest.Request = CreateRequest (source.ItemUri, WebRequestMethods.Ftp.GetFileSize, Credentials);
     using (var response = ftpRequest.Request.GetResponse())
         ftpRequest.FileSize = response.ContentLength;
 }
Ejemplo n.º 4
0
        public override long GetSize(ILocation location)
        {
            if (!location.IsFolder) {
                var ftpRequest = new FtpDownloadRequest (BufferSize);
                GetFileSize (location, ftpRequest);

                return ftpRequest.FileSize;
            } else
                throw new NotImplementedException ();
        }