소스 검색

Factoring out CanParallel

Source commit: f61b9f52df00549ce4591cbe59b06b8adabd280c
Martin Prikryl 8 년 전
부모
커밋
adf22ff8dd
2개의 변경된 파일15개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 7
      source/core/Terminal.cpp
  2. 1 0
      source/core/Terminal.h

+ 14 - 7
source/core/Terminal.cpp

@@ -6023,6 +6023,18 @@ int __fastcall TTerminal::CopyToRemoteParallel(TParallelOperation * ParallelOper
   return Result;
 }
 //---------------------------------------------------------------------------
+bool __fastcall TTerminal::CanParallel(
+  const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation)
+{
+  return
+    (ParallelOperation != NULL) &&
+    FFileSystem->IsCapable(fsParallelTransfers) &&
+    // parallel transfer is not implemented for operations needed to be done on a folder
+    // after all its files are processed
+    FLAGCLEAR(Params, cpDelete) &&
+    (!CopyParam->PreserveTime || !CopyParam->PreserveTimeDirs);
+}
+//---------------------------------------------------------------------------
 bool __fastcall TTerminal::CopyToRemote(TStrings * FilesToCopy,
   const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation)
 {
@@ -6037,13 +6049,8 @@ bool __fastcall TTerminal::CopyToRemote(TStrings * FilesToCopy,
   {
     __int64 Size;
     std::unique_ptr<TStringList> Files;
-    if ((ParallelOperation != NULL) &&
-        FFileSystem->IsCapable(fsParallelTransfers) &&
-        // parallel upload is not implemented for operations needed to be done on a folder
-        // after all its files are processed
-        FLAGCLEAR(Params, cpDelete) &&
-        !CopyParam->ClearArchive &&
-        (!CopyParam->PreserveTime || !CopyParam->PreserveTimeDirs))
+    if (CanParallel(CopyParam, Params, ParallelOperation) &&
+        !CopyParam->ClearArchive)
     {
       Files.reset(new TStringList());
       Files->OwnsObjects = true;

+ 1 - 0
source/core/Terminal.h

@@ -398,6 +398,7 @@ protected:
     const UnicodeString & FileName, TFileOperation Operation1, TFileOperation Operation2 = foNone);
   bool __fastcall CanRecurseToDirectory(const TRemoteFile * File);
   bool __fastcall DoOnCustomCommand(const UnicodeString & Command);
+  bool __fastcall CanParallel(const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation);
 
   __property TFileOperationProgressType * OperationProgress = { read=FOperationProgress };