Skip to content

Latest commit

 

History

History
211 lines (189 loc) · 7.61 KB

System.IO.md

File metadata and controls

211 lines (189 loc) · 7.61 KB

System.IO


DirectoryInfoExtensions

Provides extension methods for the DirectoryInfo class.

public static class DirectoryInfoExtensions

Static Methods

CombineFileInfo

FileInfo CombineFileInfo(this DirectoryInfo directoryInfo, string[] paths)

Summary: Combines the directory path with additional sub-paths to create a FileInfo object.

Parameters:
     directoryInfo  -  The base directory information.
     paths  -  An array of sub-paths to combine with the base directory.

Returns: A FileInfo object representing the combined path.

GetByteSize

long GetByteSize(this DirectoryInfo directoryInfo, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the byte size.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetFileInfo

FileInfo GetFileInfo(this DirectoryInfo directoryInfo, string file)

Summary: Get the file information.

Parameters:
     directoryInfo  -  The directory information.
     file  -  The file.

GetFilesCount

long GetFilesCount(this DirectoryInfo directoryInfo, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the files count.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetFilesForAuthorizedAccess

FileInfo[] GetFilesForAuthorizedAccess(this DirectoryInfo directoryInfo, string searchPattern = *.*, SearchOption searchOption = TopDirectoryOnly)

Summary: Gets the files as GetFiles, but skip files and folders with unauthorized access.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetFoldersCount

long GetFoldersCount(this DirectoryInfo directoryInfo, string searchPattern = *, SearchOption searchOption = AllDirectories)

Summary: Gets the folders count.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetPrettyByteSize

string GetPrettyByteSize(this DirectoryInfo directoryInfo, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the byte size as pretty formatted text like '1.933.212.103 bytes'.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.

GetPrettySize

string GetPrettySize(this DirectoryInfo directoryInfo, string searchPattern = *.*, SearchOption searchOption = AllDirectories)

Summary: Gets the byte size as pretty formatted text like '1.82 GB'.

Parameters:
     directoryInfo  -  The directory information.
     searchPattern  -  The search pattern.
     searchOption  -  The search option.


FileInfoExtensions

Extension methods for the System.IO.FileInfo class.

public static class FileInfoExtensions

Static Methods

ReadToByteArray

byte[] ReadToByteArray(this FileInfo fileInfo)

Summary: Reads to byte array.

Parameters:
     fileInfo  -  The file information.

Returns: Return a byte array from the file

ReadToByteArrayAsync

Task<byte[]> ReadToByteArrayAsync(this FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads to byte array.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return a byte array from the file

ReadToMemoryStream

MemoryStream ReadToMemoryStream(this FileInfo fileInfo)

Summary: Reads to System.IO.MemoryStream.

Parameters:
     fileInfo  -  The file information.

Returns: Return a System.IO.MemoryStream from the file

ReadToMemoryStreamAsync

Task<MemoryStream> ReadToMemoryStreamAsync(this FileInfo fileInfo, CancellationToken cancellationToken = null)

Summary: Reads to System.IO.MemoryStream.

Parameters:
     fileInfo  -  The file information.
     cancellationToken  -  The cancellation token.

Returns: Return a System.IO.MemoryStream from the file


MemoryStreamExtensions

Extensions for the System.IO.Stream class.

public static class MemoryStreamExtensions

Static Methods

ToString

string ToString(this MemoryStream stream, Encoding encoding = null)

Summary: Converts to string.

Parameters:
     stream  -  The stream.
     encoding  -  The encoding.


StreamExtensions

Extensions for the System.IO.Stream class.

public static class StreamExtensions

Static Methods

CopyToStream

Stream CopyToStream(this Stream stream, int bufferSize = 4096)

Summary: Copy to stream.

Parameters:
     stream  -  The stream.
     bufferSize  -  Size of the buffer.

ToBytes

byte[] ToBytes(this Stream stream)

Summary: Converts to bytes.

Parameters:
     stream  -  The stream.

ToStringData

string ToStringData(this Stream stream)

Summary: Converts to string.

Parameters:
     stream  -  The stream.


Generated by MarkdownCodeDoc version 1.2