Myce.Wrappers 0.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Myce.Wrappers --version 0.5.0                
NuGet\Install-Package Myce.Wrappers -Version 0.5.0                
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.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Myce.Wrappers --version 0.5.0                
#r "nuget: Myce.Wrappers, 0.5.0"                
#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.0

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

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.
- 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.

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) - Creates or overwrites a file in the specified path.
- Create(String, Int32)	- Creates or overwrites a file in the specified path, specifying a buffer size.
- Create(String, Int32, FileOptions) - 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) - 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, FileMode) - Opens a FileStream on the specified path with read/write access with no sharing.
- Open(String, FileStreamOptions) - 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, FileMode, FileAccess) - Opens a FileStream on the specified path, with the specified mode and access with no sharing.
- Open(String, FileMode, FileAccess, FileShare)	- 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.

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