Reference Design Content

cancel
Showing results for 
Search instead for 
Did you mean: 

Enhanced Configuration File VIs (Support for Unicode & Multi-line Key Values)

This library provides enhanced functionality for handling INI configuration files. Instead of using the Config File VIs included in LabVIEW (palette -> File I/O -> Configuration File VIs), use the like-named top-level VIs in Enhanced Config.llb, or access them via the Config Main folder in Enhanced Config.lvlib. Note that this library is not yet complete: The functions Remove Key.vi and Remove Section.vi are not provided. Also, the function Not A Config Data Refnum.vi is not provided, however the version in vi.lib will work with these new functions.

 

You can have this for free (and it's worth every penny!), but I offer no guarantee that it all works as it should. 

Use it at your own risk.

 

There are 2 enhancements over the native LabVIEW Configuration File VIs.


1. Support for Unicode INI Configuration Files

 

The following file formats are supported:


ASCII, UTF-16 Big Endian, and UTF-16 Little Endian. (You can create Unicode files with Notepad).

 

Open Config Data.vi outputs an enum that tells you the file format.
Also, when using it to create a new config.ini, you can specify the format.

 

When sending strings to the functions (Section Name, Key Name, Key Value), you may use either ASCII, or UTF-16 BE, or UTF-16 LE, regardless of the format of the file. Of course if you have a Unicode config.ini file and you have Section and/or Key names using codepoints > 255, then you would have to use UTF-16 BE or UTF-16 LE to specify the Section/Key. However if the Section/Key names your Unicode config.ini file only use codepoints < 256, then you can specify them with ASCII.

 

Strings that are output from the functions (Section Names, Key Names, Key Values) will be either ASCII, or UTF-16 BE, or UTF-16 LE depending on the format of the config.ini file. You can determine the format of an ASCII, or UTF-16 BE, or UTF-16 LE string using Unicode.llb\Remove Unicode BOM.vi. (Note however that there's no way to distinguish between a Unicode string without a BOM (Byte Order Mark) and an ASCII string.

 

Since creating Unicode block-diagram constants can be a bit tricky, I've included some utilities to help you. See Utilities.llb.

 

Note: In the documentation and label names of VIs:

  • "Unicode String" refers to a Unicode string without a Byte Order Marker (BOM)
  • "UTF-16 String", "UTF-16 BE String", & "UTF-16 LE String" refer to Unicode strings with B.O.M.s.

 

2. Improved Support for Multi-line Keys

 

This makes them more human readable in the .ini files:


Originally, multi-line keys had to be like:

KeyName = "Line 1\0ALine 2\0A\Line 3"

Now they can be like:

KeyName = "
Line 1
Line 2
Line 3
"

To have a multi-line key in the new format, a newline must immediately follow the opening quote.

"If you weren't supposed to push it, it wouldn't be a button."