From dbc37b858ced78fd2bc0a11b75662af4ab53393f Mon Sep 17 00:00:00 2001 From: rameel Date: Thu, 2 Apr 2026 02:34:26 +0500 Subject: [PATCH 1/4] Polish xml-comments and fix typos --- .../DirectoryNode.cs | 2 +- .../DirectoryNodeExtensions.cs | 2 +- .../FileInfoExtensions.cs | 19 +++++++++---------- .../FilePath.cs | 4 ++-- .../Internal/PathHelper.cs | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs b/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs index 4cec2e1..df14226 100644 --- a/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs +++ b/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs @@ -103,7 +103,7 @@ public IEnumerable EnumerateFiles() } /// - /// Returns an enumerable collection of files in the current directory. + /// Returns an enumerable collection of directories in the current directory. /// /// /// An enumerable collection of directories in the current directory. diff --git a/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs b/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs index 75bbd43..d0623b9 100644 --- a/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs @@ -207,7 +207,7 @@ public static IEnumerable EnumerateDirectories(this DirectoryNode /// An array of glob patterns to match against the names of directories. /// An optional array of glob patterns to exclude directories. /// - /// 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. /// /// /// Glob pattern: diff --git a/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs b/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs index 4f03be5..8f89d6d 100644 --- a/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs @@ -297,20 +297,19 @@ static async ValueTask 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.Shared.Rent((int)length); - Buffer.BlockCopy(bytes, 0, tmp, 0, bytes.Length); + var newArray = ArrayPool.Shared.Rent(length); - var rented = bytes; - bytes = tmp; + Debug.Assert(oldArray.Length <= newArray.Length); + oldArray.AsSpan().TryCopyTo(newArray); - ArrayPool.Shared.Return(rented); - return bytes; + ArrayPool.Shared.Return(oldArray); + return newArray; } private static long GetStreamLength(Stream stream) diff --git a/src/Ramstack.FileProviders.Extensions/FilePath.cs b/src/Ramstack.FileProviders.Extensions/FilePath.cs index ee299fc..c6031e4 100644 --- a/src/Ramstack.FileProviders.Extensions/FilePath.cs +++ b/src/Ramstack.FileProviders.Extensions/FilePath.cs @@ -156,11 +156,11 @@ public static ReadOnlySpan GetDirectoryName(ReadOnlySpan path) } /// - /// Determines if the specified path in a normalized form. + /// Determines whether the specified path is in a normalized form. /// /// The path to test. /// - /// if the path in a normalized form; + /// if the path is in a normalized form; /// otherwise, . /// public static bool IsNormalized(ReadOnlySpan path) diff --git a/src/Ramstack.FileProviders.Globbing/Internal/PathHelper.cs b/src/Ramstack.FileProviders.Globbing/Internal/PathHelper.cs index c6fd6c5..0a9c116 100644 --- a/src/Ramstack.FileProviders.Globbing/Internal/PathHelper.cs +++ b/src/Ramstack.FileProviders.Globbing/Internal/PathHelper.cs @@ -17,7 +17,7 @@ internal static class PathHelper /// /// Determines whether the specified path matches any of the specified patterns. /// - /// The path to match for a match. + /// The path to check for a match. /// An array of patterns to match against the path. /// /// if the path matches any of the patterns; From 5a31f528213769d4924ce90d2736a701c5ab23b3 Mon Sep 17 00:00:00 2001 From: rameel Date: Thu, 2 Apr 2026 03:20:33 +0500 Subject: [PATCH 2/4] Refine xml-comments --- src/Ramstack.FileProviders.Extensions/DirectoryNode.cs | 4 ++-- .../FileInfoExtensions.cs | 8 ++++---- src/Ramstack.FileProviders.Extensions/FileNode.cs | 2 +- .../FileNodeExtensions.cs | 2 +- .../FileProviderExtensions.cs | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs b/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs index df14226..62eb40a 100644 --- a/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs +++ b/src/Ramstack.FileProviders.Extensions/DirectoryNode.cs @@ -14,7 +14,7 @@ public sealed class DirectoryNode : FileNodeBase public bool IsRoot => FullName == "/"; /// - /// Gets an instance representing the root directory. + /// Gets a instance representing the root directory. /// public DirectoryNode Root { @@ -29,7 +29,7 @@ public DirectoryNode Root } /// - /// Gets an instance representing the parent directory. + /// Gets a instance representing the parent directory. /// public DirectoryNode? Parent { diff --git a/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs b/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs index 8f89d6d..5679723 100644 --- a/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/FileInfoExtensions.cs @@ -9,11 +9,11 @@ namespace Ramstack.FileProviders; public static class FileInfoExtensions { /// - /// Returns file contents as readonly stream. + /// Returns file contents as a read-only stream. /// /// The . /// - /// The file contents as readonly stream. + /// The file contents as a read-only stream. /// public static Stream OpenRead(this IFileInfo file) => file.CreateReadStream(); @@ -130,7 +130,7 @@ static byte[] ReadAllBytesUnknownLengthImpl(Stream stream) } /// - /// Asynchronously reads all the text in the current file with the specified encoding. + /// Asynchronously reads all the text in the current file. /// /// The file from which to read the entire text content. /// An optional cancellation token to cancel the operation. @@ -139,7 +139,7 @@ static byte[] ReadAllBytesUnknownLengthImpl(Stream stream) /// containing the full text from the current file. /// public static ValueTask ReadAllTextAsync(this IFileInfo file, CancellationToken cancellationToken = default) => - ReadAllTextAsync(file, Encoding.UTF8, cancellationToken); + ReadAllTextAsync(file, null, cancellationToken); /// /// Asynchronously reads all the text in the current file with the specified encoding. diff --git a/src/Ramstack.FileProviders.Extensions/FileNode.cs b/src/Ramstack.FileProviders.Extensions/FileNode.cs index adf3c4f..cb19b80 100644 --- a/src/Ramstack.FileProviders.Extensions/FileNode.cs +++ b/src/Ramstack.FileProviders.Extensions/FileNode.cs @@ -28,7 +28,7 @@ public sealed class FileNode : FileNodeBase public DateTimeOffset LastWriteTime => _file.LastModified; /// - /// Gets an instance representing the parent directory. + /// Gets a instance representing the parent directory. /// public DirectoryNode Directory { diff --git a/src/Ramstack.FileProviders.Extensions/FileNodeExtensions.cs b/src/Ramstack.FileProviders.Extensions/FileNodeExtensions.cs index 9704702..bc8efd0 100644 --- a/src/Ramstack.FileProviders.Extensions/FileNodeExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/FileNodeExtensions.cs @@ -40,7 +40,7 @@ public static byte[] ReadAllBytes(this FileNode file) => file.ToFileInfo().ReadAllBytes(); /// - /// Asynchronously reads all the text in the current file with the specified encoding. + /// Asynchronously reads all the text in the current file. /// /// The file from which to read the entire text content. /// An optional cancellation token to cancel the operation. diff --git a/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.cs b/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.cs index 36e9049..6377474 100644 --- a/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.cs @@ -8,12 +8,12 @@ namespace Ramstack.FileProviders; public static partial class FileProviderExtensions { /// - /// Returns file contents as readonly stream. + /// Returns file contents as a read-only stream. /// /// The . /// The path of the file to open. /// - /// The file contents as readonly stream. + /// The file contents as a read-only stream. /// public static Stream OpenRead(this IFileProvider provider, string path) => provider.GetFileInfo(path).OpenRead(); @@ -66,7 +66,7 @@ public static byte[] ReadAllBytes(this IFileProvider provider, string path) => provider.GetFileInfo(path).ReadAllBytes(); /// - /// Asynchronously reads all the text in the current file with the specified encoding. + /// Asynchronously reads all the text in the current file. /// /// The . /// The path of the file to read from. From 3b36961183609e227fe2f33a493b1785386e5ff9 Mon Sep 17 00:00:00 2001 From: rameel Date: Thu, 2 Apr 2026 03:27:39 +0500 Subject: [PATCH 3/4] Polish xml-comments and fix typos --- .../DirectoryNodeExtensions.cs | 14 +++++++------- .../FileProviderExtensions.Enumeration.cs | 14 +++++++------- .../GlobbingFileProvider.cs | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs b/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs index d0623b9..3ceef8a 100644 --- a/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs +++ b/src/Ramstack.FileProviders.Extensions/DirectoryNodeExtensions.cs @@ -4,7 +4,7 @@ namespace Ramstack.FileProviders; /// -/// Provides extension methods for class. +/// Provides extension methods for the class. /// public static class DirectoryNodeExtensions { @@ -40,7 +40,7 @@ public static class DirectoryNodeExtensions /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -100,7 +100,7 @@ public static IEnumerable EnumerateFiles(this DirectoryNode directory, /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -172,7 +172,7 @@ public static IEnumerable EnumerateFiles(this DirectoryNode directory, /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -232,7 +232,7 @@ public static IEnumerable EnumerateDirectories(this DirectoryNode /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -305,7 +305,7 @@ public static IEnumerable EnumerateDirectories(this DirectoryNode /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -365,7 +365,7 @@ public static IEnumerable EnumerateFileNodes(this DirectoryNode di /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// diff --git a/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.Enumeration.cs b/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.Enumeration.cs index 30ed0b9..e42ab74 100644 --- a/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.Enumeration.cs +++ b/src/Ramstack.FileProviders.Extensions/FileProviderExtensions.Enumeration.cs @@ -68,7 +68,7 @@ public static IEnumerable EnumerateFileNodes(this IFileProvider pr /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -129,7 +129,7 @@ public static IEnumerable EnumerateFiles(this IFileProvider provider, /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -190,7 +190,7 @@ public static IEnumerable EnumerateFiles(this IFileProvider provider, /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -251,7 +251,7 @@ public static IEnumerable EnumerateDirectories(this IFileProvider /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -312,7 +312,7 @@ public static IEnumerable EnumerateDirectories(this IFileProvider /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// @@ -341,7 +341,7 @@ public static IEnumerable EnumerateFileNodes(this IFileProvider pr provider.GetDirectory(path).EnumerateFileNodes(pattern, exclude); /// - /// 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. /// /// The file provider to use. /// The path of the directory from which to retrieve file nodes. @@ -373,7 +373,7 @@ public static IEnumerable EnumerateFileNodes(this IFileProvider pr /// /// /// - /// Brace patterns are supported, including nested brace pattern: + /// Brace patterns are supported, including nested brace patterns: /// {file,dir,name}, {file-1.{c,cpp},file-2.{cs,f}} /// /// diff --git a/src/Ramstack.FileProviders.Globbing/GlobbingFileProvider.cs b/src/Ramstack.FileProviders.Globbing/GlobbingFileProvider.cs index 89f8986..74a4b89 100644 --- a/src/Ramstack.FileProviders.Globbing/GlobbingFileProvider.cs +++ b/src/Ramstack.FileProviders.Globbing/GlobbingFileProvider.cs @@ -7,7 +7,7 @@ namespace Ramstack.FileProviders; /// /// /// The class wraps around another 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. /// /// From a169d6bd6ae5042f6f037c4985aaddf2fceff13e Mon Sep 17 00:00:00 2001 From: rameel Date: Thu, 2 Apr 2026 03:42:10 +0500 Subject: [PATCH 4/4] Polish xml-comments --- .../ChangeTokenComposer.cs | 10 +++++----- .../FileProviderComposer.cs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Ramstack.FileProviders.Composition/ChangeTokenComposer.cs b/src/Ramstack.FileProviders.Composition/ChangeTokenComposer.cs index f938784..c26325f 100644 --- a/src/Ramstack.FileProviders.Composition/ChangeTokenComposer.cs +++ b/src/Ramstack.FileProviders.Composition/ChangeTokenComposer.cs @@ -17,7 +17,7 @@ public static class ChangeTokenComposer /// /// The to flatten. /// - /// An representing the flattened version from the specified . + /// An representing the flattened version of the specified . /// public static IChangeToken Flatten(this IChangeToken changeToken) => FlattenChangeToken(changeToken); @@ -31,7 +31,7 @@ public static IChangeToken Flatten(this IChangeToken changeToken) => /// /// The to flatten. /// - /// An representing the flattened version from the specified . + /// An representing the flattened version of the specified . /// public static IChangeToken FlattenChangeToken(IChangeToken changeToken) { @@ -65,7 +65,7 @@ public static IChangeToken FlattenChangeToken(IChangeToken changeToken) /// /// The list of instances to compose and flatten. /// - /// An representing the flattened version from the specified list of tokens. + /// An representing the flattened version of the specified list of tokens. /// public static IChangeToken ComposeChangeTokens(params IChangeToken[] changeTokens) => ComposeChangeTokens((IReadOnlyList)changeTokens); @@ -78,7 +78,7 @@ public static IChangeToken ComposeChangeTokens(params IChangeToken[] changeToken /// /// The list of instances to compose and flatten. /// - /// An representing the flattened version from the specified list of tokens. + /// An representing the flattened version of the specified list of tokens. /// public static IChangeToken ComposeChangeTokens(IReadOnlyList changeTokens) { @@ -120,7 +120,7 @@ public static IChangeToken ComposeChangeTokens(IReadOnlyList chang /// /// The list of instances to compose and flatten. /// - /// An representing the flattened version from the specified list of tokens. + /// An representing the flattened version of the specified list of tokens. /// public static IChangeToken ComposeChangeTokens(IEnumerable changeTokens) { diff --git a/src/Ramstack.FileProviders.Composition/FileProviderComposer.cs b/src/Ramstack.FileProviders.Composition/FileProviderComposer.cs index ac1d134..e33afc1 100644 --- a/src/Ramstack.FileProviders.Composition/FileProviderComposer.cs +++ b/src/Ramstack.FileProviders.Composition/FileProviderComposer.cs @@ -16,7 +16,7 @@ public static class FileProviderComposer /// /// The to flatten. /// - /// An representing the flattened version from the specified . + /// An representing the flattened version of the specified . /// public static IFileProvider Flatten(this IFileProvider provider) => FlattenProvider(provider); @@ -30,7 +30,7 @@ public static IFileProvider Flatten(this IFileProvider provider) => /// /// The to flatten. /// - /// An representing the flattened version from the specified . + /// An representing the flattened version of the specified . /// public static IFileProvider FlattenProvider(IFileProvider provider) { @@ -64,7 +64,7 @@ public static IFileProvider FlattenProvider(IFileProvider provider) /// /// The list of instances to compose and flatten. /// - /// An representing the flattened version from the specified list of providers. + /// An representing the flattened version of the specified list of providers. /// public static IFileProvider ComposeProviders(params IFileProvider[] providers) => ComposeProviders(providers.AsEnumerable()); @@ -77,7 +77,7 @@ public static IFileProvider ComposeProviders(params IFileProvider[] providers) = /// /// The list of instances to compose and flatten. /// - /// An representing the flattened version from the specified list of providers. + /// An representing the flattened version of the specified list of providers. /// public static IFileProvider ComposeProviders(IEnumerable providers) {