diff --git a/src/Ramstack.FileSystem.Abstractions/README.md b/src/Ramstack.FileSystem.Abstractions/README.md index 1cd9524..2704042 100644 --- a/src/Ramstack.FileSystem.Abstractions/README.md +++ b/src/Ramstack.FileSystem.Abstractions/README.md @@ -83,7 +83,7 @@ Console.WriteLine(await reader.ReadToEndAsync()); ### VirtualDirectory -The `VirtualDirectory` class provides properties and methods for creating, deleting, and enumerating directories and subdirectories. +The `VirtualDirectory` class provides properties and methods for creating, deleting and enumerating directories and subdirectories. ```csharp public static async Task PrintFilesAsync(VirtualDirectory directory, string padding = "", CancellationToken cancellationToken = default) diff --git a/src/Ramstack.FileSystem.Abstractions/VirtualFileExtensions.cs b/src/Ramstack.FileSystem.Abstractions/VirtualFileExtensions.cs index 10ea1d7..ba52bf5 100644 --- a/src/Ramstack.FileSystem.Abstractions/VirtualFileExtensions.cs +++ b/src/Ramstack.FileSystem.Abstractions/VirtualFileExtensions.cs @@ -8,12 +8,12 @@ namespace Ramstack.FileSystem; /// public static class VirtualFileExtensions { - private static Encoding? _utf8NoBom; + private static Encoding? s_utf8NoBom; /// - /// Gets an instance of UTF8 encoding without BOM. + /// Gets an instance of the without BOM. /// - private static Encoding Utf8NoBom => _utf8NoBom ??= new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); + private static Encoding Utf8NoBom => s_utf8NoBom ??= new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); /// /// Asynchronously returns a with @@ -279,7 +279,7 @@ public static ValueTask WriteAllTextAsync(this VirtualFile file, string contents WriteAllTextAsync(file, contents.AsMemory(), encoding, cancellationToken); /// - /// Asynchronously writes the specified string to current the file. If the file already exists, it is truncated and overwritten. + /// Asynchronously writes the specified string to the current file. If the file already exists, it is truncated and overwritten. /// /// The file to write to. /// The contents to write to the file. diff --git a/src/Ramstack.FileSystem.Abstractions/VirtualFileSystemExtensions.cs b/src/Ramstack.FileSystem.Abstractions/VirtualFileSystemExtensions.cs index ff7a441..270531a 100644 --- a/src/Ramstack.FileSystem.Abstractions/VirtualFileSystemExtensions.cs +++ b/src/Ramstack.FileSystem.Abstractions/VirtualFileSystemExtensions.cs @@ -189,7 +189,7 @@ public static ValueTask WriteAllTextAsync(this IVirtualFileSystem fs, string pat fs.GetFile(path).WriteAllTextAsync(contents, encoding, cancellationToken); /// - /// Asynchronously writes the specified string to specified the file. If the file already exists, it is truncated and overwritten. + /// Asynchronously writes the specified string to the specified the file. If the file already exists, it is truncated and overwritten. /// /// The file system to use. /// The file to write to. diff --git a/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs b/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs index 9535ccb..d2a700e 100644 --- a/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs +++ b/src/Ramstack.FileSystem.Abstractions/VirtualPath.cs @@ -82,7 +82,7 @@ public static ReadOnlySpan GetExtension(ReadOnlySpan path) /// /// Returns the file name and extension for the specified path. /// - /// The path from which to obtain the file name and extension. + /// The path from which to get the file name and extension. /// /// The file name and extension for the . /// @@ -100,7 +100,7 @@ public static string GetFileName(string path) /// /// Returns the file name and extension for the specified path. /// - /// The path from which to obtain the file name and extension. + /// The path from which to get the file name and extension. /// /// The file name and extension for the . /// @@ -118,7 +118,7 @@ public static ReadOnlySpan GetFileName(ReadOnlySpan path) /// /// The path to retrieve the directory portion from. /// - /// Directory portion for , or an empty string if path denotes a root directory. + /// Directory portion for , or an empty string if the path denotes a root directory. /// public static string GetDirectoryName(string path) { diff --git a/src/Ramstack.FileSystem.Amazon/S3UploadStream.cs b/src/Ramstack.FileSystem.Amazon/S3UploadStream.cs index a63939c..6dc5362 100644 --- a/src/Ramstack.FileSystem.Amazon/S3UploadStream.cs +++ b/src/Ramstack.FileSystem.Amazon/S3UploadStream.cs @@ -124,7 +124,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati WriteAsync(buffer.AsMemory(offset, count), cancellationToken).AsTask(); /// - public override async ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = new CancellationToken()) + public override async ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) { try { diff --git a/src/Ramstack.FileSystem.Azure/AzureFileSystem.cs b/src/Ramstack.FileSystem.Azure/AzureFileSystem.cs index f34146c..2860e38 100644 --- a/src/Ramstack.FileSystem.Azure/AzureFileSystem.cs +++ b/src/Ramstack.FileSystem.Azure/AzureFileSystem.cs @@ -118,7 +118,7 @@ public ValueTask CreateContainerAsync(CancellationToken cancellationToken = defa /// /// /// : Specifies full public read access for both the container and blob data. - /// Clients can enumerate blobs within the container via anonymous requests, but cannot enumerate containers within the storage account. + /// Clients can enumerate blobs within the container via anonymous requests but cannot enumerate containers within the storage account. /// /// /// diff --git a/src/Ramstack.FileSystem.Physical/PhysicalDirectory.cs b/src/Ramstack.FileSystem.Physical/PhysicalDirectory.cs index 2476776..fe646d8 100644 --- a/src/Ramstack.FileSystem.Physical/PhysicalDirectory.cs +++ b/src/Ramstack.FileSystem.Physical/PhysicalDirectory.cs @@ -15,7 +15,7 @@ internal sealed class PhysicalDirectory : VirtualDirectory /// including system and hidden files, not recurse through subdirectories, /// and ignore inaccessible files. /// - private static readonly EnumerationOptions DefaultOptions = new() + private static readonly EnumerationOptions s_defaultOptions = new() { AttributesToSkip = 0, RecurseSubdirectories = false, @@ -85,7 +85,7 @@ protected override IAsyncEnumerable GetFileNodesCoreAsync(Cancellat // its existence was checked. var nodes = Directory.Exists(_physicalPath) - ? new FileSystemEnumerable(_physicalPath, FindTransform, DefaultOptions) + ? new FileSystemEnumerable(_physicalPath, FindTransform, s_defaultOptions) : Enumerable.Empty(); return nodes.ToAsyncEnumerable(); @@ -108,9 +108,9 @@ protected override IAsyncEnumerable GetFilesCoreAsync(CancellationT if (Directory.Exists(_physicalPath)) { - nodes = new FileSystemEnumerable(_physicalPath, FindTransform, DefaultOptions) + nodes = new FileSystemEnumerable(_physicalPath, FindTransform, s_defaultOptions) { - ShouldIncludePredicate = (ref FileSystemEntry entry) => !entry.IsDirectory + ShouldIncludePredicate = (ref entry) => !entry.IsDirectory }; } @@ -118,7 +118,7 @@ protected override IAsyncEnumerable GetFilesCoreAsync(CancellationT VirtualFile FindTransform(ref FileSystemEntry entry) { - Debug.Assert(entry.IsDirectory == false); + Debug.Assert(!entry.IsDirectory); var fullName = VirtualPath.Join(FullName, entry.FileName); var physicalPath = entry.ToFullPath(); @@ -134,9 +134,9 @@ protected override IAsyncEnumerable GetDirectoriesCoreAsync(Ca if (Directory.Exists(_physicalPath)) { - nodes = new FileSystemEnumerable(_physicalPath, FindTransform, DefaultOptions) + nodes = new FileSystemEnumerable(_physicalPath, FindTransform, s_defaultOptions) { - ShouldIncludePredicate = (ref FileSystemEntry entry) => entry.IsDirectory + ShouldIncludePredicate = (ref entry) => entry.IsDirectory }; } diff --git a/src/Ramstack.FileSystem.Physical/PhysicalFile.cs b/src/Ramstack.FileSystem.Physical/PhysicalFile.cs index 99b885e..d648470 100644 --- a/src/Ramstack.FileSystem.Physical/PhysicalFile.cs +++ b/src/Ramstack.FileSystem.Physical/PhysicalFile.cs @@ -65,7 +65,7 @@ protected override ValueTask OpenWriteCoreAsync(CancellationToken cancel var stream = new FileStream(_physicalPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, DefaultBufferSize, options); - // Since, FileMode.OpenOrCreate doesn't truncate the file, we manually + // Since FileMode.OpenOrCreate doesn't truncate the file, we manually // set the file length to zero to remove any leftover data. stream.SetLength(0); @@ -90,7 +90,7 @@ protected override async ValueTask WriteCoreAsync(Stream stream, bool overwrite, await using var fs = new FileStream(_physicalPath, fileMode, FileAccess.Write, FileShare.None, DefaultBufferSize, options); - // Since, FileMode.OpenOrCreate doesn't truncate the file, we manually + // Since FileMode.OpenOrCreate doesn't truncate the file, we manually // set the file length to zero to remove any leftover data. fs.SetLength(0); diff --git a/src/Ramstack.FileSystem.Prefixed/PrefixedFileSystem.cs b/src/Ramstack.FileSystem.Prefixed/PrefixedFileSystem.cs index 83bb653..6f1a4b2 100644 --- a/src/Ramstack.FileSystem.Prefixed/PrefixedFileSystem.cs +++ b/src/Ramstack.FileSystem.Prefixed/PrefixedFileSystem.cs @@ -29,7 +29,7 @@ public PrefixedFileSystem(string prefix, IVirtualFileSystem fileSystem) prefix = VirtualPath.Normalize(prefix); (_prefix, _fs) = (prefix, fileSystem); - // Create artificial directory list + // Create an artificial directory list _directories = CreateArtificialDirectories(this, prefix); static VirtualDirectory[] CreateArtificialDirectories(PrefixedFileSystem fs, string path)