------------
De sources van NLDDanyUtils zijn te vinden in:
ftp://ftp.nldelphi.com/public/OpenSo.../NLDDanyUtils/
------------
Deze unit bevat procedures en functies die
- automatisch gebruik maken van de Ini file die in de start-up directory van de applicatie staan (dus niet noodzakelijk in het path van de applicatie zelf)
- ook TStrings kunnen schrijven en lezen naar en van de Ini file.
- heel simpel in gebruik zijn ("Class"-loos, de procedures zijn aan te roepen zonder een object van een Class te moeten aanmaken).
Voor de kompleetheid is een Class "TSimpleIniFile" aangemaakt. Die is een kind van "TIniFile" maar bevat de extra TStrings schrijf- en leesmethoden alsook de automatische plaatsing van de Ini file in de startup directory van de applicatie (tenzij je zelf een IniFile naam opgeeft).
De interface:
Code:
{ --- Class "TSimpleIniFile" --- }
type
TSimpleIniFile = class(TIniFile)
private
public
constructor Create(fn: string = '');
// Added procedures in this Class with respect to "TIniFile"
procedure WriteTStrings(Section, Key: string; Texts: TStrings); overload;
procedure ReadTStrings(Section, Key: string; Texts: TStrings); overload;
procedure WriteTStrings(Section: string; Texts: TStrings); overload;
procedure ReadTStrings(Section: string; Texts: TStrings); overload;
procedure WriteObject(Section: string; Obj: TObject);
procedure ReadObject(Section: string; Obj: TObject);
end;
{ --- Procedures and Functions without usage of a Class --- }
// BinaryStream ----------------------------------------------------
procedure WriteBinaryStreamToIniFile(Section, Key: string; Value: TStream);
function ReadBinaryStreamFromIniFile(Section, Key: string; Value: TStream):
Integer;
// Bool ----------------------------------------------------
procedure WriteBoolToIniFile(Section, Key: string; Value: Boolean);
function ReadBoolFromIniFile(Section, Key: string): Boolean;
// Date ----------------------------------------------------
procedure WriteDateToIniFile(Section, Key: string; Value: TDateTime);
function ReadDateFromIniFile(Section, Key: string): TDateTime;
// DateTime ----------------------------------------------------
procedure WriteDateTimeToIniFile(Section, Key: string; Value: TDateTime);
function ReadDateTimeFromIniFile(Section, Key: string): TDateTime;
// Float ----------------------------------------------------
procedure WriteFloatToIniFile(Section, Key: string; Value: Double);
function ReadFloatFromIniFile(Section, Key: string): Double;
// Integer ----------------------------------------------------
procedure WriteIntegerToIniFile(Section, Key: string; Value: Integer);
function ReadIntegerFromIniFile(Section, Key: string): Integer;
// Time ----------------------------------------------------
procedure WriteTimeToIniFile(Section, Key: string; Value: TDateTime);
function ReadTimeFromIniFile(Section, Key: string): TDateTime;
// String ----------------------------------------------------
procedure WriteStringToIniFile(Section, Key, Value: string);
function ReadStringFromIniFile(Section, Key: string): string;
// TStrings ----------------------------------------------------
procedure WriteTStringsToIniFile(Section, Key: string; Texts: TStrings);
overload;
procedure ReadTStringsFromIniFile(Section, Key: string; Texts: TStrings);
overload;
procedure WriteTStringsToIniFile(Section: string; Texts: TStrings); overload;
procedure ReadTStringsFromIniFile(Section: string; Texts: TStrings); overload;
// Objects Texts and Statusses
procedure WriteObjectToIniFile(Section: string; Obj: TObject);
procedure ReadObjectFromIniFile(Section: string; Obj: TObject);
// Miscellaneous ----------------------------------------------------
procedure DeleteKeyFromIniFile(const Section, Key: string);
procedure EraseSectionFromIniFile(const Section: string);
procedure ReadSectionFromIniFile(const Section: string; Texts: TStrings);
procedure ReadSectionsFromIniFile(Texts: TStrings);
procedure ReadSectionValuesFromIniFile(const Section: string; Texts: TStrings);
function SectionExistsInIniFile(const Section: string): Boolean;
function ValueExistsInIniFile(const Section, Key: string): Boolean;
Bookmarks