Example #1
0
        /// <summary>
        /// Deletes a file or directory including read only directories or files.
        /// </summary>
        /// <param name="fileOrDirectory">File or directory to delete.</param>
        /// <exception cref="ArgumentNullException">When file or direcory is null.</exception>
        public static void DeleteFileSystemInfo(this FileSystemInfo fileOrDirectory)
        {
            if (fileOrDirectory == null)
            {
                throw new ArgumentNullException("fileOrDirectory");
            }
            FileInfoWrapper fiw = new FileInfoWrapper(fileOrDirectory);

            fiw.DeleteFileSystemInfo();
        }
Example #2
0
        /// <summary>
        /// Computes and returns SHA1 hash of the file.
        /// </summary>
        /// <param name="file">File on which to compute the hash.</param>
        /// <exception cref="ArgumentNullException">When file is null.</exception>
        /// <exception cref="FileNotFoundException">Whne file does not exist.</exception>
        /// <returns>SHA1 hash of the file.</returns>
        public static string ComputeSHA1(this FileInfo file)
        {
            var fileInfo = new FileInfoWrapper(file);

            return(fileInfo.ComputeSHA1());
        }