/// <inheritdoc /> public async Task MoveAsync( IStorageFolder destinationFolder, string desiredNewName, NameCollisionOption option) { if (!this.Exists) { throw new StorageItemNotFoundException(this.Name, "Cannot move a file that does not exist."); } if (destinationFolder == null) { throw new ArgumentNullException(nameof(destinationFolder)); } if (!destinationFolder.Exists) { throw new StorageItemNotFoundException( destinationFolder.Name, "Cannot move a file to a folder that does not exist."); } if (string.IsNullOrWhiteSpace(desiredNewName)) { throw new ArgumentNullException(nameof(desiredNewName)); } var storageFolder = await Windows.Storage.StorageFolder.GetFolderFromPathAsync(System.IO.Path.GetDirectoryName(destinationFolder.Path)); await this.file.MoveAsync(storageFolder, desiredNewName, option.ToNameCollisionOption()); this.Parent = destinationFolder; }
/// <inheritdoc /> public async Task RenameAsync(string desiredName, NameCollisionOption option) { if (!this.Exists) { throw new StorageItemNotFoundException(this.Name, "Cannot rename a folder that does not exist."); } if (string.IsNullOrWhiteSpace(desiredName)) { throw new ArgumentNullException(nameof(desiredName)); } await this.folder.RenameAsync(desiredName, option.ToNameCollisionOption()); }