Craig's Utility Library  4.0 Beta
Utilities.IO.FileInfo Class Reference

File info class More...

Inheritance diagram for Utilities.IO.FileInfo:
Utilities.IO.FileSystem.Interfaces.IFile

Public Member Functions

 FileInfo (string Path, string UserName="", string Password="", string Domain="")
 Constructor More...
 
 FileInfo (IFile InternalFile)
 Constructor More...
 
object Clone ()
 Clones the file object More...
 
int CompareTo (IFile other)
 Compares this to another file More...
 
int CompareTo (object obj)
 Compares this object to another object More...
 
IFile CopyTo (IDirectory Directory, bool Overwrite)
 Copies the file to another directory More...
 
string Delete ()
 Deletes the file More...
 
override bool Equals (object obj)
 Determines if the objects are equal More...
 
bool Equals (IFile other)
 Determines if the files are equal More...
 
Process Execute (ProcessStartInfo Info=null)
 Executes the file More...
 
override int GetHashCode ()
 Gets the hash code for the file More...
 
void MoveTo (IDirectory Directory)
 Moves the file to a new directory More...
 
string Read ()
 Reads the file in as a string More...
 
byte[] ReadBinary ()
 Reads a file as binary More...
 
void Rename (string NewName)
 Renames the file More...
 
To< T > ()
 Converts the file to the specified file format More...
 
To< T, R > ()
 Converts the file to the specified file format More...
 
Excel To ()
 Converts the file to the specified file format More...
 
override string ToString ()
 Returns the name of the file More...
 
string Write (string Content, System.IO.FileMode Mode=FileMode.Create, Encoding Encoding=null)
 Writes content to the file More...
 
byte[] Write (byte[] Content, System.IO.FileMode Mode=FileMode.Create)
 Writes content to the file More...
 
- Public Member Functions inherited from Utilities.IO.FileSystem.Interfaces.IFile
string Write (string Content, FileMode Mode=FileMode.Create, Encoding Encoding=null)
 Writes content to the file More...
 
byte[] Write (byte[] Content, FileMode Mode=FileMode.Create)
 Writes content to the file More...
 

Static Public Member Functions

static bool operator!= (FileInfo File1, FileInfo File2)
 Determines if two directories are not equal More...
 
static bool operator< (FileInfo File1, FileInfo File2)
 Less than More...
 
static bool operator<= (FileInfo File1, FileInfo File2)
 Less than or equal More...
 
static bool operator== (FileInfo File1, FileInfo File2)
 Determines if two directories are equal More...
 
static bool operator> (FileInfo File1, FileInfo File2)
 Greater than More...
 
static bool operator>= (FileInfo File1, FileInfo File2)
 Greater than or equal More...
 
static implicit operator byte[] (FileInfo File)
 Reads the file and converts it to a byte array More...
 
static implicit operator string (FileInfo File)
 Reads the file and converts it to a string More...
 

Properties

DateTime Accessed [get]
 Last time accessed (UTC time) More...
 
DateTime Created [get]
 Time created (UTC time) More...
 
IDirectory Directory [get]
 Directory the file is within More...
 
bool Exists [get]
 Does the file exist? More...
 
string Extension [get]
 File extension More...
 
string FullName [get]
 Full path More...
 
long Length [get]
 Size of the file More...
 
DateTime Modified [get]
 Time modified (UTC time) More...
 
string Name [get]
 Name of the file More...
 
IFile InternalFile [get]
 Internal directory More...
 
- Properties inherited from Utilities.IO.FileSystem.Interfaces.IFile
DateTime Accessed [get]
 Last time the file was accessed More...
 
DateTime Created [get]
 When the file was created More...
 
IDirectory Directory [get]
 Directory the file is in More...
 
bool Exists [get]
 Does the file exist currently More...
 
string Extension [get]
 File extension More...
 
string FullName [get]
 Full path to the file More...
 
long Length [get]
 Size of the file in bytes More...
 
DateTime Modified [get]
 When the file was last modified More...
 
string Name [get]
 File name More...
 

Detailed Description

File info class

Definition at line 36 of file FileInfo.cs.

Constructor & Destructor Documentation

Utilities.IO.FileInfo.FileInfo ( string  Path,
string  UserName = "",
string  Password = "",
string  Domain = "" 
)

Constructor

Parameters
PathPath to the file
DomainDomain of the user (optional)
PasswordPassword to be used to access the file (optional)
UserNameUser name to be used to access the file (optional)

Definition at line 45 of file FileInfo.cs.

Utilities.IO.FileInfo.FileInfo ( IFile  InternalFile)

Constructor

Parameters
InternalFileInternal file

Definition at line 54 of file FileInfo.cs.

Member Function Documentation

object Utilities.IO.FileInfo.Clone ( )

Clones the file object

Returns
The cloned object

Definition at line 215 of file FileInfo.cs.

int Utilities.IO.FileInfo.CompareTo ( IFile  other)

Compares this to another file

Parameters
otherFile to compare to
Returns

Definition at line 226 of file FileInfo.cs.

int Utilities.IO.FileInfo.CompareTo ( object  obj)

Compares this object to another object

Parameters
objObject to compare it to
Returns

Definition at line 240 of file FileInfo.cs.

IFile Utilities.IO.FileInfo.CopyTo ( IDirectory  Directory,
bool  Overwrite 
)

Copies the file to another directory

Parameters
DirectoryDirectory to copy the file to
OverwriteShould the file overwrite another file if found
Returns
The newly created file

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 254 of file FileInfo.cs.

string Utilities.IO.FileInfo.Delete ( )

Deletes the file

Returns
Any response for deleting the resource (usually FTP, HTTP, etc)

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 265 of file FileInfo.cs.

override bool Utilities.IO.FileInfo.Equals ( object  obj)

Determines if the objects are equal

Parameters
objObject to compare to
Returns
True if they are equal, false otherwise

Definition at line 277 of file FileInfo.cs.

bool Utilities.IO.FileInfo.Equals ( IFile  other)

Determines if the files are equal

Parameters
otherOther file
Returns
True if they are equal, false otherwise

Definition at line 288 of file FileInfo.cs.

Process Utilities.IO.FileInfo.Execute ( ProcessStartInfo  Info = null)

Executes the file

Parameters
InfoInfo used to execute the file
Returns
The process object created when the executable is started

Definition at line 300 of file FileInfo.cs.

override int Utilities.IO.FileInfo.GetHashCode ( )

Gets the hash code for the file

Returns
The hash code

Definition at line 313 of file FileInfo.cs.

void Utilities.IO.FileInfo.MoveTo ( IDirectory  Directory)

Moves the file to a new directory

Parameters
DirectoryDirectory to move to

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 322 of file FileInfo.cs.

static implicit Utilities.IO.FileInfo.operator byte[] ( FileInfo  File)
static

Reads the file and converts it to a byte array

Parameters
FileFile to read
Returns
The file as a byte array

Definition at line 192 of file FileInfo.cs.

static implicit Utilities.IO.FileInfo.operator string ( FileInfo  File)
static

Reads the file and converts it to a string

Parameters
FileFile to read
Returns
The file as a string

Definition at line 204 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator!= ( FileInfo  File1,
FileInfo  File2 
)
static

Determines if two directories are not equal

Parameters
File1File 1
File2File 2
Returns
True if they are not equal, false otherwise

Definition at line 115 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator< ( FileInfo  File1,
FileInfo  File2 
)
static

Less than

Parameters
File1File 1
File2File 2
Returns
The result

Definition at line 126 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator<= ( FileInfo  File1,
FileInfo  File2 
)
static

Less than or equal

Parameters
File1File 1
File2File 2
Returns
The result

Definition at line 139 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator== ( FileInfo  File1,
FileInfo  File2 
)
static

Determines if two directories are equal

Parameters
File1File 1
File2File 2
Returns
True if they are, false otherwise

Definition at line 152 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator> ( FileInfo  File1,
FileInfo  File2 
)
static

Greater than

Parameters
File1File 1
File2File 2
Returns
The result

Definition at line 167 of file FileInfo.cs.

static bool Utilities.IO.FileInfo.operator>= ( FileInfo  File1,
FileInfo  File2 
)
static

Greater than or equal

Parameters
File1File 1
File2File 2
Returns
The result

Definition at line 180 of file FileInfo.cs.

string Utilities.IO.FileInfo.Read ( )

Reads the file in as a string

Returns
The file contents as a string

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 333 of file FileInfo.cs.

byte [] Utilities.IO.FileInfo.ReadBinary ( )

Reads a file as binary

Returns
The file contents as a byte array

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 344 of file FileInfo.cs.

void Utilities.IO.FileInfo.Rename ( string  NewName)

Renames the file

Parameters
NewNameNew name for the file

Implements Utilities.IO.FileSystem.Interfaces.IFile.

Definition at line 355 of file FileInfo.cs.

Excel Utilities.IO.FileInfo.To ( )

Converts the file to the specified file format

Returns
The file as the file format object

Definition at line 389 of file FileInfo.cs.

Converts the file to the specified file format

Template Parameters
TFile format
Returns
The file as the file format object
Type Constraints
T :FormatBase 
T :T 
T :string 
T :new() 

Definition at line 367 of file FileInfo.cs.

T Utilities.IO.FileInfo.To< T, R > ( )

Converts the file to the specified file format

Template Parameters
TFile format
RRecord type
Returns
The file as the file format object
Type Constraints
T :StringListFormatBase 
T :T 
T :R 
T :new() 

Definition at line 379 of file FileInfo.cs.

override string Utilities.IO.FileInfo.ToString ( )

Returns the name of the file

Returns
The name of the file

Definition at line 398 of file FileInfo.cs.

string Utilities.IO.FileInfo.Write ( string  Content,
System.IO.FileMode  Mode = FileMode.Create,
Encoding  Encoding = null 
)

Writes content to the file

Parameters
ContentContent to write
ModeMode to open the file as
EncodingEncoding to use for the content
Returns
The result of the write or original content

Definition at line 410 of file FileInfo.cs.

byte [] Utilities.IO.FileInfo.Write ( byte[]  Content,
System.IO.FileMode  Mode = FileMode.Create 
)

Writes content to the file

Parameters
ContentContent to write
ModeMode to open the file as
Returns
The result of the write or original content

Definition at line 423 of file FileInfo.cs.

Property Documentation

DateTime Utilities.IO.FileInfo.Accessed
get

Last time accessed (UTC time)

Definition at line 62 of file FileInfo.cs.

DateTime Utilities.IO.FileInfo.Created
get

Time created (UTC time)

Definition at line 67 of file FileInfo.cs.

IDirectory Utilities.IO.FileInfo.Directory
get

Directory the file is within

Definition at line 72 of file FileInfo.cs.

bool Utilities.IO.FileInfo.Exists
get

Does the file exist?

Definition at line 77 of file FileInfo.cs.

string Utilities.IO.FileInfo.Extension
get

File extension

Definition at line 82 of file FileInfo.cs.

string Utilities.IO.FileInfo.FullName
get

Full path

Definition at line 87 of file FileInfo.cs.

IFile Utilities.IO.FileInfo.InternalFile
getprotected

Internal directory

Definition at line 107 of file FileInfo.cs.

long Utilities.IO.FileInfo.Length
get

Size of the file

Definition at line 92 of file FileInfo.cs.

DateTime Utilities.IO.FileInfo.Modified
get

Time modified (UTC time)

Definition at line 97 of file FileInfo.cs.

string Utilities.IO.FileInfo.Name
get

Name of the file

Definition at line 102 of file FileInfo.cs.


The documentation for this class was generated from the following file: