Exemplo n.º 1
0
        /// <summary>
        /// Deletes the specified path.
        /// </summary>
        /// <param name="fileEntry">The file entry.</param>
        /// <exception cref="System.IO.IOException">If the command fails.</exception>
        /// <exception cref="System.ArgumentNullException">If device is null or if path is null or empty.</exception>

        public void Delete(FileEntry fileEntry)
        {
            Device.ThrowIfNull("Device");
            fileEntry.ThrowIfNull("fileEntry");
            if (fileEntry.Exists)
            {
                CommandErrorReceiver cer = new CommandErrorReceiver( );
                Device.ExecuteShellCommand("rm -f {0} {1}", cer, fileEntry.IsDirectory ? "-r" : String.Empty, fileEntry.FullResolvedPath);

                if (!String.IsNullOrEmpty(cer.ErrorMessage))
                {
                    throw new IOException(cer.ErrorMessage);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes the specified path.
        /// </summary>
        /// <param name="fileEntry">The file entry.</param>
        /// <exception cref="System.IO.IOException">If the command fails.</exception>
        public void Delete(FileEntry fileEntry)
        {
            /// <exception cref="System.ArgumentNullException">
            /// If device is null
            /// or
            /// If path is null or empty.
            /// </exception>
            Device.ThrowIfNull("Device");
            fileEntry.ThrowIfNull("fileEntry");
            if (fileEntry.Exists)
            {
                CommandErrorReceiver cer = new CommandErrorReceiver( );
                Device.ExecuteShellCommand("rm -f {0} {1}", cer, fileEntry.IsDirectory ? "-r" : String.Empty, fileEntry.FullResolvedPath);

                if (!String.IsNullOrEmpty(cer.ErrorMessage))
                {
                    throw new IOException(cer.ErrorMessage);
                }
            }
        }