C# Класс LitDev.LDFile

Показать файл Открыть проект

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

ANSItoUTF8() публичный статический Метод

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).
Результат Primitive

AccessTime() публичный статический Метод

Gets the last time a file was accessed.
public static AccessTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Результат Primitive

CopyDirectory() публичный статический Метод

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.
Результат Primitive

CreationTime() публичный статический Метод

Gets the creation time of a file.
public static CreationTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Результат Primitive

Exists() публичный статический Метод

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. ///
Результат Primitive

GetAllDirectories() публичный статический Метод

Recursively get all sub-directories in directory.
public static GetAllDirectories ( Primitive path ) : Primitive
path Primitive The full path to the root dircetory.
Результат Primitive

GetExtension() публичный статический Метод

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).
Результат Primitive

GetFile() публичный статический Метод

Get the file for a full file path.
public static GetFile ( Primitive fileName ) : Primitive
fileName Primitive The full path of a file.
Результат Primitive

GetFolder() публичный статический Метод

Get the folder for a full file path.
public static GetFolder ( Primitive fileName ) : Primitive
fileName Primitive The full path of a file.
Результат Primitive

Length() публичный статический Метод

Gets the number of lines in a text file.
public static Length ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Результат Primitive

LoadAllVariables() публичный статический Метод

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.
Результат void

ModifiedTime() публичный статический Метод

Gets the last time a file was modified.
public static ModifiedTime ( Primitive fileName ) : Primitive
fileName Primitive /// The full path of the file. ///
Результат Primitive

PrintFile() публичный статический Метод

Print a file.
public static PrintFile ( Primitive fileName ) : void
fileName Primitive The full path of the file to print.
Результат void

ReadANSI() публичный статический Метод

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.
Результат Primitive

ReadANSIToArray() публичный статический Метод

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. ///
Результат Primitive

ReadCSV() публичный статический Метод

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. ///
Результат Primitive

ReadCSVTransposed() публичный статический Метод

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. ///
Результат Primitive

ReadToArray() публичный статический Метод

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. ///
Результат Primitive

RenameDirectory() публичный статический Метод

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.
Результат Primitive

RenameFile() публичный статический Метод

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.
Результат Primitive

SaveAllVariables() публичный статический Метод

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.
Результат void

Size() публичный статический Метод

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.
Результат Primitive

WriteCSV() публичный статический Метод

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. ///
Результат void