LitDev Extension API

GW LD3DView LDArray LDBits LDBlueTooth
LDCall LDChart LDClient LDClipboard LDColours
LDCommPort LDController LDControls LDCursors LDDataBase
LDDateTime LDDebug LDDialogs LDDictionary LDEffect
LDEmail LDEncryption LDEvents LDFastArray LDFastShapes
LDFigures LDFile LDFinances LDFocus LDftp
LDGeography LDGraph LDGraphicsWindow LDHashTable LDHID
LDIcon LDImage LDInline LDIOWarrior LDList
LDLogic LDMath LDMathX LDMatrix LDMusic
LDNetwork LDPhysics LDProcess LDQueue LDRegex
LDResources LDScrollBars LDSearch LDServer LDSettings
LDShapes LDShell LDSort LDSound LDSpeech
LDStatistics LDStopwatch LDText LDTextWindow LDTimer
LDTranslate LDUnits LDUtilities LDVector LDWaveForm
LDWebCam LDWindows LDxml LDZip TW

LDFile
File utilities.

AccessTime ANSItoUTF8 AppDataFolder
CopyDirectory CreationTime CSVplaceholder
DocumentsFolder Exists GetAllDirectories
GetExtension GetFile GetFolder
Length LoadAllVariables ModifiedTime
MusicFolder PicturesFolder PrintFile
PublicFolder ReadANSI ReadANSIToArray
ReadByteArray ReadCSV ReadCSVTransposed
ReadToArray RenameDirectory RenameFile
SaveAllVariables Size TempFolder
UserName WriteByteArray WriteCSV
WriteFromArray

AccessTime(fileName)
Gets the last time a file was accessed.
fileName The full path of the file.
returns The last access time of the file or directory ("" on failure).

ANSItoUTF8(fileName,BOM)
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.

fileName The file path to convert.
BOM Include Byte Order Mark (BOM) in UTF8 file ("True" or "False", no BOM is usual).
returns The converted file path (-UTF8.txt) or "" for failure (the encoding may not have been detected correctly).

AppDataFolder
Gets the ApplicationData folder path.

CopyDirectory(directoryFrom,directoryTo)
Recursively copy a directory and all contents including sub-directories.
directoryFrom The full path to the directory to copy from.
directoryTo The full path to the directory to copy to.
returns "SUCCESS" or "FAILED".

CreationTime(fileName)
Gets the creation time of a file.
fileName The full path of the file.
returns The creation time of the file or directory ("" on failure).

CSVplaceholder
Character to use in place of empty values in the imported array when reading CSV files.
A SmallBasic array cannot hold an empty value i.e. "".

Default is the empty string "" (no array entries created for empty values in the CSV file).


DocumentsFolder
Gets the Documents folder path.

Exists(fileName)
Check if a file path is an existing file or directory.
fileName The full path of the file or directory.
returns "True" or "False".

GetAllDirectories(path)
Recursively get all sub-directories in directory.
path The full path to the root dircetory.
returns An array of all sub-directories or "FAILED".

GetExtension(fileName)
Get the file extension for a file.
fileName The file name with extension (may include folder path or not).
returns The extension of the file (without the '.') or "" if no extension.

GetFile(fileName)
Get the file for a full file path.
fileName The full path of a file.
returns The file name part of the file path (without the folder or the extension).

GetFolder(fileName)
Get the folder for a full file path.
fileName The full path of a file.
returns The folder part of the file path.

Length(fileName)
Gets the number of lines in a text file.
fileName The full path of the file.
returns The number of lines in the file (-1 on failure).

LoadAllVariables(fileName)
Restore the values of all variables that were previously stored using SaveAllVariables.
fileName The full path to a file with stored variable values.

ModifiedTime(fileName)
Gets the last time a file was modified.
fileName The full path of the file.
returns The last modified time of the file or directory ("" on failure).

MusicFolder
Gets the Music folder path.

PicturesFolder
Gets the Pictures folder path.

PrintFile(fileName)
Print a file.
fileName The full path of the file to print.

PublicFolder
Gets the Public folder path.

ReadANSI(fileName)
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.

fileName The file path to read.
returns The contents of the file or "" for failure (the encoding may not have been detected correctly).

ReadANSIToArray(fileName)
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.

fileName The full path of the file.
returns An array with one element for each line in the file or "" for failure (the encoding may not have been detected correctly).

ReadByteArray(filePath,hexMode)
Read a file into an array of bytes [0,255].
filePath The full path of the file.
hexMode If this varaible is set to "True", then a single comma deliminated variable of hex values is returned in place of an anrray..
returns An array of byte values indexed from 1, or single string variable of hex values, or "FAILED".

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

fileName The full path of the CSV file.
returns A 2D array with CSV file imported.

ReadCSVTransposed(fileName)
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

fileName The full path of the CSV file.
returns 2D array with transposed CSV file imported.

ReadToArray(fileName)
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.

fileName The full path of the file.
returns An array with one element for each line in the file.

RenameDirectory(directoryFrom,directoryTo)
Rename or move a directory.
directoryFrom The full path to the directory to rename.
directoryTo The full path to the new name for the directory.
returns "SUCCESS" or "FAILED".

RenameFile(fileFrom,fileTo)
Rename or move a file.
fileFrom The full path to the file to rename.
fileTo The full path to the new name for the file.
returns "SUCCESS" or "FAILED".

SaveAllVariables(fileName)
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.

fileName The full path to store the variables and their values.
This file will be over-written.


Size(fileName)
Get the size of a file in bytes.
fileName The full path to the file to get the size of.
returns The number of bytes in the file or -1 on error.

TempFolder
Gets the Temp folder path.

UserName
Gets the current user name.

WriteByteArray(filePath,byteArray,startPos)
Writes an Array of bytes to an (existing) file.
filePath The full path of the file. A non existing file will be created.
byteArray The 1D Array (from 1, continously) with byte values [0,255].
A single comma or sapce separated variable may also be used using hex notation, eg 3D,1F,00.

startPos The byte position (incl., from 1) in an existing file to start writing (ignored for non existing file, will be written from beginning).
<=1, from file start
>file length, append after file end

returns The number of written bytes on success, else "FAILED".
example '(over)writes from file start
WriteByteArray(path, arr, 1)
'SB© after 4th byte
WriteByteArray(path, "1=83;2=66;3=169;",5)


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

fileName The full path of the CSV file.
array The array to export.
returns None.

WriteFromArray(fileName,array,append)
Writes a text file from an array with one line in the file for each value in the array.
fileName The full path of the file.
array An array to output to the file.
append Append to an existing file "True" or over-write "False".
returns "SUCCESS" or "FAILED".