mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 04:35:41 +00:00
Remove redundant throw of FileNotFoundException
OpenRead constructs a FileStream, this constructor throws the same exception
This commit is contained in:
parent
acf57bdfd6
commit
524f3ff092
@ -14,7 +14,7 @@ public static class FileInfoExtensions
|
|||||||
/// <typeparam name="T">A <see cref="HashAlgorithm" /> derived type.</typeparam>
|
/// <typeparam name="T">A <see cref="HashAlgorithm" /> derived type.</typeparam>
|
||||||
/// <returns>A <see cref="byte" /> array representing the hash of the file.</returns>
|
/// <returns>A <see cref="byte" /> array representing the hash of the file.</returns>
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception>
|
||||||
/// <exception cref="FileNotFoundException">The file pointed at by <paramref name="value" /> does not exist.</exception>
|
/// <exception cref="FileNotFoundException">The specified file was not found.</exception>
|
||||||
/// <exception cref="IOException">The opened file stream cannot be read.</exception>
|
/// <exception cref="IOException">The opened file stream cannot be read.</exception>
|
||||||
/// <exception cref="TypeInitializationException">
|
/// <exception cref="TypeInitializationException">
|
||||||
/// The specified <see cref="HashAlgorithm" /> does not offer a public, static. parameterless <c>Create</c> method, or its
|
/// The specified <see cref="HashAlgorithm" /> does not offer a public, static. parameterless <c>Create</c> method, or its
|
||||||
@ -29,11 +29,6 @@ public static class FileInfoExtensions
|
|||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value.Exists)
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException("Cannot get hash of non-existent file.", value.FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
using FileStream stream = value.OpenRead();
|
using FileStream stream = value.OpenRead();
|
||||||
return stream.GetHash<T>();
|
return stream.GetHash<T>();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user