C# 클래스 CoreTechs.Common.FileSystemExtensions

파일 보기 프로젝트 열기: Core-Techs/Common

공개 메소드들

메소드 설명
AreSame ( this a, DirectoryInfo b ) : bool
AreSame ( this a, FileInfo b ) : bool
AttemptOpen ( this file, FileAccess fileAccess = FileAccess.ReadWrite, FileShare fileShare = FileShare.None ) : Attempt

Attempts to open a file. Immediately closes the file if successful. Swallows (but returns) any exception encountered while trying to open the file.

ComputeFileHash ( this fileInfo, HashAlgorithm algorithm = null ) : string
ComputeHash ( this stream, HashAlgorithm algorithm = null ) : byte[]
Contains ( this dir, FileSystemInfo other ) : bool

Determines if the directory contains the other directory or file at any depth.

ContainsDirectly ( this dir, FileSystemInfo other ) : bool

Determines if the directory directly contains the other directory or file.

ConvertToString ( this bytes ) : string
CreateFileSystemInfoFromPath ( this path ) : FileSystemInfo
EnsureExists ( this dir ) : DirectoryInfo
EnumerateBytes ( this file ) : IEnumerable
EnumeratePathDownFromRoot ( this source ) : IEnumerable

Yields each part of the path, ordered from the root to the item.

EnumeratePathUpToRoot ( this source ) : IEnumerable

Yields each part of the path, ordered from the item to the root.

GetFile ( this directory, string file ) : FileInfo
GetParentDirectory ( this fileSystemInfo ) : DirectoryInfo
GetPath ( this specialFolder, Environment option = Environment.SpecialFolderOption.None ) : string
GetRelativePathFrom ( this to, FileSystemInfo from ) : string
GetRelativePathTo ( this from, FileSystemInfo to ) : string
GetSubDirectory ( this directory ) : DirectoryInfo
GetUnchangedFiles ( this source, System.TimeSpan interval, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]

Returns files that haven't changed over a period of time.

IsContainedDirectlyWithin ( this fileOrDirectory, DirectoryInfo otherDir ) : bool

Determines if the file or directory is contained directly within the the other directory.

IsContainedWithin ( this fileOrDirectory, DirectoryInfo otherDir ) : bool

Determines if the file or directory is contained within the the other directory at any depth.

IsDirectoryPath ( this path ) : bool
IsFilePath ( this path ) : bool
PollForAllFiles ( this di, System.TimeSpan interval, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]

Checks and rechecks a directory and all sub-directories for files. Only returns files that haven't changed between checks.

PollForFiles ( this di, System.TimeSpan interval, string searchPattern = "*", SearchOption searchOption = SearchOption.TopDirectoryOnly, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]

Checks and rechecks a directory for files. Only returns files that haven't changed between checks.

WhereCanOpen ( this files ) : IEnumerable

메소드 상세

AreSame() 공개 정적인 메소드

public static AreSame ( this a, DirectoryInfo b ) : bool
a this
b System.IO.DirectoryInfo
리턴 bool

AreSame() 공개 정적인 메소드

public static AreSame ( this a, FileInfo b ) : bool
a this
b System.IO.FileInfo
리턴 bool

AttemptOpen() 공개 정적인 메소드

Attempts to open a file. Immediately closes the file if successful. Swallows (but returns) any exception encountered while trying to open the file.
public static AttemptOpen ( this file, FileAccess fileAccess = FileAccess.ReadWrite, FileShare fileShare = FileShare.None ) : Attempt
file this The file to attempt to open.
fileAccess FileAccess The access required to open the file. Defaults to ReadWrite.
fileShare FileShare The access granted to others trying to manipulate the file. Defaults to none.
리턴 Attempt

ComputeFileHash() 공개 정적인 메소드

public static ComputeFileHash ( this fileInfo, HashAlgorithm algorithm = null ) : string
fileInfo this
algorithm System.Security.Cryptography.HashAlgorithm
리턴 string

ComputeHash() 공개 정적인 메소드

public static ComputeHash ( this stream, HashAlgorithm algorithm = null ) : byte[]
stream this
algorithm System.Security.Cryptography.HashAlgorithm
리턴 byte[]

Contains() 공개 정적인 메소드

Determines if the directory contains the other directory or file at any depth.
public static Contains ( this dir, FileSystemInfo other ) : bool
dir this
other System.IO.FileSystemInfo
리턴 bool

ContainsDirectly() 공개 정적인 메소드

Determines if the directory directly contains the other directory or file.
public static ContainsDirectly ( this dir, FileSystemInfo other ) : bool
dir this
other System.IO.FileSystemInfo
리턴 bool

ConvertToString() 공개 정적인 메소드

public static ConvertToString ( this bytes ) : string
bytes this
리턴 string

CreateFileSystemInfoFromPath() 공개 정적인 메소드

public static CreateFileSystemInfoFromPath ( this path ) : FileSystemInfo
path this
리턴 System.IO.FileSystemInfo

EnsureExists() 공개 정적인 메소드

public static EnsureExists ( this dir ) : DirectoryInfo
dir this
리턴 System.IO.DirectoryInfo

EnumerateBytes() 공개 정적인 메소드

public static EnumerateBytes ( this file ) : IEnumerable
file this
리턴 IEnumerable

EnumeratePathDownFromRoot() 공개 정적인 메소드

Yields each part of the path, ordered from the root to the item.
public static EnumeratePathDownFromRoot ( this source ) : IEnumerable
source this
리턴 IEnumerable

EnumeratePathUpToRoot() 공개 정적인 메소드

Yields each part of the path, ordered from the item to the root.
public static EnumeratePathUpToRoot ( this source ) : IEnumerable
source this
리턴 IEnumerable

GetFile() 공개 정적인 메소드

public static GetFile ( this directory, string file ) : FileInfo
directory this
file string
리턴 System.IO.FileInfo

GetParentDirectory() 공개 정적인 메소드

public static GetParentDirectory ( this fileSystemInfo ) : DirectoryInfo
fileSystemInfo this
리턴 System.IO.DirectoryInfo

GetPath() 공개 정적인 메소드

public static GetPath ( this specialFolder, Environment option = Environment.SpecialFolderOption.None ) : string
specialFolder this
option Environment
리턴 string

GetRelativePathFrom() 공개 정적인 메소드

public static GetRelativePathFrom ( this to, FileSystemInfo from ) : string
to this
from System.IO.FileSystemInfo
리턴 string

GetRelativePathTo() 공개 정적인 메소드

public static GetRelativePathTo ( this from, FileSystemInfo to ) : string
from this
to System.IO.FileSystemInfo
리턴 string

GetSubDirectory() 공개 정적인 메소드

public static GetSubDirectory ( this directory ) : DirectoryInfo
directory this
리턴 System.IO.DirectoryInfo

GetUnchangedFiles() 공개 정적인 메소드

Returns files that haven't changed over a period of time.
public static GetUnchangedFiles ( this source, System.TimeSpan interval, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]
source this Files to check.
interval System.TimeSpan Time to wait between checking the files.
cancellationToken System.Threading.CancellationToken Token to cancel the wait between checks.
리턴 System.IO.FileInfo[]

IsContainedDirectlyWithin() 공개 정적인 메소드

Determines if the file or directory is contained directly within the the other directory.
public static IsContainedDirectlyWithin ( this fileOrDirectory, DirectoryInfo otherDir ) : bool
fileOrDirectory this
otherDir System.IO.DirectoryInfo
리턴 bool

IsContainedWithin() 공개 정적인 메소드

Determines if the file or directory is contained within the the other directory at any depth.
public static IsContainedWithin ( this fileOrDirectory, DirectoryInfo otherDir ) : bool
fileOrDirectory this
otherDir System.IO.DirectoryInfo
리턴 bool

IsDirectoryPath() 공개 정적인 메소드

public static IsDirectoryPath ( this path ) : bool
path this
리턴 bool

IsFilePath() 공개 정적인 메소드

public static IsFilePath ( this path ) : bool
path this
리턴 bool

PollForAllFiles() 공개 정적인 메소드

Checks and rechecks a directory and all sub-directories for files. Only returns files that haven't changed between checks.
public static PollForAllFiles ( this di, System.TimeSpan interval, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]
di this The directory to check.
interval System.TimeSpan The time between checking for files.
cancellationToken System.Threading.CancellationToken Token to cancel the wait between checks.
리턴 System.IO.FileInfo[]

PollForFiles() 공개 정적인 메소드

Checks and rechecks a directory for files. Only returns files that haven't changed between checks.
public static PollForFiles ( this di, System.TimeSpan interval, string searchPattern = "*", SearchOption searchOption = SearchOption.TopDirectoryOnly, CancellationToken cancellationToken = default(CancellationToken) ) : System.IO.FileInfo[]
di this The directory to check.
interval System.TimeSpan The time between checking for files.
searchPattern string The search pattern.
searchOption SearchOption The search options.
cancellationToken System.Threading.CancellationToken Token to cancel the wait between checks.
리턴 System.IO.FileInfo[]

WhereCanOpen() 공개 정적인 메소드

public static WhereCanOpen ( this files ) : IEnumerable
files this
리턴 IEnumerable