Exemplo n.º 1
0
        public static async Task RemoveFileAsync(string groupName, string fileName)
        {
            var buffer = await QUERY_UPDATE.Instance.GetRequest(new object[] { groupName, fileName }).GetResponseAsync();

            var response = new QUERY_UPDATE.Response(buffer);
            var point    = new IPEndPoint(IPAddress.Parse(response.IPStr), response.Port);
            await DELETE_FILE.Instance.GetRequest(new object[] { point, groupName, fileName }).GetResponseAsync();
        }
Exemplo n.º 2
0
        public static void RemoveFile(string groupName, string fileName)
        {
            QUERY_UPDATE.Response response =
                new QUERY_UPDATE.Response(
                    QUERY_UPDATE.Instance.GetRequest(new object[] { groupName, fileName }).GetResponse());
            IPEndPoint point = new IPEndPoint(IPAddress.Parse(response.IPStr), response.Port);

            DELETE_FILE.Instance.GetRequest(new object[] { point, groupName, fileName }).GetResponse();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="groupName">组名</param>
        /// <param name="fileName">文件名</param>
        public static void RemoveFile(string groupName, string fileName)
        {
            FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, fileName);

            QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetResponse());
            IPEndPoint            storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);
            FDFSRequest           storageReqeust  = DELETE_FILE.Instance.GetRequest(storeEndPoint, groupName, fileName);

            storageReqeust.GetResponse();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 附加文件
        /// </summary>
        /// <param name="groupName">组名</param>
        /// <param name="fileName">文件名</param>
        /// <param name="contentByte">文件内容</param>
        public static void AppendFile(string groupName, string fileName, byte[] contentByte)
        {
            FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, fileName);

            QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetResponse());
            IPEndPoint            storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);

            FDFSRequest storageReqeust = APPEND_FILE.Instance.GetRequest(storeEndPoint, fileName, contentByte);

            storageReqeust.GetResponse();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 上传从文件
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="contentByte">文件内容</param>
        /// <param name="masterFilename">主文件名</param>
        /// <param name="prefixName">从文件后缀</param>
        /// <param name="fileExt">文件扩展名(注意:不包含".")</param>
        /// <returns>文件名</returns>
        public static string UploadSlaveFile(string groupName, byte[] contentByte, string masterFilename, string prefixName, string fileExt)
        {
            FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, masterFilename);

            QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetResponse());
            IPEndPoint            storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);

            FDFSRequest storageReqeust = UPLOAD_SLAVE_FILE.Instance.GetRequest(storeEndPoint, contentByte.Length, masterFilename, prefixName, fileExt, contentByte);

            UPLOAD_FILE.Response storageResponse = new UPLOAD_FILE.Response(storageReqeust.GetResponse());
            return(storageResponse.FileName);
        }
Exemplo n.º 6
0
 public static void AppendFile(string groupName, string fileName, byte[] contentByte)
 {
     fileName = GetFileName(groupName, fileName);
     using (var updateFile = new QUERY_UPDATE())
     {
         var trackerRequest  = updateFile.GetRequest(groupName, fileName);
         var trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetTrackerResponse());
         var storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IpStr), trackerResponse.Port);
         var storageReqeust  = APPEND_FILE.Instance.GetRequest(storeEndPoint, fileName, contentByte);
         storageReqeust.GetStorageResponse();
     }
 }
Exemplo n.º 7
0
 public static string UploadSlaveFile(string groupName, byte[] contentByte, string masterFilename, string prefixName, string fileExt)
 {
     using (var updateFile = new QUERY_UPDATE())
     {
         var trackerRequest  = updateFile.GetRequest(groupName, masterFilename);
         var trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetTrackerResponse());
         var storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IpStr), trackerResponse.Port);
         var storageReqeust  = UPLOAD_SLAVE_FILE.Instance.GetRequest(storeEndPoint, contentByte.Length, masterFilename, prefixName, fileExt, contentByte);
         var storageResponse = new UPLOAD_FILE.Response(storageReqeust.GetStorageResponse());
         return(storageResponse.FileName);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 删除文件
 /// </summary>
 /// <param name="groupName">组名</param>
 /// <param name="fileName">文件名</param>
 public static void RemoveFile(string groupName, string fileName)
 {
     fileName = GetFileName(groupName, fileName);
     using (var trackerRequest = QUERY_UPDATE.CreateRequest(groupName, fileName))
     {
         var trackerResponse = new QUERY_UPDATE.Response(trackerRequest.GetTrackerResponse());
         var storeEndPoint   = new IPEndPoint(IPAddress.Parse(trackerResponse.IpStr), trackerResponse.Port);
         using (var storageReqeust = DELETE_FILE.CreateRequest(storeEndPoint, groupName, fileName))
         {
             byte[] responseByte = storageReqeust.GetStorageResponse();
             string result       = Util.ByteToString(responseByte).TrimEnd('\0');
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// 上传从文件
        /// </summary>
        /// <param name="storageNode">GetStorageNode方法返回的存储节点</param>
        /// <param name="contentByte">文件内容</param>
        /// <param name="master_filename">主文件名</param>
        /// <param name="prefix_name">从文件后缀</param>
        /// <param name="fileExt">文件扩展名(注意:不包含".")</param>
        /// <returns>文件名</returns>
        public static string UploadSlaveFile(string groupName, byte[] contentByte, string master_filename, string prefix_name, string fileExt)
        {
            FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, master_filename);
            QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response();
            trackerRequest.GetResponse(trackerResponse);
            IPEndPoint storeEndPoint = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);

            FDFSRequest storageRequest = UPLOAD_SLAVE_FILE.Instance.GetRequest(storeEndPoint, contentByte.Length, master_filename, prefix_name, fileExt, contentByte);
            UPLOAD_FILE.Response storageResponse = new UPLOAD_FILE.Response();
            storageRequest.GetResponse(storageResponse);
            return storageResponse.FileName;
        }
Exemplo n.º 10
0
 /// <summary>
 /// 删除文件
 /// </summary>
 /// <param name="groupName">组名</param>
 /// <param name="fileName">文件名</param>
 public static void RemoveFile(string groupName, string fileName)
 {
     FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, fileName);
     QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response();
     trackerRequest.GetResponse(trackerResponse);
     IPEndPoint storeEndPoint = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);
     FDFSRequest storageRequest = DELETE_FILE.Instance.GetRequest(storeEndPoint, groupName, fileName);
     storageRequest.GetResponse();
 }
Exemplo n.º 11
0
        /// <summary>
        /// 附加文件
        /// </summary>
        /// <param name="groupName">组名</param>
        /// <param name="fileName">文件名</param>
        /// <param name="contentByte">文件内容</param>
        public static void AppendFile(string groupName, string fileName, byte[] contentByte)
        {
            FDFSRequest trackerRequest = QUERY_UPDATE.Instance.GetRequest(groupName, fileName);
            QUERY_UPDATE.Response trackerResponse = new QUERY_UPDATE.Response();
            trackerRequest.GetResponse(trackerResponse);
            IPEndPoint storeEndPoint = new IPEndPoint(IPAddress.Parse(trackerResponse.IPStr), trackerResponse.Port);

            FDFSRequest storageRequest = APPEND_FILE.Instance.GetRequest(storeEndPoint, fileName, contentByte);
            storageRequest.GetResponse();
        }