Outils pour utilisateurs

Outils du site


fr:code:data:inifile

Ceci est une ancienne révision du document !


IniFile [En cours de Traduction Wismerheal][WSL]

Cet objet vous permet de lire et écrire sur un fichier INI.

Fonctions

IniFile

Fonction de construction.

Syntaxe

var myObject = new IniFile();
var myObject = new IniFile(parameters);

Arguments

  1. parameters - (object) paramètres
    • delimiter - (char) le délimiteur à utiliser
    • commentchar - (char) les caractères de commentaire
    • encoding - (Encoding) l'encodage à utiliser

Exceptions

  • (ParameterTypeError) type de paramètre incorrect
  • (ParameterCountError) paramètre de compteur incorrect

Example

Créer l'objet "IniFile" (fichier INI).

var myObject = new IniFile();

Create a IniFile object with parameters.

var myObject = new IniFile({
	delimiter: "=",
	commentCharacter: "$"
});

Méthodes

load

Charger un fichier.

Syntaxe

myObject.load(filename);

Arguments

  1. filename - (string) le nom du fichier à ouvrir

Renvoie

  • (IniFile) cet "IniFile"

Exceptions

  • (LoadFileError) ne parvient pas à charger le fichier

save

Sauvegarder un fichier.

Syntaxe

myObject.save(filename);

Arguments

  1. filename - (string) le nom du fichier à sauvegarder

Renvoie

  • (IniFile) cet "IniFile"

Exceptions

  • (SaveFileError) cannot save the file

clear

Vider un fichier.

Syntaxe

myObject.clear();

Renvoie

  • (IniFile) cet "IniFile"

preserveDeletedData

Conserver les données effacées sous forme de commentaires.

Syntaxe

myObject.preserveDeletedData(preserve);

Arguments

  1. preserve - (boolean) should the deleted data preserved as comments

Returns

  • (IniFile) this IniFile

setDelimiter

Set the value/data delimiter. Default is =.

Syntax

myObject.setDelimiter(delimiter);

Arguments

  1. delimiter - (char) the delimiter to use

Returns

  • (IniFile) this IniFile

setCommentCharacter

Set the comment character. Default is #.

Syntax

myObject.setCommentCharacter(commentchar);

Arguments

  1. commentchar - (char) the comment character

Returns

  • (IniFile) this IniFile

setSection

Sets the current INI section.

Syntax

myObject.setSection(sectionName);
myObject.setSection(sectionName, create);

Arguments

  1. sectionName - (string) the section name
  2. create - (boolean) create the section if it doesn't exists (default: true)

Returns

  • (IniFile) this IniFile

Exceptions

  • (FindSectionError) cannot find the section

setEncoding

Sets the encoding to use.

Syntax

myObject.setEncoding(encoding);

Arguments

  1. encoding - (Encoding) the encoding to use

Returns

  • (IniFile) this IniFile

sectionAt

Returns the section name at index sectionIndex.

Syntax

myObject.sectionAt(sectionIndex);

Arguments

  1. sectionIndex - (integer) the section index

Returns

  • (string) the section name

Exceptions

  • (FindSectionError) cannot find the section

deleteSection

Deletes a section.

Syntax

myObject.deleteSection(sectionName);

Arguments

  1. sectionName - (string) the section name

Returns

  • (IniFile) this IniFile

Exceptions

  • (FindSectionError) cannot find the section

sectionCount

Returns the number of sections.

Syntax

myObject.sectionCount();

Returns

  • (integer) the section count

keyExists

Returns true if a key with keyName exists.

Syntax

myObject.keyExists(keyName);

Arguments

  1. keyName - (string) the key name

Returns

  • (boolean) true if a key with keyName exists

keyAt

Returns the name of the key at index keyIndex.

Syntax

myObject.keyAt(keyIndex);

Arguments

  1. keyIndex - (integer) the key index

Returns

  • (string) the key name

Exceptions

  • (FindSectionError) cannot find the section

keyValue

Returns the value of the key keyName.

Syntax

myObject.keyValue(keyName);

Arguments

  1. keyName - (string) the key name

Returns

  • (string) the key value

setKeyValue

Sets the value of the key keyName.

Syntax

myObject.keyValue(keyName, value);

Arguments

  1. keyName - (string) the key name
  2. value - (string) the key value

Returns

  • (IniFile) this IniFile

deleteKey

Delete the key keyName.

Syntax

myObject.deleteKey(keyName);

Arguments [En cours de Traduction Wismerheal][WSL]

  1. keyName - (string) the key name

Returns

  • (IniFile) this IniFile

Exceptions

  • (FindSectionError) cannot find the section

keyCount

Returns the key count.

Syntax

myObject.keyCount();

Returns

  • (integer) the key count
fr/code/data/inifile.1332427611.txt.gz · Dernière modification : 2021/02/13 11:23 (modification externe)