Example #1
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();
     }
 }
Example #2
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);
     }
 }