MyIniFiles.txt

In some of my programs I use a modified version of one
of the .pas files in the Vcl directory (Delphi 5 Pro
/Ent). The file is called IniFiles.pas.

The file IniFiles.pas is copyright to Borland Inprise,
so hence some of MyIniFiles.pas (the original code)
remains copyright to them. I guess that my code is
copyright to me (??). Anyway, I don't think that I'm
permitted to distribute MyIniFiles.pas, but I can 
provide instructions to recreate the file. There are
actually not very many changes. :-)))

The following is instructions to modify Borland
Inprise's IniFile.pas which comes with Delphi 5
Professional & Enterprise, to become the new file of
MyIniFiles.pas.

If you can't follow these instructions, or you only
have the Standard edition of Delphi, then email me at:

mailto:pew@pcug.org.au

and I'll send you the file.

Regards,
      Peter Williams  :-)))

Instructions:
=============

Load the following file:

\Program Files\Borland\Delphi5\Source\Vcl\IniFiles.pas

File / Save As... MyIniFiles.pas in your own source
code directory (of your choice).

Before
"{$R-,T-,H+,X+}" line 12 add

// MyIniFiles -- modified version of IniFiles.pas
// by Peter E. Williams
//    18 Dec 2001
// 2 new public procedures added:
// MyReadBool, MyWriteBool

Ctrl+Q+A (Find and Replace) (Global, Entire Scope)
(Replace All)
TCustomIniFile with TMyCustomIniFile

Ctrl+Q+A (Find and Replace) (Global, Entire Scope)
(Replace All)
TIniFile with TMyIniFile

Before line 35
    function ReadBool(const Section, Ident: string; Default: Boolean): Boolean; virtual;

Insert this line:
    function MyReadBool(const Section, Ident: string; Default: Boolean): Boolean; virtual;

Before line 38:
    function ReadDate(const Section, Name: string; Default: TDateTime): TDateTime; virtual;

Insert this line:
    procedure MyWriteBool(const Section, Ident: string; Value: Boolean); virtual;

After the ReadBool procedure and before the
ReadDate procedure (line 143) add
(the following lines between the "(1)***********"):

(1)***********
function TMyCustomIniFile.MyReadBool(const Section, Ident: string;
  Default: Boolean): Boolean;
var
  str1 : string;
begin
  Str1 := upperCase(trim(ReadString(Section, Ident, '')));

  Result := default;

  if str1 = 'TRUE' then
    Result := true
  else
    if str1 = 'FALSE' then
      Result := false;
end;
(1)***********

After the WriteBool procedure and before the
ValueExists function (line 230) add
(the following lines between the "(2)***********"):

(2)***********
procedure TMyCustomIniFile.MyWriteBool(const Section, Ident: string; Value: Boolean);
const
  Values: array[Boolean] of string = ('False', 'True');
begin
  WriteString(Section, Ident, Values[Value]);
end;
(2)***********

--- That's it folks. That's all of the changes.
Just do a File / Save.

