C# Class Azavea.NijPredictivePolicing.Common.FileUtilities

Datei anzeigen Open project: azavea/acs-alchemist

Public Methods

Method Description
CleanPath ( string OutputFolder ) : string
FindFileNameInZipLike ( string zipFileName, string pattern ) : List

Uses Ionic.Zip library to search a compressed file for a given pattern

GetApplicationPath ( ) : string
PathCombine ( ) : string

Like Path.Combine(), only works for an arbitrary number of arguments

PathEnsure ( string basepath ) : string

Given a basepath and a list of names of subdirectories, creates the subdirectories if necessary. Throws exceptions on error.

SafePathEnsure ( string basepath ) : string

Wrapper around PathEnsure() that doesn't throw exceptions. Returns "" on error and prints an error message to _log

TryChangeCreationTime ( string filename, System.DateTime newTime ) : bool

Try changing the file's creation time without exceptions. Returns true on success, false on failure.

TryChangeLastWriteTime ( string filename, System.DateTime newTime ) : bool

Try changing the file's last write time without exceptions. Returns true on success, false on failure.

TryDelete ( string filename ) : bool

Delete without exceptions. Returns true on success, false on failure.

UnzipFileTo ( string basePath, string zipFileName ) : bool

Uses Ionic.Zip library to expand a file (without overwriting) to a given location

Method Details

CleanPath() public static method

public static CleanPath ( string OutputFolder ) : string
OutputFolder string
return string

FindFileNameInZipLike() public static method

Uses Ionic.Zip library to search a compressed file for a given pattern
public static FindFileNameInZipLike ( string zipFileName, string pattern ) : List
zipFileName string
pattern string
return List

GetApplicationPath() public static method

public static GetApplicationPath ( ) : string
return string

PathCombine() public static method

Like Path.Combine(), only works for an arbitrary number of arguments
public static PathCombine ( ) : string
return string

PathEnsure() public static method

Given a basepath and a list of names of subdirectories, creates the subdirectories if necessary. Throws exceptions on error.
public static PathEnsure ( string basepath ) : string
basepath string A path to a directory that already exists
return string

SafePathEnsure() public static method

Wrapper around PathEnsure() that doesn't throw exceptions. Returns "" on error and prints an error message to _log
public static SafePathEnsure ( string basepath ) : string
basepath string
return string

TryChangeCreationTime() public static method

Try changing the file's creation time without exceptions. Returns true on success, false on failure.
public static TryChangeCreationTime ( string filename, System.DateTime newTime ) : bool
filename string
newTime System.DateTime
return bool

TryChangeLastWriteTime() public static method

Try changing the file's last write time without exceptions. Returns true on success, false on failure.
public static TryChangeLastWriteTime ( string filename, System.DateTime newTime ) : bool
filename string
newTime System.DateTime
return bool

TryDelete() public static method

Delete without exceptions. Returns true on success, false on failure.
public static TryDelete ( string filename ) : bool
filename string
return bool

UnzipFileTo() public static method

Uses Ionic.Zip library to expand a file (without overwriting) to a given location
public static UnzipFileTo ( string basePath, string zipFileName ) : bool
basePath string
zipFileName string
return bool