TParamsFile Class

Definition

TParamsFile work as an instance of a settings file. You can have more than one instance for more than 1 settings file.

Delphi
type TParamsFile = class(TObject)
Inheritance
TObject
TParamsFile

Constructors

Create

Class constructor wich just initialize private fields.

Create(string)

Class constructor wich loads the parameter file specified as parameter.

Destroy

Instance destructor

Properties

PortableMode

Portable mode : if true nothing is saved nor loaded. Default value is false.

onAfterLoadEvent

Called after loading the settings file

onAfterLoadProc
onAfterSaveEvent

Called after saving the settings file

onAfterSaveProc
onBeforeLoadEvent

Called before loading the settings file.

onBeforeLoadProc
onBeforeSaveEvent

Called before saving the settings file

onBeforeSaveProc
onCryptEvent

Called before saving the parameters in a file (and after onBeforeSave). If crypted, the file is saved as a binary format. If uncrypted, the file is saved as a JSON text file.

onCryptProc
onDecryptEvent

Called after loading the parameters from a file (and before onAfterLoad). If crypted, the file is saved as a binary format. If uncrypted, the file is saved as a JSON text file.

onDecryptProc

Methods

AsJSONObject(Boolean)

Return the current parameters as a JSON object

BeginUpdate

Allow parameters changes but delay the Save operation to the EndUpdate call.

Cancel

Cancel current changes and reload previous saved values

Clear

Clear current parameters list

Delete(Boolean)

Delete the file where settings are stored.

EndUpdate(Boolean)

Closes the block of code started with BeginUpdate. If you did some changes, it saves them by default.

HasChanged

Returns True if a setting has changed and not been saved.

InitDefaultFileNameV2(string, string, Boolean)

Initialise the folder and the filename with a new default tree: => "Documents / Editor / Software" for DEBUG and iOS => "AppData (HomePath) / Editor / Software" in RELEASE (except iOS)

Load

Load parameters from actual parameter file

MoveToFilePath(string, Boolean, Boolean)

Move actual parameter file to the new file.

Remove(string)

Retire une clé des paramètres

Save

Save current parameters to actual parameter file

SetPortableMode(Boolean)
SetonAfterLoadEvent(TParamsLoadSaveEvent)
SetonAfterLoadProc(TParamsLoadSaveProc)
SetonAfterSaveEvent(TParamsLoadSaveEvent)
SetonAfterSaveProc(TParamsLoadSaveProc)
SetonBeforeLoadEvent(TParamsLoadSaveEvent)
SetonBeforeLoadProc(TParamsLoadSaveProc)
SetonBeforeSaveEvent(TParamsLoadSaveEvent)
SetonBeforeSaveProc(TParamsLoadSaveProc)
SetonCryptEvent(TParamsCryptEvent)
SetonCryptProc(TParamsCryptProc)
SetonDecryptEvent(TParamsDecryptEvent)
SetonDecryptProc(TParamsDecryptProc)
ToJSON

Return the current parameters as a serialized JSON object.

getFilePath

Return the absolute path to the parameter file (drive+folder+file name+extension)

getParamValue(string)
getParamsFileName(Boolean)
getValue(string, Boolean)

Get the boolean value for key parameter with False as default value

getValue(string, Cardinal)

Get the cardinal value for key parameter with zero as default value

getValue(string, Integer)

Get the integer value for key parameter with zero as default value

getValue(string, Single)

Get the single value for key parameter with zero as default value

getValue(string, TDateTime)

Get the TDateTime value for key parameter with December 30th 1899 at 12:00 as default value

getValue(string, TJSONValue)

Get the JSON value for key parameter with nil as default value

getValue(string, string)

Get the string value for key parameter with an empty string as default value

setFilePath(string, Boolean)

Change the folder where is the parameter file.

setFolderName(string, Boolean)

Change the folder where is the parameter file.

setParamValue(string, TJSONValue)
setValue(string, Boolean)

Set the value for key parameter as boolean

setValue(string, Cardinal)

Set the value for key parameter as cardinal

setValue(string, Integer)

Set the value for key parameter as integer

setValue(string, Single)

Set the value for key parameter as single

setValue(string, TDateTime)

Set the value for key parameter as TDateTime

setValue(string, TJSONValue)

Set the value for key parameter as TJSONValue

setValue(string, string)

Set the value for key parameter as string

Fields