C# Class NAnt.Core.Util.FileUtils

Provides modified version for Copy and Move from the File class that allow for filter chain processing.
Afficher le fichier Open project: skolima/NAnt

Méthodes publiques

Méthode Description
CombinePaths ( string path1, string path2 ) : string

Combines two path strings.

On *nix, processing is delegated to System.IO.Path.Combine(string, string).

On Windows, this method normalized the paths to avoid running into the 260 character limit of a path and converts forward slashes in both path1 and path2 to the platform's directory separator character.

CopyFile ( string sourceFileName, string destFileName, FilterChain filterChain, Encoding inputEncoding, Encoding outputEncoding ) : void

Copies a file filtering its content through the filter chain.

GetFullPath ( string path ) : string

Returns Absolute Path (Fix for 260 Char Limit of Path.GetFullPath(...))

GetHomeDirectory ( ) : string

Returns the home directory of the current user.

GetTempDirectory ( ) : DirectoryInfo

Returns a uniquely named empty temporary directory on disk.

MoveFile ( string sourceFileName, string destFileName, FilterChain filterChain, Encoding inputEncoding, Encoding outputEncoding ) : void

Moves a file filtering its content through the filter chain.

ReadFile ( string fileName, FilterChain filterChain, Encoding inputEncoding ) : string

Reads a file filtering its content through the filter chain.

If inputEncoding is , then the system's ANSI code page will be used to read the file.

ResolveFile ( string directories, string fileName, bool recursive ) : string

Scans a list of directories for the specified filename.

The directories are scanned in the order in which they are defined.

Private Methods

Méthode Description
FileUtils ( ) : System
ScanDirectory ( string directory, string fileName, bool recursive ) : string

Method Details

CombinePaths() public static méthode

Combines two path strings.

On *nix, processing is delegated to System.IO.Path.Combine(string, string).

On Windows, this method normalized the paths to avoid running into the 260 character limit of a path and converts forward slashes in both path1 and path2 to the platform's directory separator character.

public static CombinePaths ( string path1, string path2 ) : string
path1 string The first path.
path2 string The second path.
Résultat string

CopyFile() public static méthode

Copies a file filtering its content through the filter chain.
public static CopyFile ( string sourceFileName, string destFileName, FilterChain filterChain, Encoding inputEncoding, Encoding outputEncoding ) : void
sourceFileName string The file to copy
destFileName string The file to copy to
filterChain NAnt.Core.Filters.FilterChain Chain of filters to apply when copying, or is no filters should be applied.
inputEncoding System.Text.Encoding The encoding used to read the soure file.
outputEncoding System.Text.Encoding The encoding used to write the destination file.
Résultat void

GetFullPath() public static méthode

Returns Absolute Path (Fix for 260 Char Limit of Path.GetFullPath(...))
path is a zero-length string, contains only white space or contains one or more invalid characters as defined by . is .
public static GetFullPath ( string path ) : string
path string The file or directory for which to obtain absolute path information.
Résultat string

GetHomeDirectory() public static méthode

Returns the home directory of the current user.
public static GetHomeDirectory ( ) : string
Résultat string

GetTempDirectory() public static méthode

Returns a uniquely named empty temporary directory on disk.
public static GetTempDirectory ( ) : DirectoryInfo
Résultat System.IO.DirectoryInfo

MoveFile() public static méthode

Moves a file filtering its content through the filter chain.
public static MoveFile ( string sourceFileName, string destFileName, FilterChain filterChain, Encoding inputEncoding, Encoding outputEncoding ) : void
sourceFileName string The file to move.
destFileName string The file to move move to.
filterChain NAnt.Core.Filters.FilterChain Chain of filters to apply when moving, or is no filters should be applied.
inputEncoding System.Text.Encoding The encoding used to read the soure file.
outputEncoding System.Text.Encoding The encoding used to write the destination file.
Résultat void

ReadFile() public static méthode

Reads a file filtering its content through the filter chain.
If inputEncoding is , then the system's ANSI code page will be used to read the file.
public static ReadFile ( string fileName, FilterChain filterChain, Encoding inputEncoding ) : string
fileName string The file to read.
filterChain NAnt.Core.Filters.FilterChain Chain of filters to apply when reading, or is no filters should be applied.
inputEncoding System.Text.Encoding The encoding used to read the file.
Résultat string

ResolveFile() public static méthode

Scans a list of directories for the specified filename.
The directories are scanned in the order in which they are defined.
public static ResolveFile ( string directories, string fileName, bool recursive ) : string
directories string The list of directories to search.
fileName string The name of the file to look for.
recursive bool Specifies whether the directory should be searched recursively.
Résultat string