public void Move(string sourceFileName, string destFileName) { Guard.NotNull(sourceFileName, nameof(sourceFileName)); Guard.NotNull(destFileName, nameof(destFileName)); AssertFileNameIsNotEmpty(sourceFileName); AssertFileNameIsNotEmpty(destFileName); AbsolutePath sourcePath = owner.ToAbsolutePath(sourceFileName); AbsolutePath destinationPath = owner.ToAbsolutePath(destFileName); var handler = new FileMoveHandler(container); var arguments = new EntryMoveArguments(sourcePath, destinationPath); handler.Handle(arguments); if (handler.IsCopyRequired) { InnerCopy(sourceFileName, destFileName, false, true); if (handler.IsSourceReadOnly) { var setAttributesHandler = new FileSetAttributesHandler(container); var setAttributeArguments = new FileSetAttributesArguments(sourcePath, FileAttributes.Normal, FileAccessKinds.Attributes | FileAccessKinds.Read); setAttributesHandler.Handle(setAttributeArguments); } Delete(sourceFileName); } }
public void SetAttributes(string path, FileAttributes fileAttributes) { Guard.NotNull(path, nameof(path)); AbsolutePath absolutePath = owner.ToAbsolutePath(path); var handler = new FileSetAttributesHandler(root); var arguments = new FileSetAttributesArguments(absolutePath, fileAttributes); handler.Handle(arguments); }