/// <summary> /// handles the file copy /// </summary> private static void UBCopyFile() { string file; lock (UBCopySetup.DictonaryLocker) { file = UBCopySetup.FileList.Pop(); Log.DebugFormat("POP FILE: {0}", file); } if (String.IsNullOrEmpty(file)) { throw new Exception("File Name Cannot Be Null"); } var destinationfile = Path.Combine(UBCopySetup.Destinationfile, file.Replace(Path.GetPathRoot(file), "")); var fileSize = new FileInfo(file); Log.DebugFormat("File Size: {0}", fileSize.Length); lock (Locker) { UBCopySetup.BytesCopied += fileSize.Length; } if (fileSize.Length < UBCopySetup.SynchronousFileCopySize) { var asyncUnbufferedCopy = new AsyncUnbuffCopy(); asyncUnbufferedCopy.AsyncCopyFileUnbuffered(file, destinationfile, UBCopySetup.Overwritedestination, UBCopySetup.Movefile, UBCopySetup.Checksumfiles, UBCopySetup.Buffersize, UBCopySetup.Reportprogres, UBCopySetup.BytesSecond); } else { AsyncUnbuffCopyStatic.AsyncCopyFileUnbuffered(file, destinationfile, UBCopySetup.Overwritedestination, UBCopySetup.Movefile, UBCopySetup.Checksumfiles, UBCopySetup.Buffersize, UBCopySetup.Reportprogres, UBCopySetup.BytesSecond); } }
/// <summary> /// handles the file copy /// </summary> private static void UBCopyFile() { string file; lock (UBCopySetup.DictonaryLocker) { file = UBCopySetup.FileList.Pop(); Log.DebugFormat("POP FILE: {0}", file); } if (String.IsNullOrEmpty(file)) { throw new Exception("File Name Cannot Be Null"); } var destinationfile = Path.Combine(UBCopySetup.Destinationfile, file.Replace(Path.GetPathRoot(file), "")); var fileSize = new FileInfo(file); Log.DebugFormat("File Size: {0}", fileSize.Length); lock (Locker) { UBCopySetup.BytesCopied += fileSize.Length; } if (fileSize.Length < UBCopySetup.SynchronousFileCopySize) { var asyncUnbufferedCopy = new AsyncUnbuffCopy(); asyncUnbufferedCopy.AsyncCopyFileUnbuffered(file, destinationfile, UBCopySetup.Overwritedestination, UBCopySetup.Movefile, UBCopySetup.Checksumfiles, UBCopySetup.Buffersize, UBCopySetup.Reportprogres,UBCopySetup.BytesSecond); } else { AsyncUnbuffCopyStatic.AsyncCopyFileUnbuffered(file, destinationfile, UBCopySetup.Overwritedestination, UBCopySetup.Movefile, UBCopySetup.Checksumfiles, UBCopySetup.Buffersize, UBCopySetup.Reportprogres, UBCopySetup.BytesSecond); } }