AsyncCopyFileUnbuffered() public méthode

public AsyncCopyFileUnbuffered ( string inputfile, string outputfile, bool overwrite, bool movefile, bool checksum, int buffersize, bool reportprogress, int bytessecond ) : int
inputfile string
outputfile string
overwrite bool
movefile bool
checksum bool
buffersize int
reportprogress bool
bytessecond int
Résultat int
Exemple #1
0
        /// <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);
            }
        }