Beispiel #1
0
        /// <summary>
        /// A function that can be used as CopyProgressRoutine delegate and is passed into the win32 method
        /// </summary>
        /// <param name="TotalFileSize"></param>
        /// <param name="TotalBytesTransferred"></param>
        /// <param name="StreamSize"></param>
        /// <param name="StreamBytesTransferred"></param>
        /// <param name="notUsed"></param>
        /// <param name="CallbackReason"></param>
        /// <param name="sourceFileHandle"></param>
        /// <param name="destinationFileHandle"></param>
        /// <param name="notUsed2"></param>
        /// <returns></returns>
        private CopyProgressResult CopyProgressFunc(
            long TotalFileSize,
            long TotalBytesTransferred,
            long StreamSize,
            long StreamBytesTransferred,
            uint notUsed,
            CopyProgressCallbackReason CallbackReason,
            IntPtr sourceFileHandle,
            IntPtr destinationFileHandle,
            IntPtr notUsed2
            )
        {
            var streamSize       = StreamSize;
            var streamBytesTrans = StreamBytesTransferred;

            _totalFileSize = TotalFileSize;
            var progressResult = CopyProgressResult.PROGRESS_CONTINUE;

            if (CallbackReason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
            {
                var fileMoveEventArgs = new FileMoveProgressArgs(TotalFileSize, TotalBytesTransferred);
                ProgressCallback(fileMoveEventArgs);

                if (fileMoveEventArgs.Cancelled)
                {
                    progressResult = CopyProgressResult.PROGRESS_CANCEL;
                }
            }
            return(progressResult);
        }
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     switch (reason)
     {
         case CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED:
             m_dtElapsedTime = DateTime.Now - m_dtStartTime;
             EventCopyHandler(this, new CopyEventArgs(((double)transferred / total) * 100, (transferred / 1024) / m_dtElapsedTime.TotalSeconds));
             return m_bCancel ? CopyProgressResult.PROGRESS_CANCEL : CopyProgressResult.PROGRESS_CONTINUE;
         default:
             return CopyProgressResult.PROGRESS_CONTINUE;
     }
 }
Beispiel #3
0
 public CopyProgressResult CopyProgressRoutine(
     long TotalFileSize,
     long TotalBytesTransferred,
     long StreamSize,
     long StreamBytesTransferred,
     uint dwStreamNumber,
     CopyProgressCallbackReason dwCallbackReason,
     IntPtr hSourceFile,
     IntPtr hDestinationFile,
     IntPtr lpData)
 {
     return(progressUpdate(State, TotalFileSize, TotalBytesTransferred));
 }
		private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
		{
			if (_nMilisecondPeriodToDelay < DateTime.Now.Subtract(_dtLastDelay).TotalMilliseconds)
			{
				_dtLastDelay = DateTime.Now;
				nIndex++;
				System.Threading.Thread.Sleep(_nDelay);
			}
			//_nChunkIndx++;
			//if (_nChunkIndx % _nChanksPeriodToDelay == 0)
			//	System.Threading.Thread.Sleep(_nDelay);
			return CopyProgressResult.PROGRESS_CONTINUE;
		}
Beispiel #5
0
 private CopyProgressResult CancelableCopyProgressRoutine(
     long TotalFileSize,
     long TotalBytesTransferred,
     long StreamSize,
     long StreamBytesTransferred,
     uint dwStreamNumber,
     CopyProgressCallbackReason dwCallbackReason,
     IntPtr hSourceFile,
     IntPtr hDestinationFile,
     IntPtr lpData)
 {
     return(cancel ? CopyProgressResult.PROGRESS_CANCEL :
            CopyProgressResult.PROGRESS_CONTINUE);
 }
Beispiel #6
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
                                                       CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
            {
                OnProgressChanged(transferred, total);
            }

            if (transferred >= total)
            {
                OnCompleted();
            }

            return(CopyProgressResult.PROGRESS_CONTINUE);
        }
Beispiel #7
0
        int copyProgress(long totalFileSize, long totalBytesTransferred, long streamSize,
                         long streamBytesTransferred, int streamNumber, CopyProgressCallbackReason callbackReason,
                         IntPtr sourceFile, IntPtr destinationFile, IntPtr data)
        {
            int fileProgress = (int)((100 * totalBytesTransferred) / totalFileSize);

            GCHandle h = GCHandle.FromIntPtr(data);
            CancellableOperationProgressBase progress = (CancellableOperationProgressBase)h.Target;

            if (fileProgress != progress.ItemProgress)
            {
                progress.ItemProgress = fileProgress;
            }

            CopyFileCallbackAction action = progress.CancellationToken.IsCancellationRequested ? CopyFileCallbackAction.CANCEL : CopyFileCallbackAction.CONTINUE;

            return((int)action);
        }
Beispiel #8
0
        private CopyProgressResult CopyProgressRoutineImpl(
            long totalFileSize,
            long totalBytesTransferred,
            long streamSize,
            long streamBytesTransferred,
            uint dwStreamNumber,
            CopyProgressCallbackReason dwCallbackReason,
            IntPtr hSourceFile,
            IntPtr hDestinationFile,
            IntPtr lpData)
        {
            var current = totalBytesTransferred - _transferred;

            if (current > 1000000)
            {
                _progress?.Invoke(current, totalBytesTransferred);
                _transferred = totalBytesTransferred;
            }

            return(CopyProgressResult.PROGRESS_CONTINUE);
        }
Beispiel #9
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
                                                       CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            CopyProgressResult result = CopyProgressResult.PROGRESS_CONTINUE;

            if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
            {
                result = OnProgressChanged((transferred / (double)total) * 100.0);
            }

            if (transferred >= total)
            {
                OnCompleted();
            }

            if (result == CopyProgressResult.PROGRESS_CANCEL)
            {
                IsCancelled = 1;
            }
            return(result);
        }
Beispiel #10
0
        private CopyProgressResult CopyProgressRoutineInternal(long TotalFileSize, long TotalBytesTransferred,
                                                               long StreamSize, long StreamBytesTransferred, uint dwStreamNumber,
                                                               CopyProgressCallbackReason dwCallbackReason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            if (FileCopyProgress != null)
            {
                FileCopyProgress(new FileCopyProgressEventArgs
                {
                    TransferredBytes   = TotalBytesTransferred,
                    TotalBytes         = TotalFileSize,
                    SourceFile         = sourceFile,
                    DestinationFile    = destinationFile,
                    ProgressPercentage = (int)((double)TotalBytesTransferred / TotalFileSize * 100)
                });
            }

            if (TotalFileSize == TotalBytesTransferred)
            {
                if (FileCopyCompleted != null)
                {
                    FileCopyCompleted(new FileCopyCompletedEventArgs
                    {
                        CopiedFiles     = copiedFiles,
                        TotalFiles      = totalFiles,
                        SourceFile      = sourceFile,
                        DestinationFile = destinationFile
                    });
                }
            }

            if (cancelCopyOperation)
            {
                CopyCancelled();
                return(CopyProgressResult.PROGRESS_CANCEL);
            }
            else
            {
                return(CopyProgressResult.PROGRESS_CONTINUE);
            }
        }
Beispiel #11
0
 private CopyProgressResult CopyProgressHandler(
     long totalFileSize,
     long totalBytesTransferred,
     long streamSize,
     long streamBytesTransferred,
     uint streamNumber,
     CopyProgressCallbackReason callbackReason,
     IntPtr sourceFileHandle,
     IntPtr destinationFileHandle,
     IntPtr dataPtr)
 {
     if (callbackReason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
     {
         bool cancel;
         OnProgressChanged((double)totalBytesTransferred / totalFileSize * 100, out cancel);
         if (cancel)
         {
             return(CopyProgressResult.PROGRESS_CANCEL);
         }
     }
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
 /// <summary>
 /// Delegate which will be called by Win32 API for progress change
 /// </summary>
 /// <param name="total">the total size</param>
 /// <param name="transferred">the transferrred size</param>
 /// <param name="streamSize">size of the stream</param>
 /// <param name="streamByteTrans"></param>
 /// <param name="dwStreamNumber">stream number</param>
 /// <param name="reason">reason for callback</param>
 /// <param name="hSourceFile">the source file handle</param>
 /// <param name="hDestinationFile">the destination file handle</param>
 /// <param name="lpData">data passed by users</param>
 /// <returns>indicating whether to continue or do somthing else.</returns>
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
                                                CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     //when a chunk is finished call the progress changed.
     if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
     {
         OnProgressChanged((transferred / (double)total) * 100.0);
     }
     //transfer completed
     if (transferred >= total)
     {
         if (CloseHandle(hDestinationFile))
         {
             OnCompleted(CopyCompletedType.Succeeded, null);
         }
         else
         {
             OnCompleted(CopyCompletedType.Exception,
                         new System.IO.IOException("Unable to close the file handle"));
         }
     }
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
Beispiel #13
0
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     //Debug.WriteLine("Total: " + total);
     Total = total;
     //Debug.WriteLine("Transferred: " + transferred);
     Transferred = transferred;
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
Beispiel #14
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            while (!_bCancelCopying && (_bPause || _bPauseFile))
            {
                System.Threading.Thread.Sleep(300);
            }

            if (_bCancelCopying)
            {
                return(CopyProgressResult.PROGRESS_CANCEL);
            }

            _nTotalSize = total;
            if (transferred >= total)  //transfer completed
            {
                //if file is read only, remove read-only attribute(case to handle CD drive import)
                //FileAttributes attr = File.GetAttributes(destinationFilePath);
                //if ((attr & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                //{
                //    attr = attr & ~FileAttributes.ReadOnly;
                //    File.SetAttributes(destinationFilePath, attr);
                //}
                _nProgressPercent = 100F;
                bCompleted        = true;
                if (null != _OnProgressChanged)
                {
                    _OnProgressChanged(_nProgressPercent);
                }
            }
            else
            {
                if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
                {
                    //_nChunkIndx++;
                    //if (_nChunkIndx % _nChunksPeriod == 0)    // можно раз во сколько-то чанков что-то делать
                    //   {}
                    if (transferred > _nBytesNextPoint)    // а лучше раз во сколько-то байт
                    {
                        _nBytesNextPoint += _nBytesPeriod;
                        _nProgressPercent = (float)((transferred / (double)total) * 100.0);
                        if (null != _OnProgressChanged)
                        {
                            _OnProgressChanged(_nProgressPercent);
                        }
                    }

                    if (_nMilisecondPeriodToDelay > 0 && _dtNextDelay < DateTime.Now) // а можно раз во сколько-то миллисекунд что-то делать
                    {
                        _nDelayTotal += _nDelay;
                        System.Threading.Thread.Sleep(_nDelay);
                        _dtNextDelay = DateTime.Now.AddMilliseconds(_nMilisecondPeriodToDelay);
                    }
                }
            }
            return(CopyProgressResult.PROGRESS_CONTINUE);
        }
Beispiel #15
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            // Mikant
            int currentProgress = (int)((transferred / (float)total) * 100);

            if (this.InvokeRequired)
            {
                this.Invoke(UpdateUI, currentProgress);
            }
            else
            {
                UpdateUI(currentProgress);
            }
            // !Mikant

            return(CopyProgressResult.PROGRESS_CONTINUE);
        }
Beispiel #16
0
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize,
     long StreamByteTrans, uint dwStreamNumber,
     CopyProgressCallbackReason reason,
     IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     // notify client
     SendProgressChangedMessage(currentSource, currentDestination, total, transferred);
     return CopyProgressResult.PROGRESS_CONTINUE;
 }
Beispiel #17
0
    private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
    {
        double percentage = transferred * 100.0 / total;

        OnProgressChanged(percentage);

        return(CopyProgressResult.PROGRESS_CONTINUE);
    }
Beispiel #18
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
                                                       CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
                OnProgressChanged((transferred / (double)total) * 100.0);

            if (transferred >= total)
                OnCompleted();

            return CopyProgressResult.PROGRESS_CONTINUE;
        }
Beispiel #19
0
        private CopyProgressResult CopyProgressHandler(Int64 total, Int64 transferred, Int64 streamSize, Int64 StreamByteTrans, UInt32 dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            //Check to see if there is a dialog window to use
            if (digWindow != null)
            {
                //Are we going to send the update on the correct thread?
                if (digWindow.SynchronizationObject != null && digWindow.SynchronizationObject.InvokeRequired)
                {
                    digWindow.SynchronizationObject.Invoke(new CopyProgressRoutine(CopyProgressHandler),
                                new Object[] { total, transferred, streamSize, StreamByteTrans, dwStreamNumber, reason, hSourceFile, hDestinationFile, lpData });
                }
                else
                {
                    digWindow.update(totalFiles, totalFilesCopied, total, transferred, currentFilename);
                }

            }
            return CopyProgressResult.PROGRESS_CONTINUE;
        }
Beispiel #20
0
        /// <summary>
        /// Delegate which will be called by Win32 API for progress change
        /// </summary>
        /// <param name="total">the total size</param>
        /// <param name="transferred">the transferrred size</param>
        /// <param name="streamSize">size of the stream</param>
        /// <param name="streamByteTrans"></param>
        /// <param name="dwStreamNumber">stream number</param>
        /// <param name="reason">reason for callback</param>
        /// <param name="hSourceFile">the source file handle</param>
        /// <param name="hDestinationFile">the destination file handle</param>
        /// <param name="lpData">data passed by users</param>
        /// <returns>indicating whether to continue or do somthing else.</returns>
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
                                                       CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            //when a chunk is finished call the progress changed.
            if (reason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
            {
                OnProgressChanged((transferred / (double)total) * 100.0);
            }

            //transfer completed
            if (transferred >= total)
            {
                if (CloseHandle(hDestinationFile))
                {
                    OnCompleted(CopyCompletedType.Succeeded, null);
                }
                else
                {
                    OnCompleted(CopyCompletedType.Exception,
                        new System.IO.IOException("Unable to close the file handle"));
                }
            }

            return CopyProgressResult.PROGRESS_CONTINUE;
        }
 private CopyProgressResult CopyProgressHandler(Int64 total, Int64 transferred, Int64 streamSize, Int64 StreamByteTrans, UInt32 dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     //Check to see if there is a dialog window to use
     if (_digWindow != null)
     {
         //Are we going to send the update on the correct thread?
         if (_digWindow.SynchronizationObject != null && _digWindow.SynchronizationObject.InvokeRequired)
         {
             _digWindow.SynchronizationObject.Invoke(new CopyProgressRoutine(CopyProgressHandler),
                                                     new Object[] { total, transferred, streamSize, StreamByteTrans, dwStreamNumber, reason, hSourceFile, hDestinationFile, lpData });
         }
         else
         {
             _digWindow.Update(_totalFiles, _totalFilesCopied, total, transferred, _currentFilename);
         }
     }
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     return CopyProgressResult.PROGRESS_CONTINUE;
 }
Beispiel #23
0
        /// <summary>
        /// CopyProgressRoutineHandler gives the progress of the file currently being copied
        /// </summary>
        /// <param name="TotalFileSize">Total size of the file in bytes</param>
        /// <param name="TotalBytesTransferred">The size in bytes that has been copied</param>
        /// <param name="StreamSize">Total Size in bytes of the current stream that is being copied</param>
        /// <param name="StreamBytesTransferred">The size in bytes that has been copied</param>
        /// <param name="dwStreamNumber"></param>
        /// <param name="dwCallbackReason"></param>
        /// <param name="hSourceFile">Pointer to the Source File</param>
        /// <param name="hDestinationFile">Pointer to the Destination File</param>
        /// <param name="lpData"></param>
        /// <returns>Returns the progress status of the file being copied</returns>
        private CopyProgressResult CopyProgressRoutineHandler(Int64 TotalFileSize, Int64 TotalBytesTransferred, Int64 StreamSize,
                                                              Int64 StreamBytesTransferred, UInt32 StreamNumber, CopyProgressCallbackReason CallbackReason, IntPtr SourceFile,
                                                              IntPtr DestinationFile, IntPtr Data)
        {
            resetEvent.WaitOne();
            switch (CallbackReason)
            {
            case CopyProgressCallbackReason.CallbackChunkedFinished:
                this.copiedSize += TotalBytesTransferred - previousCopiedSize;
                RaiseFileCopyProgressEvent(this.CurrentFile, TotalBytesTransferred, TotalFileSize);
                this.RaiseCopyProgressEvent();
                previousCopiedSize = TotalBytesTransferred;
                break;

            case CopyProgressCallbackReason.CallbackStreamSwitch:
                break;

            default:
                break;
            }

            return((skip) ? CopyProgressResult.ProgressCancel : CopyProgressResult.ProgressContinue);
        }
Beispiel #24
0
 private CopyProgressResult CopyProgressHandler(
     long totalFileSize,
     long totalBytesTransferred,
     long streamSize,
     long streamBytesTransferred,
     uint streamNumber,
     CopyProgressCallbackReason callbackReason,
     IntPtr sourceFileHandle,
     IntPtr destinationFileHandle,
     IntPtr dataPtr)
 {
     if (callbackReason == CopyProgressCallbackReason.CALLBACK_CHUNK_FINISHED)
     {
         bool cancel;
         OnProgressChanged((double)totalBytesTransferred / totalFileSize * 100, out cancel);
         if (cancel)
         {
             return CopyProgressResult.PROGRESS_CANCEL;
         }
     }
     return CopyProgressResult.PROGRESS_CONTINUE;
 }
Beispiel #25
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            long percent = (transferred * 100) / total;

            updateProgress(percent);
            Application.DoEvents();
            if (cancelouCopia)
            {
                return(CopyProgressResult.PROGRESS_CANCEL);
            }
            else
            {
                return(CopyProgressResult.PROGRESS_CONTINUE);
            }
        }
Beispiel #26
0
 /// <summary>
 ///     Default handler for <see cref="XCopy" />.
 /// </summary>
 /// <param name="total"></param>
 /// <param name="transferred"></param>
 /// <param name="streamSize"></param>
 /// <param name="StreamByteTrans"></param>
 /// <param name="dwStreamNumber"></param>
 /// <param name="reason"></param>
 /// <param name="hSourceFile"></param>
 /// <param name="hDestinationFile"></param>
 /// <param name="lpData"></param>
 /// <returns></returns>
 public static CopyProgressResult CopyProgressHandler(Int64 total, Int64 transferred, Int64 streamSize, Int64 StreamByteTrans, DWORD dwStreamNumber,
                                                      CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData) =>
 CopyProgressResult.PROGRESS_CONTINUE;
Beispiel #27
0
 private static CopyProgressResult EmptyCopyProgressHandler(
     long total, long transferred, long streamSize, long streamByteTrans, uint dwStreamNumber,
     CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
Beispiel #28
0
        private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
        {
            //calculate progress
            int iProgress;

            iProgress = (int)(((float)transferred / (float)total) * 100);
            Progress(this, new ProgressEventArgs(iProgress));
            return(CopyProgressResult.PROGRESS_CONTINUE);
        }
Beispiel #29
0
        int copyProgress(long totalFileSize, long totalBytesTransferred, long streamSize,
            long streamBytesTransferred, int streamNumber, CopyProgressCallbackReason callbackReason,
            IntPtr sourceFile, IntPtr destinationFile, IntPtr data)
        {

            int fileProgress = (int)((100 * totalBytesTransferred) / totalFileSize);

            GCHandle h = GCHandle.FromIntPtr(data);
            CancellableOperationProgressBase progress = (CancellableOperationProgressBase)h.Target;

            if (fileProgress != progress.ItemProgress)
            {
                progress.ItemProgress = fileProgress;
            }

            CopyFileCallbackAction action = progress.CancellationToken.IsCancellationRequested ? CopyFileCallbackAction.CANCEL : CopyFileCallbackAction.CONTINUE;

            return ((int)action);

        }
Beispiel #30
0
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     if (_pbCancel == 0)
     {
         float progress = 100 * transferred / total;
         _Copy_Progress(progress);
         _trasferedSize(transferred);
         return(CopyProgressResult.PROGRESS_CONTINUE);
     }
     else
     {
         return(CopyProgressResult.PROGRESS_CANCEL);
     }
 }
Beispiel #31
0
 private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize,
                                                long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile,
                                                IntPtr hDestinationFile, IntPtr lpData)
 {
     OnPropertyChanged(transferred, _fileName);
     return(CopyProgressResult.PROGRESS_CONTINUE);
 }
Beispiel #32
0
 private CopyProgressResult CopyProgress(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
 {
     if (this.progress(total, transferred))
     {
         return(CopyProgressResult.PROGRESS_CONTINUE);
     }
     else
     {
         return(CopyProgressResult.PROGRESS_CANCEL);
     }
 }