C# 클래스 ChinhDo.Transactions.TxFileManager

File Resource Manager. Allows inclusion of file system operations in transactions. http://www.chinhdo.com/20080825/transactional-file-manager/
상속: IFileManager
파일 보기 프로젝트 열기: NexusMods/NexusModManager-4.5 1 사용 예제들

공개 메소드들

메소드 설명
AppendAllText ( string path, string contents ) : void

Appends the specified string the file, creating the file if it doesn't already exist.

Copy ( string sourceFileName, string destFileName, bool overwrite ) : void

Copies the specified sourceFileName to destFileName.

CreateDirectory ( string path ) : void

Creates all directories in the specified path.

Delete ( string path ) : void

Deletes the specified file. An exception is not thrown if the file does not exist.

DirectoryExists ( string path ) : bool

Determines whether the specified path refers to a directory that exists on disk.

FileExists ( string path ) : bool

Determines whether the specified file exists.

GetFiles ( string path, FileEventHandler handler, bool recursive ) : void

Gets the files in the specified directory.

GetGuid ( ) : System.Guid

Gets a GUID.

GetTempDirectory ( ) : string

Gets a temporary directory.

GetTempDirectory ( string parentDirectory, string prefix ) : string

Gets a temporary directory.

GetTempFileName ( ) : string

Creates a temporary file name. File is not automatically created.

GetTempFileName ( string extension ) : string

Creates a temporary file name. File is not automatically created.

Move ( string srcFileName, string destFileName ) : void

Moves the specified file to a new location.

Snapshot ( string fileName ) : void

Take a snapshot of the specified file. The snapshot is used to rollback the file later if needed.

WriteAllBytes ( string path, byte contents ) : void

Creates a file, and writes the specified contents to the file. If the file already exists, it is overwritten.

WriteAllText ( string path, string contents ) : void

Creates a file, write the specified contents to the file.

비공개 메소드들

메소드 설명
GetEnlistment ( ) : ChinhDo.Transactions.TxEnlistment
TxFileManager ( ) : System

Initializes the TxFileManager class.

메소드 상세

AppendAllText() 공개 메소드

Appends the specified string the file, creating the file if it doesn't already exist.
public AppendAllText ( string path, string contents ) : void
path string The file to append the string to.
contents string The string to append to the file.
리턴 void

Copy() 공개 메소드

Copies the specified sourceFileName to destFileName.
public Copy ( string sourceFileName, string destFileName, bool overwrite ) : void
sourceFileName string The file to copy.
destFileName string The name of the destination file.
overwrite bool true if the destination file can be overwritten, otherwise false.
리턴 void

CreateDirectory() 공개 메소드

Creates all directories in the specified path.
public CreateDirectory ( string path ) : void
path string The directory path to create.
리턴 void

Delete() 공개 메소드

Deletes the specified file. An exception is not thrown if the file does not exist.
public Delete ( string path ) : void
path string The file to be deleted.
리턴 void

DirectoryExists() 공개 메소드

Determines whether the specified path refers to a directory that exists on disk.
public DirectoryExists ( string path ) : bool
path string The directory to check.
리턴 bool

FileExists() 공개 메소드

Determines whether the specified file exists.
public FileExists ( string path ) : bool
path string The file to check.
리턴 bool

GetFiles() 공개 메소드

Gets the files in the specified directory.
public GetFiles ( string path, FileEventHandler handler, bool recursive ) : void
path string The directory to get files.
handler FileEventHandler The object to call on each file found.
recursive bool if set to true, include files in sub directories recursively.
리턴 void

GetGuid() 공개 정적인 메소드

Gets a GUID.
public static GetGuid ( ) : System.Guid
리턴 System.Guid

GetTempDirectory() 공개 메소드

Gets a temporary directory.
public GetTempDirectory ( ) : string
리턴 string

GetTempDirectory() 공개 메소드

Gets a temporary directory.
public GetTempDirectory ( string parentDirectory, string prefix ) : string
parentDirectory string The parent directory.
prefix string The prefix of the directory name.
리턴 string

GetTempFileName() 공개 메소드

Creates a temporary file name. File is not automatically created.
public GetTempFileName ( ) : string
리턴 string

GetTempFileName() 공개 메소드

Creates a temporary file name. File is not automatically created.
public GetTempFileName ( string extension ) : string
extension string File extension (with the dot).
리턴 string

Move() 공개 메소드

Moves the specified file to a new location.
public Move ( string srcFileName, string destFileName ) : void
srcFileName string The name of the file to move.
destFileName string The new path for the file.
리턴 void

Snapshot() 공개 메소드

Take a snapshot of the specified file. The snapshot is used to rollback the file later if needed.
public Snapshot ( string fileName ) : void
fileName string The file to take a snapshot for.
리턴 void

WriteAllBytes() 공개 메소드

Creates a file, and writes the specified contents to the file. If the file already exists, it is overwritten.
public WriteAllBytes ( string path, byte contents ) : void
path string The file to write to.
contents byte The bytes to write to the file.
리턴 void

WriteAllText() 공개 메소드

Creates a file, write the specified contents to the file.
public WriteAllText ( string path, string contents ) : void
path string The file to write to.
contents string The string to write to the file.
리턴 void