C# Class withSIX.Core.Tools.FileTools

Inheritance: IEnableLogging
显示文件 Open project: SIXNetworks/withSIX.Desktop

Public Properties

Property Type Description
IsRunningOnMono bool

Public Methods

Method Description
CheckFile ( string path, bool checkExists = false, bool mayBeUnc = true ) : bool
ComparePathsEqualCase ( string source, string destination ) : bool
ComparePathsOsCaseSensitive ( IAbsolutePath path1, IAbsolutePath path2 ) : bool
ComparePathsOsCaseSensitive ( string path1, string path2 ) : bool
CreateBatFile ( IAbsoluteDirectoryPath path, string name, string content ) : Task
FilterPath ( FileSystemInfo info ) : string
FilterPath ( IPath info ) : string
FilterPath ( string pathName ) : string
FindParentWithName ( IAbsoluteDirectoryPath path, string key ) : IAbsoluteDirectoryPath
FindPathInParents ( string path, string key ) : string
GetDirectorySize ( IAbsoluteDirectoryPath p, string filter = null, string selector = "*.*", bool recurse = true ) : long
GetFileSize ( double size, Units unit = Units.B, string postFix = null ) : string
GetFileVersion ( string file ) : FileVersionInfo
GetFiles ( IAbsoluteDirectoryPath directory, string fileMask = "*.*", IEnumerable dirRootExclusions = null, IEnumerable fileRootExclusions = null ) : IEnumerable
GetVersion ( IAbsoluteFilePath exePath ) : System.Version
HandleDowncase ( string entry, IReadOnlyCollection excludes = null ) : void
HandleDowncaseFolder ( IAbsoluteDirectoryPath entry, IReadOnlyCollection excludes = null ) : void
IsDirectoryEmpty ( IAbsoluteDirectoryPath path ) : bool
IsPathRootedDirectlyIn ( IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath root, bool mayBeEqual = false ) : bool
IsPathRootedIn ( IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath root, bool mayBeEqual = false ) : bool
IsValidRootedPath ( string path, bool checkExists = false, bool mayBeUnc = false ) : bool
Lock ( string path, Func action ) : Task
MakeValidFileName ( string fileName, string ext ) : string
OpenCommandPrompt ( IAbsoluteDirectoryPath path ) : void
OpenFolderInExplorer ( IAbsoluteDirectoryPath path ) : void
OpenFolderInExplorer ( string path ) : void
OrderBySize ( IEnumerable ar, bool reverse = false ) : string[]
RemoveExtension ( string filePath, string toRemove = null ) : string
SelectInExplorer ( string path ) : void
SizePrediction ( string filePath ) : long

Private Methods

Method Description
CleanPath ( string path ) : string
GetFullCleanPath ( string path ) : string
GetIsRunningOnMono ( ) : bool
IsSameRoot ( IAbsoluteDirectoryPath sourcePath, IAbsoluteDirectoryPath destinationPath ) : bool
MakeValidBatFileName ( string fileName ) : string

Method Details

CheckFile() public method

public CheckFile ( string path, bool checkExists = false, bool mayBeUnc = true ) : bool
path string
checkExists bool
mayBeUnc bool
return bool

ComparePathsEqualCase() public method

public ComparePathsEqualCase ( string source, string destination ) : bool
source string
destination string
return bool

ComparePathsOsCaseSensitive() public method

public ComparePathsOsCaseSensitive ( IAbsolutePath path1, IAbsolutePath path2 ) : bool
path1 IAbsolutePath
path2 IAbsolutePath
return bool

ComparePathsOsCaseSensitive() public method

public ComparePathsOsCaseSensitive ( string path1, string path2 ) : bool
path1 string
path2 string
return bool

CreateBatFile() public method

public CreateBatFile ( IAbsoluteDirectoryPath path, string name, string content ) : Task
path IAbsoluteDirectoryPath
name string
content string
return Task

FilterPath() public method

public FilterPath ( FileSystemInfo info ) : string
info System.IO.FileSystemInfo
return string

FilterPath() public method

public FilterPath ( IPath info ) : string
info IPath
return string

FilterPath() public method

public FilterPath ( string pathName ) : string
pathName string
return string

FindParentWithName() public method

public FindParentWithName ( IAbsoluteDirectoryPath path, string key ) : IAbsoluteDirectoryPath
path IAbsoluteDirectoryPath
key string
return IAbsoluteDirectoryPath

FindPathInParents() public method

public FindPathInParents ( string path, string key ) : string
path string
key string
return string

GetDirectorySize() public method

public GetDirectorySize ( IAbsoluteDirectoryPath p, string filter = null, string selector = "*.*", bool recurse = true ) : long
p IAbsoluteDirectoryPath
filter string
selector string
recurse bool
return long

GetFileSize() public method

public GetFileSize ( double size, Units unit = Units.B, string postFix = null ) : string
size double
unit Units
postFix string
return string

GetFileVersion() public method

public GetFileVersion ( string file ) : FileVersionInfo
file string
return System.Diagnostics.FileVersionInfo

GetFiles() public method

public GetFiles ( IAbsoluteDirectoryPath directory, string fileMask = "*.*", IEnumerable dirRootExclusions = null, IEnumerable fileRootExclusions = null ) : IEnumerable
directory IAbsoluteDirectoryPath
fileMask string
dirRootExclusions IEnumerable
fileRootExclusions IEnumerable
return IEnumerable

GetVersion() public method

public GetVersion ( IAbsoluteFilePath exePath ) : System.Version
exePath IAbsoluteFilePath
return System.Version

HandleDowncase() public method

public HandleDowncase ( string entry, IReadOnlyCollection excludes = null ) : void
entry string
excludes IReadOnlyCollection
return void

HandleDowncaseFolder() public method

public HandleDowncaseFolder ( IAbsoluteDirectoryPath entry, IReadOnlyCollection excludes = null ) : void
entry IAbsoluteDirectoryPath
excludes IReadOnlyCollection
return void

IsDirectoryEmpty() public method

public IsDirectoryEmpty ( IAbsoluteDirectoryPath path ) : bool
path IAbsoluteDirectoryPath
return bool

IsPathRootedDirectlyIn() public method

public IsPathRootedDirectlyIn ( IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath root, bool mayBeEqual = false ) : bool
path IAbsoluteDirectoryPath
root IAbsoluteDirectoryPath
mayBeEqual bool
return bool

IsPathRootedIn() public method

public IsPathRootedIn ( IAbsoluteDirectoryPath path, IAbsoluteDirectoryPath root, bool mayBeEqual = false ) : bool
path IAbsoluteDirectoryPath
root IAbsoluteDirectoryPath
mayBeEqual bool
return bool

IsValidRootedPath() public method

public IsValidRootedPath ( string path, bool checkExists = false, bool mayBeUnc = false ) : bool
path string
checkExists bool
mayBeUnc bool
return bool

Lock() public method

public Lock ( string path, Func action ) : Task
path string
action Func
return Task

MakeValidFileName() public method

public MakeValidFileName ( string fileName, string ext ) : string
fileName string
ext string
return string

OpenCommandPrompt() public method

public OpenCommandPrompt ( IAbsoluteDirectoryPath path ) : void
path IAbsoluteDirectoryPath
return void

OpenFolderInExplorer() public method

public OpenFolderInExplorer ( IAbsoluteDirectoryPath path ) : void
path IAbsoluteDirectoryPath
return void

OpenFolderInExplorer() public method

public OpenFolderInExplorer ( string path ) : void
path string
return void

OrderBySize() public method

public OrderBySize ( IEnumerable ar, bool reverse = false ) : string[]
ar IEnumerable
reverse bool
return string[]

RemoveExtension() public method

public RemoveExtension ( string filePath, string toRemove = null ) : string
filePath string
toRemove string
return string

SelectInExplorer() public method

public SelectInExplorer ( string path ) : void
path string
return void

SizePrediction() public method

public SizePrediction ( string filePath ) : long
filePath string
return long

Property Details

IsRunningOnMono public_oe static_oe property

public static bool IsRunningOnMono
return bool