public void Delete(string path)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(path));
            ThrowIfDisposed();

            using (var shellItem = ShellItem.FromParsingName(path))
            {
                this.fileOperation.DeleteItem(shellItem.ShellItemInterface, null);
            }
        }
Ejemplo n.º 2
0
        public void AddPlace(string path, FileDialogAddPlaceLocation location)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(path));

            if (this.FileDialogNative != null)
            {
                var shellItem = ShellItem.FromParsingName(path);
                this.FileDialogNative.AddPlace(shellItem.ShellItemInterface, (FDAP)location);
            }
        }
        public void CreateFolder(string destination, string newFolderName)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(destination));
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(newFolderName));
            ThrowIfDisposed();

            using (var destinationItem = ShellItem.FromParsingName(destination))
            {
                this.fileOperation.NewItem(
                    destinationItem.ShellItemInterface,
                    FileAttributes.Directory,
                    newFolderName,
                    null,
                    null);
            }
        }
        public void New(string destination, FileAttributes fileAttributes, string newName, string templateName)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(destination));
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(newName));
            ThrowIfDisposed();

            using (var destinationItem = ShellItem.FromParsingName(destination))
            {
                this.fileOperation.NewItem(
                    destinationItem.ShellItemInterface,
                    fileAttributes,
                    newName,
                    templateName,
                    null);
            }
        }
        public void Move(string source, string destination)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(source));
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(destination));
            ThrowIfDisposed();

            using (var sourceItem = ShellItem.FromParsingName(source))
                using (var destinationItem = ShellItem.FromParsingName(destination))
                {
                    this.fileOperation.MoveItem(
                        sourceItem.ShellItemInterface,
                        destinationItem.ShellItemInterface,
                        Path.GetFileName(sourceItem.GetParsingName()),
                        null);
                }
        }
        /// <summary>
        ///     <paramref name="source" />で指定したファイルまたはフォルダーを
        ///     <paramref name="destination" />で指定したフォルダーにコピーします。
        ///     <para>
        ///         コピー先のファイルまたはフォルダー名を<paramref name="copyName" />に変更します。
        ///     </para>
        /// </summary>
        /// <param name="source"></param>
        /// <param name="destination"></param>
        /// <param name="copyName"></param>
        public void Copy(string source, string destination, string copyName)
        {
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(source));
            Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(destination));
            ThrowIfDisposed();

            using (var sourceItem = ShellItem.FromParsingName(source))
                using (var destinationItem = ShellItem.FromParsingName(destination))
                {
                    this.fileOperation.CopyItem(
                        sourceItem.ShellItemInterface,
                        destinationItem.ShellItemInterface,
                        copyName,
                        null);
                }
        }