Myce.Wrappers 0.5.7

dotnet add package Myce.Wrappers --version 0.5.7                
NuGet\Install-Package Myce.Wrappers -Version 0.5.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Myce.Wrappers" Version="0.5.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Myce.Wrappers --version 0.5.7                
#r "nuget: Myce.Wrappers, 0.5.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Myce.Wrappers as a Cake Addin
#addin nuget:?package=Myce.Wrappers&version=0.5.7

// Install Myce.Wrappers as a Cake Tool
#tool nuget:?package=Myce.Wrappers&version=0.5.7                

MYCE.Wrappers

MYCE (Makes Your Coding Easier) is a Nuget package for Visual Studio that contains a set of wrappers for the most common System.IO classes, which is especially useful for mock methods in unit tests.

Library

This is a simple wrapper for some of the most used classes of System.IO Namespace. For more information, including examples, visit Microsoft Learn - System.IO Namespace. All method descriptions below were copied from there, if you find any information inconsistent or out of date, please contact us.

Directory

- CreateDirectory (string path) - Creates all directories and subdirectories in the specified path unless they already exist.
- CreateDirectory (string path, UnixFileMode unixCreateMode) - Creates all directories and subdirectories in the specified path with the specified permissions unless they already exist.
- Delete (string path) - Deletes an empty directory from a specified path.
- Delete (string path, bool recursive) - Deletes the specified directory and, if indicated, any subdirectories and files in the directory.
- Exists (string? path) - Determines whether the given path refers to an existing directory on disk.
- GetDirectoryRoot (string path) - Returns the volume information, root information, or both for the specified path.
- GetFiles(string path) - Returns the names of files (including their paths) that match the specified search pattern and enumeration options in the specified directory.
- GetFiles(string path, string searchPattern) - Returns the names of files (including their paths) that match the specified search pattern and enumeration options in the specified directory.
- GetFiles(string path, string searchPattern, EnumerationOptions enumerationOptions) - Returns the names of files (including their paths) that match the specified search pattern and enumeration options in the specified directory.
- GetFiles(string path, string searchPattern, SearchOption searchOption) - Returns the names of files (including their paths) that match the specified search pattern in the specified directory, using a value to determine whether to search subdirectories.
- GetParent(String path) - Retrieves the parent directory of the specified path, including both absolute and relative paths.
- Move (string sourceDirName, string destDirName) - Moves a file or a directory and its contents to a new location.

File

- Copy(string sourceFileName, string destFileName) - Copies an existing file to a new file.
- Copy(string sourceFileName, string destFileName, bool overwrite) - Copies an existing file to a new file. Overwriting a file of the same name is allowed.
- Create(String path) - Creates or overwrites a file in the specified path.
- Create(String path, Int32bufferSize) - Creates or overwrites a file in the specified path, specifying a buffer size.
- Create(String path, Int32bufferSize, FileOptions options) - Creates or overwrites a file in the specified path, specifying a buffer size and options that describe how to create or overwrite the file.
- CreateText(String path) - Creates or opens a file for writing UTF-8 encoded text. If the file already exists, its contents are overwritten.
- Delete (string path) - Deletes the specified file.
- Exists(string path) - Determines whether the specified file exists.
- Move(string sourceFileName, string destFileName) - Moves a specified file to a new location, providing the option to specify a new file name.
- Move(string sourceFileName, string destFileName, bool overwrite) - Moves a specified file to a new location, providing the options to specify a new file name and to overwrite the destination file if it already exists.
- Open(String path, FileMode mode) - Opens a FileStream on the specified path with read/write access with no sharing.
- Open(String path, FileStreamOptions options) - Initializes a new instance of the FileStream class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, additional file options and the allocation size.
- Open(String path, FileMode mode, FileAccess access) - Opens a FileStream on the specified path, with the specified mode and access with no sharing.
- Open(String path, FileMode mode, FileAccess access, FileShare share)- Opens a FileStream on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.
- ReadAllText(string path) - Opens a text file, reads all the text in the file, and then closes the file.
- ReadAllTextAsync(string path, CancellationToken cancellationToken = default) - Asynchronously opens a text file, reads all the text in the file, and then closes the file.
- ReadAllText(string path, Encoding encoding) - Opens a file, reads all text in the file with the specified encoding, and then closes the file.
- ReadAllTextAsync(string path, Encoding encoding, CancellationToken cancellationToken = default) - Asynchronously opens a text file, reads all text in the file with the specified encoding, and then closes the file.
- WriteAllText(string path, string? contents) - Creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is overwritten.
- WriteAllText(string path, string? contents, Encoding encoding) - Creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is overwritten.
- WriteAllTextAsync(string path, string? contents, CancellationToken cancellationToken = default) - Asynchronously creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.
- WriteAllTextAsync(string path, string? contents, Encoding encoding, CancellationToken cancellationToken = default) - Asynchronously creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.

Path

- ChangeExtension(string? path, string? extension) - Changes the extension of a path string.
- Combine(params string[] paths) - Combines an array of strings into a path.
- Combine(string path1, string path2) - Combines two strings into a path.
- Combine(string path1, string path2, string path3) - Combines three strings into a path.
- Combine(string path1, string path2, string path3, string path4) - Combines four strings into a path.
- GetFileName (ReadOnlySpan<char> path) - Returns the file name and extension of a file path that is represented by a read-only character span.
- GetFileName (string? path) - Returns the file name and extension of the specified path string.
- GetFileNameWithoutExtension(ReadOnlySpan<Char> path) - Returns the file name without the extension of a file path that is represented by a read-only character span.
- GetFileNameWithoutExtension(String path) - Returns the file name of the specified path string without the extension.
- GetFullPath(String path) - Returns the absolute path for the specified path string.
- GetFullPath(String path, String basePath) - Returns an absolute path from a relative path and a fully qualified base path.
- GetPathRoot(string? path) - Gets the root directory information from the path contained in the specified string.
- GetPathRoot(ReadOnlySpan<char> path) - Gets the root directory information from the path contained in the specified character span.
- GetTempPath() - Returns the path of the current user's temporary folder.
- Join(params string?[] paths) - Concatenates an array of paths into a single path.
- Join(string? path1, string? path2) - Concatenates two paths into a single path.
- Join(string? path1, string? path2, string? path3) - Concatenates three paths into a single path.
- Join(string? path1, string? path2, string? path3, string? path4) - Concatenates four paths into a single path.
- Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2) - Concatenates two path components into a single path.
- Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3) - Concatenates three path components into a single path.
- Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3, ReadOnlySpan<char> path4) - Concatenates four path components into a single path.

Dependencies

  • None

Attention:

None of this library's methods have unit test for the simple fact that, as the name implies, they are wrappers of original methods from the System.IO namespace.

Contributions

Contributions are welcome on this library. If you use a class or method from the System.IO namespace that is not already here, create a Pull Request and submit it.

Developed by Fernando Prass

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.7 290 10/14/2023
0.5.6 114 10/14/2023
0.5.5 133 10/9/2023
0.5.1 131 10/4/2023
0.5.0 125 10/1/2023
0.4.0 198 4/10/2023
0.3.0 209 3/31/2023
0.2.0 205 3/29/2023
0.1.0 197 3/26/2023