Introduction

Ini files are plain text files that are used to store data for programs. Traditionally, Ini files were used to store program settings (Ini is short for initialization), however the registry is often used for this now. It is a format which is simple to edit and simple to work with and so is often a good choice for storing data in Multimedia Fusion.

Multimedia Fusion always has an object for reading and writing Ini files. Ini++ is just an upgrade of this, including many new features.

Ini Files
What’s New?
Negative Aspects


Ini Files

An Ini file consists of multiple groups. In each group, are multiple items. The start of the group is signified by the name of the group in square brackets. Items consist of their name, followed by an equals sign (‘=’), followed by the corresponding value associated with it. For instance,

Example Ini 1: An Example File

[goals]
Henry=21
Hleb=4
Fabragas=2
[yellow_cards]
Rosisky=2
Hleb=3
Fabragas=5

Here there are two groups, goals and yellow cards. The groups need not have the same item names in each one. In the ‘goal’ group there are three items: Henry, Hleb and Fabragas. They have corresponding values 21, 4 and 2 respectively. Similarly for the ‘yellow cards’ group.

INI files are as simple as that, in principle. However, Ini++ has options to add extra features to them, which can make them a bit more complicated than this.

top

What’s New?

Ini++ has many features that the standard Ini object does not have. These are listed here:

Compression and Encryption Ini++ allows the files to be compressed and encrypted when saved to disk.

Path Features You may select the path that relative paths are relative to. You may save to directories which do not exist and they will be created. There is a read-only mode if you do not wish to modify the file.

Initial Data You can specify initial data to be loaded into the object in the frame editor, as well as an initial file to load.

Dialog Box Ini++ features a dialog box which can be opened at run-time. It is helpful for debugging or cheat menus.

Case Sensitive If you wish, the Ini file can be case sensitive.

Repeated Groups and Items Repeated groups can be merged together. Repeated groups and items can also be automatically renamed.

Debugging Tools View and modify the Ini file as text from the Multimedia Fusion Debugger.

Auto-Save Ini++ can be set so it does not automatically rewrite the file to disk when it has been modified, however it can still do this if desired.

No Limits There are no limits for the size of the Ini files, the number of groups, the number of items, the size of values or anything like that!

Searching There are actions and expressions for searching Ini files and even putting the results in other Ini++ objects.

Merging Functions There are new functions for merging together Ini files

Subgroups Groups with subgroups can be simulated with the object.

Global Data Stores An infinite number of global data stores that can be shared across subapps.

Hashed Values There are functions for having hashed data values, which is useful for passwords and so on.

Get and Set as Text Ini files can be loaded in directly as text, or the data can be received as a string.

Listing Groups and Items Expression for listing the items of the Ini file without previously knowing the names of the items. There are also expressions for finding out how many items and groups there are.

Reordering Groups Sort, shift, shuffle groups and more...

Receive Information Quickly Quickly find out which groups have certain properties with the ‘Perform calculations’ expressions.

Escape Characters Escape Characters can be used in group names, item names and item values. This allows new lines to be represented in the data, for instance.

And more...

top

Negative Aspects

Ini++ does have a side-effect that, whilst often positive, could be thought of as negative. Ini++ loads the whole Ini to memory and then saves it all back to disc in the most efficient manor when it saves. This means it does not preserve the ‘human structure’ of the file. By this, it is meant that if you opened an Ini file in Ini++ and then saved it again straight away, you would lose the following:

This will result in the smallest possible file size, which is often what is wanted. However, if the Ini file is to be regularly edited by humans then this might not be wanted. To get around this, you could open the file in Read Only mode.

As an example of this, consider the following Ini file:

Example Ini 2: The original file

;This group represents the scores for the various players
[Scores]
Jack = 32
Fred = 12
Oliver = 33

[Time]
Jack=15

;More scores
[Scores]
Alex = 22

Now if this is loaded with the ‘Group repeat setting’ set to merge (see section 2.3 for information on this), and saved it again, we would find the file looks as follows:

Example Ini 3: Example 2 after being saved with Ini++

[Scores]
Alex=22
Fred=12
Jack=32
Oliver=33
[Time]
Jack=15

So, the extra blank lines and white space has been removed. The case of group and item names has changed. The ordering is different, comments have been removed and the previously split up groups have been merged.

top