Esempio n. 1
0
        /// <summary>
        /// 增量下载文件
        /// </summary>
        /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
        /// <param name="fileName">文件名</param>
        /// <param name="offset">从文件起始点的偏移量</param>
        /// <param name="length">要读取的字节数</param>
        /// <returns>文件内容</returns>
        public static byte[] DownloadFile(StorageNode storageNode, string fileName, long offset, long length)
        {
            FDFSRequest storageReqeust = DOWNLOAD_FILE.Instance.GetRequest(storageNode.EndPoint, offset, length, storageNode.GroupName, fileName);

            DOWNLOAD_FILE.Response storageResponse = new DOWNLOAD_FILE.Response(storageReqeust.GetResponse());
            return(storageResponse.Content);
        }
Esempio n. 2
0
        /// <summary>
        /// 下载文件
        /// </summary>
        /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
        /// <param name="fileName">文件名</param>
        /// <returns>文件内容</returns>
        public static byte[] DownloadFile(StorageNode storageNode, string fileName)
        {
            var storageReqeust = DOWNLOAD_FILE.Instance.GetRequest(storageNode.EndPoint, 0L, 0L, storageNode.GroupName, fileName);

            var storageResponse = new DOWNLOAD_FILE.Response(storageReqeust.GetResponse());

            return(storageResponse.Content);
        }
Esempio n. 3
0
 /// <summary>
 /// 增量下载文件
 /// </summary>
 /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
 /// <param name="fileName">文件名</param>
 /// <param name="offset">从文件起始点的偏移量</param>
 /// <param name="length">要读取的字节数</param>
 /// <returns>文件内容</returns>
 public static byte[] DownloadFile(StorageNode storageNode, string fileName, long offset, long length)
 {
     fileName = GetFileName(storageNode.GroupName, fileName);
     using (var storageReqeust = DOWNLOAD_FILE.CreateRequest(storageNode.EndPoint, offset, length, storageNode.GroupName, fileName))
     {
         var storageResponse = new DOWNLOAD_FILE.Response(storageReqeust.GetStorageResponse());
         return(storageResponse.Content);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 下载文件
 /// </summary>
 /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
 /// <param name="fileName">文件名</param>
 /// <exception cref="System.Exception">读取网络资源异常</exception>
 /// <returns>文件内容</returns>
 public static byte[] DownloadFile(StorageNode storageNode, string fileName)
 {
     fileName = GetFileName(storageNode.GroupName, fileName);
     using (var storageReqeust = DOWNLOAD_FILE.CreateRequest(storageNode.EndPoint, 0L, 0L, storageNode.GroupName, fileName))
     {
         // 同步下载
         var storageResponse = new DOWNLOAD_FILE.Response(storageReqeust.GetStorageResponse());
         if (storageResponse.Content == null)
         {
             throw new System.Exception(storageReqeust.Message);
         }
         return(storageResponse.Content);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 增量下载文件
 /// </summary>
 /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
 /// <param name="fileName">文件名</param>
 /// <param name="offset">从文件起始点的偏移量</param>
 /// <param name="length">要读取的字节数</param>
 /// <returns>文件内容</returns>
 public static byte[] DownloadFile(StorageNode storageNode, string fileName, long offset, long length)
 {
     FDFSRequest storageRequest = DOWNLOAD_FILE.Instance.GetRequest(storageNode.EndPoint, offset, length, storageNode.GroupName, fileName);
     DOWNLOAD_FILE.Response storageResponse = new DOWNLOAD_FILE.Response();
     storageRequest.GetResponse(storageResponse);
     return storageResponse.Content;
 }