C# Class NetMud.DataAccess.FileSystem.FileAccessor

Show file Open project: SwiftAusterity/NetMud

Public Methods

Method Description
ArchiveDatedFile ( string fileName, string dateFormattedDirectory = "" ) : bool

Archives a file into a date formatted directory

ArchiveFile ( string currentFileName, string archiveFileName ) : bool

Rolls over a file using the default archive settings

ReadCurrentFileByPath ( string fileName ) : byte[]

Reads a file from the "current" directory by a filename

ReadFile ( FileInfo file ) : byte[]

Reads the contents of a file already opened

VerifyDirectory ( string directoryName, bool createIfMissing = true ) : bool

Verifies the existence of or creates a new directory, also creates the base directory if necessary

WriteToFile ( string fullFileName, byte bytes, FileMode writeMode = FileMode.Truncate ) : void

Writes a bytestream to a specific file

Method Details

ArchiveDatedFile() public method

Archives a file into a date formatted directory
public ArchiveDatedFile ( string fileName, string dateFormattedDirectory = "" ) : bool
fileName string the file to roll over
dateFormattedDirectory string overrides the default DatedBackupDirectory setting
return bool

ArchiveFile() public method

Rolls over a file using the default archive settings
public ArchiveFile ( string currentFileName, string archiveFileName ) : bool
currentFileName string the file to be rolled over
archiveFileName string the filename to be rolled over to
return bool

ReadCurrentFileByPath() public method

Reads a file from the "current" directory by a filename
public ReadCurrentFileByPath ( string fileName ) : byte[]
fileName string the file to read in
return byte[]

ReadFile() public method

Reads the contents of a file already opened
public ReadFile ( FileInfo file ) : byte[]
file System.IO.FileInfo the file to read from
return byte[]

VerifyDirectory() public method

Verifies the existence of or creates a new directory, also creates the base directory if necessary
public VerifyDirectory ( string directoryName, bool createIfMissing = true ) : bool
directoryName string the directory to create
createIfMissing bool creates the directory if it doesn't already exist
return bool

WriteToFile() public method

Writes a bytestream to a specific file
public WriteToFile ( string fullFileName, byte bytes, FileMode writeMode = FileMode.Truncate ) : void
fullFileName string the fully qualified filename (with pathing)
bytes byte the data to write
writeMode FileMode should this file be overwritten or appended to
return void