public RemoteFileInfo GetRemoteFileInfo(DownloadFileInfo file) { RemoteFileInfo remoteFileInfo = new RemoteFileInfo(); remoteFileInfo.AcceptRanges = true; FtpWebRequest request = (FtpWebRequest)m_WebRequestManager.GetWebRequest(file); request.Method = WebRequestMethods.Ftp.GetFileSize; using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) { remoteFileInfo.FileSize = response.ContentLength; } request = (FtpWebRequest)m_WebRequestManager.GetWebRequest(file); request.Method = WebRequestMethods.Ftp.GetDateTimestamp; using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) { remoteFileInfo.LastModified = response.LastModified; } return(remoteFileInfo); }
public RemoteFileInfo GetRemoteFileInfo(DownloadFileInfo file) { RemoteFileInfo remoteFileInfo = new RemoteFileInfo(); WebRequest webRequest = m_WebRequestManager.GetWebRequest(file); webRequest.Method = "HEAD"; HttpWebResponse httpWebResponse = (HttpWebResponse)webRequest.GetResponse(); remoteFileInfo.LastModified = httpWebResponse.LastModified; remoteFileInfo.MimeType = httpWebResponse.ContentType; remoteFileInfo.FileSize = httpWebResponse.ContentLength; remoteFileInfo.AcceptRanges = string.Compare(httpWebResponse.Headers["Accept-Ranges"], "bytes", StringComparison.OrdinalIgnoreCase) == 0; return(remoteFileInfo); }