Skip to content

TMiletusINIFile

TMiletusINIFile allows to create/read/write INI files on the operating system. Below is a list of available methods for TMiletusINIFile.

Methods for TMiletusINIFile

Property Description
DeleteKey(const Section, Ident: string) Method to delete a key with the given Ident from Section.
EraseSection(const Section: string) Method to delete the given Section.
SectionExists(const Section: string): TJSPromise Function to check if a given Section exists. The return value of the TJSPromise is Boolean.
ValueExists(const Section, Ident: string): TJSPromise Function to check if a given Ident exists in a Section. The return value of the TJSPromise is Boolean.
ReadBool(const Section, Ident: string; Default: Boolean): TJSPromise Function to read a Boolean value from the INI file. The return value of the TJSPromise is Boolean.
ReadDate(const Section, Name: string; Default: TDateTime): TJSPromise Function to read a date value from the INI file. The return value of the TJSPromise is TDateTime.
ReadDateTime(const Section, Name: string; Default: TDateTime): TJSPromise Function to read a datetime value from the INI file. The return value of the TJSPromise is TDateTime.
ReadFloat(const Section, Name: string; Default: Double): TJSPromise Function to read a float value from the INI file. The return value of the TJSPromise is Double.
ReadInt64(const Section, Ident: string; Default: Int64): TJSPromise Function to read an int64 value from the INI file. The return value of the TJSPromise is Int64.
ReadInteger(const Section, Ident: string; Default: Integer): TJSPromise Function to read an integer value from the INI file. The return value of the TJSPromise is Integer.
ReadString(const Section, Ident: string; Default: string): TJSPromise Function to read a string value from the INI file. The return value of the TJSPromise is string.
ReadSection(const Section: string; Strings: TStrings): TJSPromise Function to read the given Section from the INI file into Strings. The return value of the TJSPromise is nil.
ReadSections(Strings: TStrings): TJSPromise Function to read all the available sections from the INI file into Strings. The return value of the TJSPromise is nil.
ReadSectionValues(const Section: string; Strings: TStrings): TJSPromise Function to read the values from the given Section into Strings. The return value of the TJSPromise is nil.
ReadSubSections(const Section: string; Strings: TStrings; Recurse: Boolean = False): TJSPromise Function to read the subsections of the given Section into Strings. The return value of the TJSPromise is nil.
ReadTime(const Section, Name: string; Default: TDateTime): TJSPromise Function to read a time value from the INI file. The return value of the TJSPromise is TDateTime.
ReadBinaryStream(const Section, Name: string; Value: TStream): TJSPromise Function to read a binary value into the Value TStream. The return value of the TJSPromise is Boolean.
WriteBool(const Section, Ident: string; Value: Boolean) Method to write a Boolean value to the INI file.
WriteDate(const Section, Name: string; Value: TDateTime) Method to write a date value to the INI file.
WriteDateTime(const Section, Name: string; Value: TDateTime) Method to write a datetime value to the INI file.
WriteFloat(const Section, Name: string; Value: Double Method to write a Float value to the INI file.
WriteInt64(const Section, Ident: string; Value: Int64) Method to write an int64 value to the INI file.
WriteInteger(const Section, Ident: string; Value: Integer) Method to write an integer value to the INI file.
WriteString(const Section, Ident, Value: String) Method to write a string value to the INI file.
WriteTime(const Section, Name: string; Value: TDateTime) Method to write a time value to the INI file.
WriteBinaryStream(const Section, Name: string; Value: TStream) Method to write binary value into the INI file.

Example usage:

procedure TForm1.WebButton1Click(Sender: TObject); async;
var
  f: TMiletusIniFile;
  d: TDateTime;
begin
  f := TMiletusIniFile.Create(ParamStr(0) + '.INI');
  try
    d := await(TDateTime, f.ReadDate('MySection', 'MyDateValue', Now));
    WebMemo1.Lines.Add(DateTimeToRFC3339(d));
  finally
    f.Free;
  end;
end;