Beispiel #1
0
        /// <summary>Determine the Copy or Move action.</summary>
        /// <exception cref="NotSupportedException"/>
        internal static bool IsCopyAction(CopyOptions?copyOptions, MoveOptions?moveOptions)
        {
            // Determine Copy or Move action.

            var isMove = Utils.IsNotNull(moveOptions) && Equals(null, copyOptions);
            var isCopy = !isMove && Utils.IsNotNull(copyOptions);

            if (isCopy.Equals(isMove))
            {
                throw new NotSupportedException(Resources.Cannot_Determine_Copy_Or_Move);
            }

            return(isCopy);
        }
        private CopyMoveResult CopyToMoveToCore(string destinationPath, CopyOptions?copyOptions, MoveOptions?moveOptions, CopyMoveProgressRoutine progressHandler, object userProgressData, out string longFullPath, PathFormat pathFormat)
        {
            string destinationPathLp = Path.GetExtendedLengthPathCore(null, destinationPath, pathFormat, GetFullPathOptions.TrimEnd | GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck);

            longFullPath = destinationPathLp;

            // Returns false when CopyMoveProgressResult is PROGRESS_CANCEL or PROGRESS_STOP.
            return(Directory.CopyMoveCore(Transaction, LongFullName, destinationPathLp, copyOptions, moveOptions, progressHandler, userProgressData, PathFormat.LongFullPath));
        }
Beispiel #3
0
        private CopyMoveResult CopyToMoveToCore(string destinationPath, bool preserveDates, CopyOptions?copyOptions, MoveOptions?moveOptions, CopyMoveProgressRoutine progressHandler, object userProgressData, out string longFullPath, PathFormat pathFormat)
        {
            // Allow null value for destinationPath when flag MoveOptions.DelayUntilReboot is specified.
            var delayUntilReboot = null == destinationPath && null != moveOptions && ((MoveOptions)moveOptions & MoveOptions.DelayUntilReboot) != 0;

            var destinationPathLp = longFullPath = delayUntilReboot
            ? null
            : Path.GetExtendedLengthPathCore(Transaction, destinationPath, pathFormat, GetFullPathOptions.TrimEnd | GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck);


            return(File.CopyMoveCore(false, Transaction, LongFullName, destinationPathLp, preserveDates, copyOptions, moveOptions, progressHandler, userProgressData, PathFormat.LongFullPath));
        }
Beispiel #4
0
        private CopyMoveResult CopyToMoveToCore(string destinationPath, bool preserveDates, CopyOptions?copyOptions, MoveOptions?moveOptions, CopyMoveProgressRoutine progressHandler, object userProgressData, out string longFullPath, PathFormat pathFormat)
        {
            longFullPath = Path.GetExtendedLengthPathCore(Transaction, destinationPath, pathFormat, GetFullPathOptions.TrimEnd | GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck);

            return(Directory.CopyMoveCore(Transaction, LongFullName, longFullPath, preserveDates, copyOptions, moveOptions, progressHandler, userProgressData, null, PathFormat.LongFullPath));
        }
Beispiel #5
0
 /// <summary>Checks if the <see cref="MoveOptions.DelayUntilReboot"/> flag is specified.</summary>
 internal static bool HasDelayUntilReboot(MoveOptions?moveOptions)
 {
     return(Utils.IsNotNull(moveOptions) && (moveOptions & MoveOptions.DelayUntilReboot) != 0);
 }
Beispiel #6
0
 /// <summary>Checks if the <see cref="MoveOptions.ReplaceExisting"/> flag is specified.</summary>
 internal static bool CanOverwrite(MoveOptions?moveOptions)
 {
     return(Utils.IsNotNull(moveOptions) && (moveOptions & MoveOptions.ReplaceExisting) != 0);
 }
Beispiel #7
0
 /// <summary>Checks if the <see cref="MoveOptions.CopyAllowed"/> flag is specified.</summary>
 internal static bool AllowEmulate(MoveOptions?moveOptions)
 {
     return(Utils.IsNotNull(moveOptions) && (moveOptions & MoveOptions.CopyAllowed) != 0);
 }