DelphiDabbler CodeSnip
File Format Documentation
Configuration Files
Introduction
CodeSnip uses two config files – one system wide application file named
Common.config
and another per-user file named
User.config
. There will be a different one of the latter for each
user account on the system where CodeSnip is used.
Config files use the standard .ini file format and are written and read using
Windows API calls.
The following data types are supported:
-
String – stored as a sequence of characters, optionally
enclosed in double quotes.
-
Boolean – stored as the text
False
and
True
(although 0
, No
and
N
are all read as false.
-
Integer – stored as positive or negative whole numbers or
zero.
-
Float – stored as positive or negative floating point numbers
or zero. Floating point representations of whole numbers are stored as
integers.
-
Date-Time – stored in the
YYYY-MM-DD hh:mm:ss
format in all locales (i.e. the date and time separators are always '-' and
':' respectively.
Encoding
From CodeSnip v4 config files are little endian Unicode text files with a byte
order mark. This encoding is used because the international support is
required and because the Windows API, which is used to read and write the
files, understands this file format.
On earlier versions of CodeSnip the config files were ANSI text files using
the system's default encoding. The installer takes care of converting the
older files to Unicode.
File Format
Common Config File
This file stores information about CodeSnip that is common to all users. There
is just one file named Common.config
that is stored in the
%ProgramData%\DelphiDabbler\CodeSnip.4
directory.
There have been several versions of this file. The current one is version 6.
The change to version 6 came with CodeSnip v4 and the change to Unicode
encoding.
The file is in INI file format. It has the following sections.
[Application] section
Provides information about the application.
Name / Value pairs:
-
Key (String)
-
Unique application ID. String of 32 hex digits.
-
RegCode (String)
-
Registration code. String of 32 hex digits. May be empty string or missing
if application not registered.
-
RegName (String)
-
Name of person who registered program. May be empty string or missing if
application not registered.
-
Version (String)
-
Version of installed program as dotted quad string.
[IniFile] section
Provides information about the config file itself.
Name / Value pairs:
-
Version (Integer)
-
Version number of file. Incremented whenever the config file format
changes. If this section or this value is missing then the default value
is 1. The installer takes care of converting earlier file versions and
stamping config file with the correct version number.
Current value is 6.
Per User Config File
This file records configuration information that is unique to each user of the
application. Some sections correspond to user preferences while others record
details of previous operations or the layout of the GUI. The file is named
User.config
and is stored in the logged on user's
%AppData%\DelphiDabbler\CodeSnip.4
directory.
There have been several versions of this file. The current one is version 15.
The file is in INI file format. It has the following sections.
[Cmp:XXX] sections
There is one of these section for each compiler known to CodeSnip. Each
section describes how CodeSnip should use the compiler, or indicates that the
compiler is not available.
The actual name of a section is found by replacing XXX with one of
the following values:
-
D2 – Delphi 2
-
D3 – Delphi 3
-
D4 – Delphi 4
-
D5 – Delphi 5
-
D6 – Delphi 6
-
D2005w32 – Windows 32 personality of Delphi 2005
-
D2006w32 – Windows 32 personality of Delphi 2006
-
D2007 – Windows 32 personality of Delphi 2007
-
D2009w32 – Windows 32 personality of Delphi 2009
-
D2010 – Delphi 2010
-
DXE – Delphi XE
-
DXE2 – Delphi XE2
-
DXE3 – Delphi XE3
-
DXE4 – Delphi XE4
-
DXE5 – Delphi XE5
-
DXE6 – Delphi XE6
-
DXE7 – Delphi XE7
-
DXE8 – Delphi XE8
-
D10S – Delphi 10 Seattle
-
FPC – Free Pascal
Name / Value pairs (same for all sections unless noted otherwise):
-
ExePath (String)
-
Path to compiler. Empty string if compiler not configured.
-
Displayable (Boolean)
-
Indicates whether compiler's compilation results for a snippet can be
displayed in detail pane.
-
Namespaces (String)
-
Space separated list of namespaces containing Delphi RTL units. Missing or
empty string value ⇒ use default RTL namespaces for compiler.
Relates to the Delphi XE2 and later compilers. If the value present, it is
ignored for earlier compilers and Free Pascal.
-
Prefix0 (String)
-
Double quoted prefix to text output by the compiler to indicate fatal
compiler errors. If not present the default is "Fatal: ".
-
Prefix1 (String)
-
Double quoted prefix to text output by the compiler to indicate standard
compiler errors. If not present the default is "Error: ".
-
Prefix2 (String)
-
Double quoted prefix to text output by the compiler to indicate warnings. If
not present the default is "Warning: ".
-
Switches (String)
-
Comma separated list of compiler switches. Empty string value ⇒ use
default switches for compiler. A missing value is the same as an empty
string value.
-
SearchDirCount (Integer)
-
Count of number of search directories configured for compiler.
-
SearchDirXXX (String)
-
Once entry for each search directory configured for compiler where
XXX ranges from 0 to SearchDirCount - 1.
Each entry contains a fully specified directory path.
[Database] section
This section records database customisations.
Name / Value pairs:
-
UserDataDir (String)
-
Specifies the directory that contains the user database. This value is
only present if the user has moved the database from its default
location.
Note: The value is ignored in the portable version of
CodeSnip.
[DuplicateSnippet] section
Persists state of controls in Duplicate Snippet dialogue box.
Name / Value pairs:
-
EditSnippetOnClose (Boolean)
-
Stores state of Edit in Snippets Editor check box.
[Favourites] section
Persists state of controls in Favourites dialogue box.
Name / Value pairs:
-
DisplayInNewTabs (Boolean)
-
Stores state of Open favourites in new tabs check box.
-
InactiveAlphaBlendValue (Integer)
-
Stores alpha blend value (i.e. degree of transparency) of Favourites
dialogue box when it is not active. Values should be in range 128 to 255.
[FindCompiler] section
Provides information about the last compiler search that was run.
Name / Value pairs:
-
D2 (Boolean)
-
Indicates whether Delphi 2 was included in search.
-
D3 (Boolean)
-
Indicates whether Delphi 3 was included in search.
-
D4 (Boolean)
-
Indicates whether Delphi 4 was included in search.
-
D5 (Boolean)
-
Indicates whether Delphi 5 was included in search.
-
D6 (Boolean)
-
Indicates whether Delphi 6 was included in search.
-
D7 (Boolean)
-
Indicates whether Delphi 7 was included in search.
-
D2005w32 (Boolean)
-
Indicates whether the Win32 personality of Delphi 2005 was included in
search.
-
D2006w32 (Boolean)
-
Indicates whether the Win32 personality of Delphi 2006 was included in
search.
-
D2007 (Boolean)
-
Indicates whether the Win32 personality of Delphi 2007 was included in
search.
-
D2009w32 (Boolean)
-
Indicates whether the Win32 personality of Delphi 2009 was included in
search.
-
D2010 (Boolean)
-
Indicates whether Delphi 2010 was included in search.
-
DXE (Boolean)
-
Indicates whether Delphi XE was included in search.
-
DXE2 (Boolean)
-
Indicates whether Delphi XE2 was included in search.
-
DXE3 (Boolean)
-
Indicates whether Delphi XE3 was included in search.
-
DXE4 (Boolean)
-
Indicates whether Delphi XE4 was included in search.
-
DXE5 (Boolean)
-
Indicates whether Delphi XE5 was included in search.
-
DXE6 (Boolean)
-
Indicates whether Delphi XE6 was included in search.
-
DXE7 (Boolean)
-
Indicates whether Delphi XE7 was included in search.
-
DXE8 (Boolean)
-
Indicates whether Delphi XE8 was included in search.
-
D10S (Boolean)
-
Indicates whether Delphi 10 Seattle was included in search.
-
FPC (Boolean)
-
Indicates whether Free Pascal was included in search.
-
Option (Integer)
-
Code that describes the kind of compilation result to be searched for: 0
⇒ snippet compiles OK; 1 ⇒ snippet compiles without warnings; 2
⇒ snippet compiles with warning(s); 3 ⇒ snippet fails to compile;
4 ⇒ snippet not tested.
-
-
Logic (Integer)
-
Code that describes search logic to use: 0 ⇒ "and"; 1 ⇒
"or".
[FindText] section
Provides information about last the last text search that was run and records
a history of search terms.
Name / Value pairs:
-
HistoryCount (Integer)
-
Count of items in search term history.
-
HistoryXXX (String)
-
One entry for each search term in history where XXX ranges from 0
to HistoryCount - 1.
Each entry contains one or more spaced separated search words.
-
MatchCase (Boolean)
-
One of the search options. Indicates whether searches are case sensitive.
-
WholeWord (Boolean)
-
One of the search options. Indicates whether searches match whole words
only.
-
Logic (Integer)
-
Code that describes search logic to use: 0 ⇒ "and"; 1 ⇒
"or".
[FindXRefs] section
Provides information about the last snippet cross reference search that was
run.
Name / Value pairs:
-
IncludeSnippet (Boolean)
-
Indicates whether to include the snippet for which the search is being
performed in the search result.
-
Required (Boolean)
-
Indicates whether to include snippets that are required to compile the
selected snippet are included in search result.
-
RequiredRecurse (Boolean)
-
Indicates whether to recurse required snippets to search for required
snippets of each required snippet and so on. Ignored if
Required = False.
-
RequiredReverse (Boolean)
-
Indicates whether to include snippets that depend on the searched for
snippet.
-
SeeAlso (Boolean)
-
Indicates whether to include snippets that are cross referenced by the
selected snippet in search results.
-
SeeAlsoRecurse (Boolean)
-
Indicates whether to recurse cross-referenced snippets to search for their
own cross references and so on. Ignored if SeeAlso = False.
-
SeeAlsoReverse (Boolean)
-
Indicates whether to include snippets that cross-reference searched for
snippet.
[IniFile] section
Provides information about the config file itself.
Name / Value pairs:
-
Version (Integer)
-
Version number of file. Incremented whenever the config file format
changes. If this section or this value is missing then the default value
is 1. The installer takes care of converting earlier file versions and
stamping config file with the correct version number.
Current value is 15.
-
ProgramVersion (String)
-
Internal version number of currently installed program as a dotted quad.
[Prefs:CodeGen] section
Stores source code generation preferences. Used in test compilations or when
generating user defined units.
Name / Value pairs:
-
EmitWarnings (Boolean)
-
Flag indicating whether directives are emitted to switch specified warnings
on or off. True ⇒ emit directives; False ⇒ do emit directives.
-
WarningCount (Integer)
-
Number of warning directives supported.
-
WarningXXX.Symbol (String)
-
One entry for each supported warning where XXX ranges from 0 to
WarningCount - 1.
Each entry contains the symbol representing a warning as used in Delphi's
$WARN directive.
-
WarningXXX.MinCompiler (Float)
-
One entry for each supported warning where XXX ranges from 0 to
WarningCount - 1.
Records the earliest version of Delphi that supports the warning. This
version number is a decimal value containing compiler version number as
specified by Delphi's CompilerVersion constant. Must be 14.0
(Delphi 6) or higher.
-
WarningXXX.State (Boolean)
-
One entry for each supported warning where XXX ranges from 0 to
WarningCount - 1.
Indicates whether the warning should be switched on or off. True ⇒
switch on; False ⇒ switch off.
[Prefs:Display] section
Stores main display preferences.
Name / Value pairs:
-
OverviewStartState (Integer)
-
Code that indicates the desired start state of the overview pane treeview:
0 ⇒ fully expanded; 1 ⇒ fully collapsed.
-
ShowEmptySections (Boolean)
-
Flag that specifies whether empty sections should be displayed in overview
pane. True ⇒ display empty sections; False ⇒ hide empty
sections.
-
ShowNewSnippetsInNewTabs (Boolean)
-
Flag that specifies how newly created snippets and categories are displayed
in detail pane. True ⇒ new tab created for each new item; False ⇒
new items overwrite item in selected tab.
-
MainDBHeadingColour (Integer)
-
Colour to be used to display headings of items from main database.
-
UserDBHeadingColour (Integer)
-
Colour to be used to display headings of items from user database.
-
SourceCodeBGColour (Integer)
-
Colour to be used for background of source code in the main display.
-
MainDBHeadingCustomColourCount (Integer)
-
Number of recorded custom colours for main database item headings.
-
MainDBHeadingCustomColourXXX (String)
-
One entry for each recorded custom colours for main database item
headings, where XXX ranges from 0 to
MainDBHeadingCustomColourCount - 1.
The value is a definition of a custom colour in the format used by the
TColorDialog dialogue box. This format is
ColourID=ColourNum where ColourID is a value
from "ColorA" to "ColorP" and ColourNum is
the hex representation of the colour.
-
UserDBHeadingCustomColourCount (Integer)
-
Number of recorded custom colours for user database item headings.
-
UserDBHeadingCustomColourXXX (String)
-
One entry for each recorded custom colours for user database item
headings, where XXX ranges from 0 to
UserDBHeadingCustomColourCount - 1.
The value is a definition of a custom colour in the format used by the
TColorDialog dialogue box. This format is
ColourID=ColourNum where ColourID is a value
from "ColorA" to "ColorP" and ColourNum is
the hex representation of the colour.
-
SourceCodeBGCustomColourCount (Integer)
-
Number of recorded custom colours for source code background in the main
display.
-
SourceCodeBGCustomColourXXX (String)
-
One entry for each recorded custom colours for source code background in
the main display, where XXX ranges from 0 to
SourceCodeBGCustomColourCount - 1.
The value is a definition of a custom colour in the format used by the
TColorDialog dialogue box. This format is
ColourID=ColourNum where ColourID is a value
from "ColorA" to "ColorP" and ColourNum is
the hex representation of the colour.
[Prefs:General] section
Stores general (miscellaneous) application preferences.
Name / Value pairs:
-
Units (Integer)
-
A code that records the units of measurement used by the application: 0
⇒ inches; 1 ⇒ millimeters.
[Prefs:Hiliter] section
Stores preferences that define the properties of one or more syntax
highlighters. Also records information about the custom colours available when
configuring the highlighters.
Name / Value pairs:
-
FontSize (Integer)
-
Size of current highlighter font in points.
-
FontName (String)
-
Name of current highlighter font.
-
ElemXXX.Color (Integer)
-
One entry for each of the 12 source code elements recognised by the
current syntax highlighter. XXX ranges from 0 to 11.
Colour of source code element. Integer representation of a Delphi
TColor value. If the colour is not specified the value is the
integer representation of clNone.
-
ElemXXX.Style (Integer)
-
One entry for each of the 12 source code elements recognised by the
current syntax highlighter. XXX ranges from 0 to 11.
Bitmask representing the font styles used for the source code element.
-
NamedHiliterCount (Integer)
-
Number of custom (or "Named") syntax highlighters defined by user.
-
HilterNameXXX (String).
-
One entry for each custom syntax highlighter, where XXX ranges
from 0 to NamedHiliterCount - 1.
Each value is the name used to identify the syntax highlighter with the
same index. (See the various NamedHiliterXXX entries below.)
-
NamedHiliterXXX.FontSize (Integer)
-
One entry for each custom syntax highlighter, where XXX ranges
from 0 to NamedHiliterCount - 1.
Each value is the size of the corresponding syntax highlighter's font, in
points.
-
NamedHiliterXXX.FontName
-
One entry for each custom syntax highlighter, where XXX ranges
from 0 to NamedHiliterCount - 1.
Each value is the name of the corresponding syntax highlighter's font.
-
NamedHiliterXXX.ElemYYY.Color (Integer)
-
There is an entry for each source code element of each custom synax
highliter. XXX represents the index of the corresponding syntax
highlighter and ranges from 0 to NamedHiliterCount - 1.
For each value of XXX there are 12
.ElemYYY values, with YYY ranging from
0 to 11.
Each value specifies the colour of a source code element. The values are
integer representations of a Delphi TColor value. If the colour
is not specified the value is the integer representation of
clNone.
-
NamedHiliterXXX.ElemYYY.Style (Integer)
-
There is an entry for each source code element of each custom synax
highliter. XXX represents the index of the corresponding syntax
highlighter and ranges from 0 to NamedHiliterCount - 1.
For each value of XXX there are 12
.ElemYYY values, with YYY ranging from
0 to 11.
Each value contains a bitmask representing the font style of a source code
element.
-
CustomColourCount (Integer)
-
Number of recorded custom colours available for use by highlighter elements.
CustomColourXXX (String)
-
One entry for each recorded custom colour, where XXX ranges from
0 to CustomColourCount - 1.
The value is a definition of a custom colour in the format used by the
TColorDialog dialogue box. This format is
ColourID=ColourNum where ColourID is a value
from "ColorA" to "ColorP" and ColourNum is
the hex representation of the colour.
[Prefs:News] section
Stores preferences that determine how items from the CodeSnip news feed are
displayed.
Name / Value pairs:
-
MaxAge (Integer)
-
Maximum age of a news item that can appear in CodeSnip News dialogue box in
days. Default is 92 days.
[Prefs:Printing] section
Stores preferences that determine printing defaults.
Name / Value pairs:
-
UseColor (Boolean)
-
Flag that indicates whether printing is to be in colour.
-
SyntaxPrint (Boolean)
-
Flag that indicates whether source code in printed output is to be syntax
highlighted.
-
LeftMargin (Float)
-
Size of printed page's left margin in mm.
-
TopMargin (Float)
-
Size of printed page's top margin in mm.
-
RightMargin (Float)
-
Size of printed page's right margin in mm.
-
BottomMargin (Float)
-
Size of printed page's bottom margin in mm.
[Prefs:SnippetPageStructure] section
Stores preferences that describes customisations of snippet pages displayed in
details pane.
Name / Value pairs:
-
PageKindXXX (String)
-
One entry for each snippet kind where XXX is the ordinal value of
the snippet kind.
Each entry's value describes the structure of the details pane page that
snippets of the kind given by the key name. The value is a comma separated
list of zero or more names, each of which denotes a page component.
Components are displayed in the order they are listed. Valid component
names are:
-
Description
-
SourceCode
-
Kind
-
Category
-
Units
-
Depends
-
XRefs
-
CompileResults
-
ExtraInfo
[Prefs:SourceCode] section
Stores preferences that govern the way source code is stored in exported
documents by default.
Name / Value pairs:
-
FileType (Integer)
-
Code that determines type of exported files: 0 ⇒ plain text; 1 ⇒
Pascal; 2 ⇒ HTML; 3 ⇒ rich text (RTF).
-
CommentStyle (Integer)
-
Code that determines style of commenting used for documentation of snippets
in output files: 0 ⇒ no documentation comment; 1 ⇒ description of
snippet between prototype and body; 2 ⇒ description of snippet
immediately precedes snippet.
-
TruncateComments (Boolean)
-
Flag indicating whether multi-paragraph snippet descriptions are to be
truncated to first paragraph only in snippet documentation comments.
-
UseSyntaxHiliting (Boolean)
-
Flag indicating whether source code is to be syntax highlighted.
[Prefs:Updating] section
Stores preferences relating to updating CodeSnip and the local copy of the
online database.
Name / Value pairs:
-
AutoCheckProgramFrequency (Integer)
-
Specifies frequency, in days, with which CodeSnip automatically checks
online for program updates. A value of 0 indicates that CodeSnip will not
check for program updates automatically.
-
AutoCheckDatabaseFrequency (Integer)
-
Specifies frequency, in days, with which CodeSnip automatically checks
online for database updates. A value of 0 indicates that CodeSnip will not
check for database updates automatically.
[ProxyServer] section
Stores information about any proxy internet server that is to be used.
Name / Value pairs:
-
UseProxy (Boolean)
-
Flag that indicates whether to use a proxy server or not. If false the
remaining name / value pairs in this section are ignored.
-
IPAddress (String)
-
IP address of proxy server in dotted quad format, e.g. 127.0.0.1.
-
Port (Integer)
-
Port on which to access proxy server.
-
UserName (String)
-
Username for proxy server access. Empty if server doesn't require a user
name.
-
Password (String)
-
Encrypted form of any password required to access proxy server. Empty if no
password is required. This value is a hex representation of the bytes of
the encrypted password.
[UpdateChecks] section
Records date of last (automatic) update checks for different items. These
values are used to determine when to perform the next check. (Checks are made
within a fixed interval of the preceding check).
Name / Value pairs:
-
LastProgramCheck (Date-Time)
-
Date (in GMT) that the program last checked to see if a new version of
CodeSnip is available.
-
LastDatabaseCheck (Date-Time)
-
Date (in GMT) that the program last checked to see if the online version of
the Code Snippets Database had been updated.
[UserInfo] section
Stores personal information about the user.
Name / Value pairs:
-
Name (String)
-
User's name.
-
Email (String)
-
User's email address.
[WindowState:XXX] sections
There is one of these section for each window that stores its state and size
in the config file. XXX is a sub-section placeholder and is replaced
by a unique name representing the window whose state is stored.
Some windows also store custom information in their sub-section that is not
used in all sub-sections.
Common values
These values do, or can, appear in any sub-section.
Name / Value pairs:
-
Left (Integer)
-
Location of left side of window on screen in pixels.
-
Top (Integer)
-
Location of top of window on screen in pixels.
-
Width (Integer)
-
Width of window in pixels.
Not used for fixed size windows.
-
Height (Integer)
-
Height of window in pixels.
Not used for fixed size windows.
-
State (Integer)
-
Value of that describes state of window: 0 ⇒ normal state; 1 ⇒
minimized; 2 ⇒ maximized.
Not used for dialogue boxes and other windows that are always displayed in
the normal state.
[WindowState:MainForm] sub-section
These values are used only in the MainForm sub-section.
Name / Value pairs:
-
SplitterPos (Integer)
-
Position of vertical splitter control in main window, in pixels from left
of window client area.
-
OverviewTab (Integer)
-
Index of selected tab in overview pane.