Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Ramstack.FileProviders.Composition/ChangeTokenComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class ChangeTokenComposer
/// </remarks>
/// <param name="changeToken">The <see cref="IChangeToken"/> to flatten.</param>
/// <returns>
/// An <see cref="IChangeToken"/> representing the flattened version from the specified <see cref="IChangeToken"/>.
/// An <see cref="IChangeToken"/> representing the flattened version of the specified <see cref="IChangeToken"/>.
/// </returns>
public static IChangeToken Flatten(this IChangeToken changeToken) =>
FlattenChangeToken(changeToken);
Expand All @@ -31,7 +31,7 @@ public static IChangeToken Flatten(this IChangeToken changeToken) =>
/// </remarks>
/// <param name="changeToken">The <see cref="IChangeToken"/> to flatten.</param>
/// <returns>
/// An <see cref="IChangeToken"/> representing the flattened version from the specified <see cref="IChangeToken"/>.
/// An <see cref="IChangeToken"/> representing the flattened version of the specified <see cref="IChangeToken"/>.
/// </returns>
public static IChangeToken FlattenChangeToken(IChangeToken changeToken)
{
Expand Down Expand Up @@ -65,7 +65,7 @@ public static IChangeToken FlattenChangeToken(IChangeToken changeToken)
/// </remarks>
/// <param name="changeTokens">The list of <see cref="IChangeToken"/> instances to compose and flatten.</param>
/// <returns>
/// An <see cref="IChangeToken"/> representing the flattened version from the specified list of tokens.
/// An <see cref="IChangeToken"/> representing the flattened version of the specified list of tokens.
/// </returns>
public static IChangeToken ComposeChangeTokens(params IChangeToken[] changeTokens) =>
ComposeChangeTokens((IReadOnlyList<IChangeToken>)changeTokens);
Expand All @@ -78,7 +78,7 @@ public static IChangeToken ComposeChangeTokens(params IChangeToken[] changeToken
/// </remarks>
/// <param name="changeTokens">The list of <see cref="IChangeToken"/> instances to compose and flatten.</param>
/// <returns>
/// An <see cref="IChangeToken"/> representing the flattened version from the specified list of tokens.
/// An <see cref="IChangeToken"/> representing the flattened version of the specified list of tokens.
/// </returns>
public static IChangeToken ComposeChangeTokens(IReadOnlyList<IChangeToken> changeTokens)
{
Expand Down Expand Up @@ -120,7 +120,7 @@ public static IChangeToken ComposeChangeTokens(IReadOnlyList<IChangeToken> chang
/// </remarks>
/// <param name="changeTokens">The list of <see cref="IChangeToken"/> instances to compose and flatten.</param>
/// <returns>
/// An <see cref="IChangeToken"/> representing the flattened version from the specified list of tokens.
/// An <see cref="IChangeToken"/> representing the flattened version of the specified list of tokens.
/// </returns>
public static IChangeToken ComposeChangeTokens(IEnumerable<IChangeToken> changeTokens)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class FileProviderComposer
/// </remarks>
/// <param name="provider">The <see cref="IFileProvider"/> to flatten.</param>
/// <returns>
/// An <see cref="IFileProvider"/> representing the flattened version from the specified <see cref="IFileProvider"/>.
/// An <see cref="IFileProvider"/> representing the flattened version of the specified <see cref="IFileProvider"/>.
/// </returns>
public static IFileProvider Flatten(this IFileProvider provider) =>
FlattenProvider(provider);
Expand All @@ -30,7 +30,7 @@ public static IFileProvider Flatten(this IFileProvider provider) =>
/// </remarks>
/// <param name="provider">The <see cref="IFileProvider"/> to flatten.</param>
/// <returns>
/// An <see cref="IFileProvider"/> representing the flattened version from the specified <see cref="IFileProvider"/>.
/// An <see cref="IFileProvider"/> representing the flattened version of the specified <see cref="IFileProvider"/>.
/// </returns>
public static IFileProvider FlattenProvider(IFileProvider provider)
{
Expand Down Expand Up @@ -64,7 +64,7 @@ public static IFileProvider FlattenProvider(IFileProvider provider)
/// </remarks>
/// <param name="providers">The list of <see cref="IFileProvider"/> instances to compose and flatten.</param>
/// <returns>
/// An <see cref="IFileProvider"/> representing the flattened version from the specified list of providers.
/// An <see cref="IFileProvider"/> representing the flattened version of the specified list of providers.
/// </returns>
public static IFileProvider ComposeProviders(params IFileProvider[] providers) =>
ComposeProviders(providers.AsEnumerable());
Expand All @@ -77,7 +77,7 @@ public static IFileProvider ComposeProviders(params IFileProvider[] providers) =
/// </remarks>
/// <param name="providers">The list of <see cref="IFileProvider"/> instances to compose and flatten.</param>
/// <returns>
/// An <see cref="IFileProvider"/> representing the flattened version from the specified list of providers.
/// An <see cref="IFileProvider"/> representing the flattened version of the specified list of providers.
/// </returns>
public static IFileProvider ComposeProviders(IEnumerable<IFileProvider> providers)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Ramstack.FileProviders.Extensions/DirectoryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class DirectoryNode : FileNodeBase
public bool IsRoot => FullName == "/";

/// <summary>
/// Gets an <see cref="DirectoryNode"/> instance representing the root directory.
/// Gets a <see cref="DirectoryNode"/> instance representing the root directory.
/// </summary>
public DirectoryNode Root
{
Expand All @@ -29,7 +29,7 @@ public DirectoryNode Root
}

/// <summary>
/// Gets an <see cref="DirectoryNode"/> instance representing the parent directory.
/// Gets a <see cref="DirectoryNode"/> instance representing the parent directory.
/// </summary>
public DirectoryNode? Parent
{
Expand Down Expand Up @@ -103,7 +103,7 @@ public IEnumerable<FileNode> EnumerateFiles()
}

/// <summary>
/// Returns an enumerable collection of files in the current directory.
/// Returns an enumerable collection of directories in the current directory.
/// </summary>
/// <returns>
/// An enumerable collection of directories in the current directory.
Expand Down
16 changes: 8 additions & 8 deletions src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Ramstack.FileProviders;

/// <summary>
/// Provides extension methods for <see cref="DirectoryNode"/> class.
/// Provides extension methods for the <see cref="DirectoryNode"/> class.
/// </summary>
public static class DirectoryNodeExtensions
{
Expand Down Expand Up @@ -40,7 +40,7 @@ public static class DirectoryNodeExtensions
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -100,7 +100,7 @@ public static IEnumerable<FileNode> EnumerateFiles(this DirectoryNode directory,
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -172,7 +172,7 @@ public static IEnumerable<FileNode> EnumerateFiles(this DirectoryNode directory,
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -207,7 +207,7 @@ public static IEnumerable<DirectoryNode> EnumerateDirectories(this DirectoryNode
/// <param name="patterns">An array of glob patterns to match against the names of directories.</param>
/// <param name="excludes">An optional array of glob patterns to exclude directories.</param>
/// <returns>
/// An enumerable collection of directories in the specified that match any of the given glob patterns.
/// An enumerable collection of directories in the specified directory that match any of the given glob patterns.
/// </returns>
/// <remarks>
/// Glob pattern:
Expand All @@ -232,7 +232,7 @@ public static IEnumerable<DirectoryNode> EnumerateDirectories(this DirectoryNode
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -305,7 +305,7 @@ public static IEnumerable<DirectoryNode> EnumerateDirectories(this DirectoryNode
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -365,7 +365,7 @@ public static IEnumerable<FileNodeBase> EnumerateFileNodes(this DirectoryNode di
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down
27 changes: 13 additions & 14 deletions src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ namespace Ramstack.FileProviders;
public static class FileInfoExtensions
{
/// <summary>
/// Returns file contents as readonly stream.
/// Returns file contents as a read-only stream.
/// </summary>
/// <param name="file">The <see cref="IFileInfo"/>.</param>
/// <returns>
/// The file contents as readonly stream.
/// The file contents as a read-only stream.
/// </returns>
public static Stream OpenRead(this IFileInfo file) =>
file.CreateReadStream();
Expand Down Expand Up @@ -130,7 +130,7 @@ static byte[] ReadAllBytesUnknownLengthImpl(Stream stream)
}

/// <summary>
/// Asynchronously reads all the text in the current file with the specified encoding.
/// Asynchronously reads all the text in the current file.
/// </summary>
/// <param name="file">The file from which to read the entire text content.</param>
/// <param name="cancellationToken">An optional cancellation token to cancel the operation.</param>
Expand All @@ -139,7 +139,7 @@ static byte[] ReadAllBytesUnknownLengthImpl(Stream stream)
/// containing the full text from the current file.
/// </returns>
public static ValueTask<string> ReadAllTextAsync(this IFileInfo file, CancellationToken cancellationToken = default) =>
ReadAllTextAsync(file, Encoding.UTF8, cancellationToken);
ReadAllTextAsync(file, null, cancellationToken);

/// <summary>
/// Asynchronously reads all the text in the current file with the specified encoding.
Expand Down Expand Up @@ -297,20 +297,19 @@ static async ValueTask<byte[]> ReadAllBytesUnknownLengthImplAsync(Stream stream,
}
}

private static byte[] ResizeBuffer(byte[] bytes)
private static byte[] ResizeBuffer(byte[] oldArray)
{
var length = (uint)bytes.Length * 2;
if (length > (uint)Array.MaxLength)
length = (uint)Math.Max(Array.MaxLength, bytes.Length + 1);
var length = oldArray.Length * 2;
if ((uint)length > (uint)Array.MaxLength)
length = Math.Max(Array.MaxLength, oldArray.Length + 1);

var tmp = ArrayPool<byte>.Shared.Rent((int)length);
Buffer.BlockCopy(bytes, 0, tmp, 0, bytes.Length);
var newArray = ArrayPool<byte>.Shared.Rent(length);

var rented = bytes;
bytes = tmp;
Debug.Assert(oldArray.Length <= newArray.Length);
oldArray.AsSpan().TryCopyTo(newArray);

ArrayPool<byte>.Shared.Return(rented);
return bytes;
ArrayPool<byte>.Shared.Return(oldArray);
return newArray;
}

private static long GetStreamLength(Stream stream)
Expand Down
2 changes: 1 addition & 1 deletion src/Ramstack.FileProviders.Extensions/FileNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public sealed class FileNode : FileNodeBase
public DateTimeOffset LastWriteTime => _file.LastModified;

/// <summary>
/// Gets an <see cref="DirectoryNode"/> instance representing the parent directory.
/// Gets a <see cref="DirectoryNode"/> instance representing the parent directory.
/// </summary>
public DirectoryNode Directory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static byte[] ReadAllBytes(this FileNode file) =>
file.ToFileInfo().ReadAllBytes();

/// <summary>
/// Asynchronously reads all the text in the current file with the specified encoding.
/// Asynchronously reads all the text in the current file.
/// </summary>
/// <param name="file">The file from which to read the entire text content.</param>
/// <param name="cancellationToken">An optional cancellation token to cancel the operation.</param>
Expand Down
4 changes: 2 additions & 2 deletions src/Ramstack.FileProviders.Extensions/FilePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ public static ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char> path)
}

/// <summary>
/// Determines if the specified path in a normalized form.
/// Determines whether the specified path is in a normalized form.
/// </summary>
/// <param name="path">The path to test.</param>
/// <returns>
/// <see langword="true" /> if the path in a normalized form;
/// <see langword="true" /> if the path is in a normalized form;
/// otherwise, <see langword="false" />.
/// </returns>
public static bool IsNormalized(ReadOnlySpan<char> path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static IEnumerable<FileNodeBase> EnumerateFileNodes(this IFileProvider pr
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -129,7 +129,7 @@ public static IEnumerable<FileNode> EnumerateFiles(this IFileProvider provider,
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -190,7 +190,7 @@ public static IEnumerable<FileNode> EnumerateFiles(this IFileProvider provider,
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -251,7 +251,7 @@ public static IEnumerable<DirectoryNode> EnumerateDirectories(this IFileProvider
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -312,7 +312,7 @@ public static IEnumerable<DirectoryNode> EnumerateDirectories(this IFileProvider
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down Expand Up @@ -341,7 +341,7 @@ public static IEnumerable<FileNodeBase> EnumerateFileNodes(this IFileProvider pr
provider.GetDirectory(path).EnumerateFileNodes(pattern, exclude);

/// <summary>
/// Returns an enumerable collection of file nodes in the specified directory that match any of the provided glob patterns.
/// Returns an enumerable collection of file nodes in the specified directory that match any of the given glob patterns.
/// </summary>
/// <param name="provider">The file provider to use.</param>
/// <param name="path">The path of the directory from which to retrieve file nodes.</param>
Expand Down Expand Up @@ -373,7 +373,7 @@ public static IEnumerable<FileNodeBase> EnumerateFileNodes(this IFileProvider pr
/// </item>
/// <item>
/// <description>
/// Brace patterns are supported, including nested brace pattern:
/// Brace patterns are supported, including nested brace patterns:
/// <c>{file,dir,name}</c>, <c>{file-1.{c,cpp},file-2.{cs,f}}</c>
/// </description>
/// </item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace Ramstack.FileProviders;
public static partial class FileProviderExtensions
{
/// <summary>
/// Returns file contents as readonly stream.
/// Returns file contents as a read-only stream.
/// </summary>
/// <param name="provider">The <see cref="IFileProvider"/>.</param>
/// <param name="path">The path of the file to open.</param>
/// <returns>
/// The file contents as readonly stream.
/// The file contents as a read-only stream.
/// </returns>
public static Stream OpenRead(this IFileProvider provider, string path) =>
provider.GetFileInfo(path).OpenRead();
Expand Down Expand Up @@ -66,7 +66,7 @@ public static byte[] ReadAllBytes(this IFileProvider provider, string path) =>
provider.GetFileInfo(path).ReadAllBytes();

/// <summary>
/// Asynchronously reads all the text in the current file with the specified encoding.
/// Asynchronously reads all the text in the current file.
/// </summary>
/// <param name="provider">The <see cref="IFileProvider"/>.</param>
/// <param name="path">The path of the file to read from.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Ramstack.FileProviders;
/// </summary>
/// <remarks>
/// The <see cref="GlobbingFileProvider"/> class wraps around another <see cref="IFileProvider"/> and applies glob-based
/// filtering rules to determine, which files to include or exclude. This allows for flexible and powerful file selection
/// filtering rules to determine which files to include or exclude. This allows for flexible and powerful file selection
/// using standard glob patterns.
/// </remarks>
/// <example>
Expand Down
2 changes: 1 addition & 1 deletion src/Ramstack.FileProviders.Globbing/Internal/PathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static class PathHelper
/// <summary>
/// Determines whether the specified path matches any of the specified patterns.
/// </summary>
/// <param name="path">The path to match for a match.</param>
/// <param name="path">The path to check for a match.</param>
/// <param name="patterns">An array of patterns to match against the path.</param>
/// <returns>
/// <see langword="true" /> if the path matches any of the patterns;
Expand Down
Loading