C# Class LitDev.LDFile

Afficher le fichier Open project: litdev1/LitDev

Méthodes publiques

Méthode Description
ANSItoUTF8 ( Primitive fileName, Primitive BOM ) : Primitive

Convert an ANSI encoded text file to UTF8. It should also work for any other encoding. UTF8 is the default text file encoding used by Small Basic.

AccessTime ( Primitive fileName ) : Primitive

Gets the last time a file was accessed.

CopyDirectory ( Primitive directoryFrom, Primitive directoryTo ) : Primitive

Recursively copy a directory and all contents including sub-directories.

CreationTime ( Primitive fileName ) : Primitive

Gets the creation time of a file.

Exists ( Primitive fileName ) : Primitive

Check if a file path is an existing file or directory.

GetAllDirectories ( Primitive path ) : Primitive

Recursively get all sub-directories in directory.

GetExtension ( Primitive fileName ) : Primitive

Get the file extension for a file.

GetFile ( Primitive fileName ) : Primitive

Get the file for a full file path.

GetFolder ( Primitive fileName ) : Primitive

Get the folder for a full file path.

Length ( Primitive fileName ) : Primitive

Gets the number of lines in a text file.

LoadAllVariables ( Primitive fileName ) : void

Restore the values of all variables that were previously stored using SaveAllVariables.

ModifiedTime ( Primitive fileName ) : Primitive

Gets the last time a file was modified.

PrintFile ( Primitive fileName ) : void

Print a file.

ReadANSI ( Primitive fileName ) : Primitive

Read an ANSI encoded text file. It should also work for any other encoding including UTF8. UTF8 is the default text file encoding used by Small Basic.

ReadANSIToArray ( Primitive fileName ) : Primitive

Reads a text file with ANSI encoding into an array with one element for each line in the file. It should also work for any other encoding including UTF8. Blank lines are included as an element in the array with one blank space.

ReadCSV ( Primitive fileName ) : Primitive

Read a CSV (comma separated values) file into an array. The deliminator may be changed from a comma using Utilities.CSVdeliminator

ReadCSVTransposed ( Primitive fileName ) : Primitive

Read a CSV (comma separated values) file into an array. and transpose (swap rows and columns). The deliminator may be changed from a comma using Utilities.CSVdeliminator

ReadToArray ( Primitive fileName ) : Primitive

Reads a text file into an array with one element for each line in the file. Blank lines are included as an element in the array with one blank space.

RenameDirectory ( Primitive directoryFrom, Primitive directoryTo ) : Primitive

Rename or move a directory.

RenameFile ( Primitive fileFrom, Primitive fileTo ) : Primitive

Rename or move a file.

SaveAllVariables ( Primitive fileName ) : void

Save all of the current variables to a file. This is the complete current state of your program. May be useful to store a game state, or for debugging.

Size ( Primitive fileName ) : Primitive

Get the size of a file in bytes.

WriteCSV ( Primitive fileName, Primitive array ) : void

Write a 2D array to a CSV (comma separated values) file. The deliminator may be changed from a comma using Utilities.CSVdeliminator

Private Methods

Méthode Description
CopyFilesRecursively ( String SourcePath, String DestinationPath ) : void
GetFileEncoding ( string fileName ) : Encoding
MusicPlayTime ( Primitive fileName ) : Primitive
ReadEncodedFile ( string fileName ) : string
getDirectories ( string dirPath, string &result, int &i ) : void

Method Details

ANSItoUTF8() public static méthode

Convert an ANSI encoded text file to UTF8. It should also work for any other encoding. UTF8 is the default text file encoding used by Small Basic.
public static ANSItoUTF8 ( Primitive fileName, Primitive BOM ) : Primitive
fileName Primitive The file path to convert.
BOM Primitive Include Byte Order Mark (BOM) in UTF8 file ("True" or "False", no BOM is usual).
Résultat Primitive

AccessTime() public static méthode

Gets the last time a file was accessed.
public static AccessTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

CopyDirectory() public static méthode

Recursively copy a directory and all contents including sub-directories.
public static CopyDirectory ( Primitive directoryFrom, Primitive directoryTo ) : Primitive
directoryFrom Primitive The full path to the directory to copy from.
directoryTo Primitive The full path to the directory to copy to.
Résultat Primitive

CreationTime() public static méthode

Gets the creation time of a file.
public static CreationTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

Exists() public static méthode

Check if a file path is an existing file or directory.
public static Exists ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file or directory. ///
Résultat Primitive

GetAllDirectories() public static méthode

Recursively get all sub-directories in directory.
public static GetAllDirectories ( Primitive path ) : Primitive
path Primitive The full path to the root dircetory.
Résultat Primitive

GetExtension() public static méthode

Get the file extension for a file.
public static GetExtension ( Primitive fileName ) : Primitive
fileName Primitive The file name with extension (may include folder path or not).
Résultat Primitive

GetFile() public static méthode

Get the file for a full file path.
public static GetFile ( Primitive fileName ) : Primitive
fileName Primitive The full path of a file.
Résultat Primitive

GetFolder() public static méthode

Get the folder for a full file path.
public static GetFolder ( Primitive fileName ) : Primitive
fileName Primitive The full path of a file.
Résultat Primitive

Length() public static méthode

Gets the number of lines in a text file.
public static Length ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

LoadAllVariables() public static méthode

Restore the values of all variables that were previously stored using SaveAllVariables.
public static LoadAllVariables ( Primitive fileName ) : void
fileName Primitive The full path to a file with stored variable values.
Résultat void

ModifiedTime() public static méthode

Gets the last time a file was modified.
public static ModifiedTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

PrintFile() public static méthode

Print a file.
public static PrintFile ( Primitive fileName ) : void
fileName Primitive The full path of the file to print.
Résultat void

ReadANSI() public static méthode

Read an ANSI encoded text file. It should also work for any other encoding including UTF8. UTF8 is the default text file encoding used by Small Basic.
public static ReadANSI ( Primitive fileName ) : Primitive
fileName Primitive The file path to read.
Résultat Primitive

ReadANSIToArray() public static méthode

Reads a text file with ANSI encoding into an array with one element for each line in the file. It should also work for any other encoding including UTF8. Blank lines are included as an element in the array with one blank space.
public static ReadANSIToArray ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

ReadCSV() public static méthode

Read a CSV (comma separated values) file into an array. The deliminator may be changed from a comma using Utilities.CSVdeliminator
public static ReadCSV ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the CSV file. ///
Résultat Primitive

ReadCSVTransposed() public static méthode

Read a CSV (comma separated values) file into an array. and transpose (swap rows and columns). The deliminator may be changed from a comma using Utilities.CSVdeliminator
public static ReadCSVTransposed ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the CSV file. ///
Résultat Primitive

ReadToArray() public static méthode

Reads a text file into an array with one element for each line in the file. Blank lines are included as an element in the array with one blank space.
public static ReadToArray ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Résultat Primitive

RenameDirectory() public static méthode

Rename or move a directory.
public static RenameDirectory ( Primitive directoryFrom, Primitive directoryTo ) : Primitive
directoryFrom Primitive The full path to the directory to rename.
directoryTo Primitive The full path to the new name for the directory.
Résultat Primitive

RenameFile() public static méthode

Rename or move a file.
public static RenameFile ( Primitive fileFrom, Primitive fileTo ) : Primitive
fileFrom Primitive The full path to the file to rename.
fileTo Primitive The full path to the new name for the file.
Résultat Primitive

SaveAllVariables() public static méthode

Save all of the current variables to a file. This is the complete current state of your program. May be useful to store a game state, or for debugging.
public static SaveAllVariables ( Primitive fileName ) : void
fileName Primitive The full path to store the variables and their values. /// This file will be over-written.
Résultat void

Size() public static méthode

Get the size of a file in bytes.
public static Size ( Primitive fileName ) : Primitive
fileName Primitive The full path to the file to get the size of.
Résultat Primitive

WriteCSV() public static méthode

Write a 2D array to a CSV (comma separated values) file. The deliminator may be changed from a comma using Utilities.CSVdeliminator
public static WriteCSV ( Primitive fileName, Primitive array ) : void
fileName Primitive /// The full path of the CSV file. ///
array Primitive /// The array to export. ///
Résultat void