Esempio n. 1
0
        protected virtual bool breakOnCopierError(FileCopierService cf, Exception e)
        {
            bool isRetry = false;

            if (!skipAllCopierErrors)
            {
                pauseTimer();

                var ed = new FileCopierErrorDialog(cf, e);

                if (ed.Show())
                {
                    skipAllCopierErrors = ed.RememberChoice == 1;

                    isRetry = ed.ClickedButtonNumber == 0;
                }
                else
                {
                    IsCanceled = true;

                    isRetry = false;
                }

                resumeTimer();
            }

            return !isRetry;
        }
Esempio n. 2
0
        protected virtual bool copyFile(string sourcePath, string destinationPath)
        {
            bool isBreak = false;
            bool isDone = false;
            bool isHasError = false;

            FileCopierService cf = null;

            while (!isBreak && !isDone && canExecute())
            {
                isHasError = false;

                try
                {
                    cf = new FileCopierService(sourcePath, destinationPath);

                    cf.Start();

                    while (cf.CopyBlock() && canExecute())
                    {
                        alreadyByteCopy += cf.LastBlockTransferBytes;

                        setText(MsgStr.MsgCopyOrMoveToPath + getStatusMessage());
                    }

                    isDone = true;
                }
                catch (Exception e)
                {
                    isHasError = true;
                    isBreak = breakOnCopierError(cf, e);
                }
                finally
                {
                    if (cf != null) cf.Finish(IsCanceled || isHasError);
                }
            }

            return isDone;
        }
 public FileCopierErrorDialog(FileCopierService fc, Exception error)
     : base(error, true)
 {
     _fileCopier = fc;
 }