04-14-2018 06:57 AM - edited 04-14-2018 07:12 AM
I am designing a module which will deal with configuration files. I use the OpenG Variant config file toolkit to create ini files.
I wonder what would be the best practice in the following situation
The other direction is the same: when a user loads an existing ini file, they should see a preview dialog before deciding whether to apply the new configuration settings or not to the app.
As a workaround, for the first case, I imagine I could create a temporary ini file, then open it as a simple text file, and load its content as simple text. The other case, I open again the existing ini file as a normal text file, and read its content as text.
I do not really like to create temporary files, then deleting them programmatically, do you have some better idea? Would be nice to have two special OpenG VIs like "Preview INI file content as text", and "Simulate INI file content and show it as text"...
EDIT: and even if I do it using my idea, I have still the problem that the content of the ini file will not be presented in a nice way. It would be cool to have some toolkit in LV, which could parse and colour/structure an ini file content to show, just like for example Notepad++ does:
04-14-2018 07:19 AM - edited 04-14-2018 07:20 AM
OK, actually using a simple EOL delimited string into a string indicator is acceptable, not pretty, but easy to read, see snippet below.
But my question is still, is there a good trick to avoid creating temporary file creation/deletion before we decide we actually want to create the ini file or not?
04-14-2018 08:27 AM
So I just proceed this way, to preview how the content of the ini file would look:
04-14-2018 12:57 PM
try this attachment:
Then your prompt will read "Observe the ini file in Notepad++ and ...."
A nice gift from Hoovahh. Windows only
04-15-2018 02:00 AM
Thanks Jeff, I might use this as an "extra option".
Actually I started to think, a Tree indicator could be a nice way to show INI file sections and elements/values to the user. Via VIPM I installed the NI Tree toolkit, and there is one example for XML files. I imagine, this could be adapted to INI files:
"Tree Data Types and XML Example.vi"