예제 #1
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;
        }