TParams Class

Definition

Use TParams with its class methods if you only want to manage one settings file. If you need more than 1 file to store your settings in the same project, crreate instances of TParamsFile instead of using TParams.

Delphi
type TParams = class(TObject)
Inheritance
TObject
TParams

Remarks

TParams is here for compatibility with old projects.

Properties

PortableMode

Portable mode : if true nothing is done on the storage. 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

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.

GetPortableMode
GetonAfterLoadEvent
GetonAfterLoadProc
GetonAfterSaveEvent
GetonAfterSaveProc
GetonBeforeLoadEvent
GetonBeforeLoadProc
GetonBeforeSaveEvent
GetonBeforeSaveProc
GetonCryptEvent
GetonCryptProc
GetonDecryptEvent
GetonDecryptProc
HasChanged
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)

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.

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