User Tools

Site Tools


en:code:data:inifile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:code:data:inifile [2015/08/17 01:31] – [IniFile] zv_odden:code:data:inifile [2023/10/14 17:20] (current) jmgr
Line 2: Line 2:
 This object allows you to read and write to a INI file. This object allows you to read and write to a INI file.
  
- +===== Quick Use ===== 
-Always Call the **setSection** method on an IniFile object, to actually use it. +Usable example: 
-Usable example, (Will result in value "Bar" being appended ever run)+<code javascript
-<code> +var myObject= new IniFile(); 
-var cfgini = new IniFile(); +myObject.load("config.ini"); 
-cfgini.load("config.ini"); +myObject.setSection("SomeSettingsSection"); 
-cfgini.setSection("SomeSettings"); +if (myObject.keyExists("SomeKey")){ 
-if (cfgini.keyExists("SomeKey")){ + mytext = myObject.keyValue("SomeKey");
- mytext = cfgini.keyValue("SomeKey");+
  newtext = mytext + "Bar";  newtext = mytext + "Bar";
- cfgini.setKeyValue("SomeKey", newtext);+ myObject.setKeyValue("SomeKey", newtext);
 }else{ }else{
- cfgini.setKeyValue("SomeKey", "Foo" );+ myObject.setKeyValue("SomeKey", "Foo" );
  mytext = cfgini.keyValue("SomeKey");  mytext = cfgini.keyValue("SomeKey");
 } }
-cfgini.save("config.ini"); +myObject.save("config.ini"); 
-<code>+</code> 
 +Will result in value "Bar" being appended ever run, except first.  Defaults to "Foo" if Key is unset:
 ===== Functions ===== ===== Functions =====
  
Line 34: Line 34:
 === Arguments === === Arguments ===
   - parameters - (object) parameters   - parameters - (object) parameters
-    * delimiter - (char) the delimiter to use +    * <del>delimiter - (char) the delimiter to use</del> 
-    * commentchar - (char) the comment character+    * <del>commentchar - (char) the comment character</del>
     * encoding - ([[en:code:core:global#encoding|Encoding]]) the encoding to use     * encoding - ([[en:code:core:global#encoding|Encoding]]) the encoding to use
  
Line 253: Line 253:
  
 === Exceptions === === Exceptions ===
-  * (FindSectionError) cannot find the section+  * (KeyError) cannot find the key
  
 ==== keyValue ==== ==== keyValue ====
Line 269: Line 269:
   * (string) the key value   * (string) the key value
  
 +=== Exceptions ===
 +  * (KeyError) cannot find the key
 ==== setKeyValue ==== ==== setKeyValue ====
 Sets the value of the key **keyName**. Sets the value of the key **keyName**.
Line 299: Line 301:
  
 === Exceptions === === Exceptions ===
-  * (FindSectionError) cannot find the section+  * (KeyError) cannot find the key
  
 ==== keyCount ==== ==== keyCount ====
en/code/data/inifile.1439775106.txt.gz · Last modified: 2021/02/13 11:23 (external edit)