Class TPropSaveFile

Unit

Declaration

type TPropSaveFile = class(TComponent)

Description

Non visual component which provides loading and saving of TMemIniFileEx file, it centralize data of all used TPropSaveMain components which uses it as interface to ini data

Hierarchy

  • TComponent
  • TPropSaveFile

Overview

Methods

Public procedure LoadFile(const AFileName: string);
Public procedure LoadFromStream(Source: TStream);
Public function SaveFile(const AFileName: string): boolean;
Public function SaveFileSilent(const AFileName: string): boolean;
Public procedure SaveToStream(Dest: TStream);
Public function SectionExists(const Section: string): boolean;
Public function ValueExists(const Section, Ident: string): boolean;
Public procedure ReadSection(const Section: string; Strings: TStrings);
Public procedure WriteSection(const Section: string; Strings: TStrings);
Public procedure EraseSection(const Section: string);
Public procedure DeleteKey(const Section, Ident: String);
Public procedure Clear;
Public procedure GetStrings(List: TStrings);
Public procedure SetStrings(List: TStrings);
Public function GetSectionFromLine(const Line: string): string;
Public function GetFileName: string;
Public function ReadVariant(const Section, Ident: string; Default: variant): variant;
Public procedure WriteVariant(const Section, Ident: string; Value: variant);
Public function ReadString(const Section, Ident, Default: string): string;
Public procedure WriteString(const Section, Ident, Value: string);
Public function ReadInteger(const Section, Ident: string; Default: Longint): Longint;
Public procedure WriteInteger(const Section, Ident: string; Value: Longint);
Public function ReadWord(const Section, Ident: string; Default: Word): Word;
Public procedure WriteWord(const Section, Ident: string; Value: Word);
Public function ReadBool(const Section, Ident: string; Default: boolean): boolean;
Public procedure WriteBool(const Section, Ident: string; Value: boolean);
Public function ReadDateTime(const Section, Ident: string; Default: TDateTime): TDateTime;
Public procedure WriteDateTime(const Section, Ident: string; Value: TDateTime);
Public function ReadFloat(const Section, Ident: string; Default: Double): Double;
Public procedure WriteFloat(const Section, Ident: string; Value: Double);
Public procedure WriteStrings(const Key: string; L: TStrings);
Public procedure ReadStrings(const Key: string; L: TStrings);
Public procedure DeleteStrings(const Key: string);
Public procedure WriteFont(const Key: string; Font: TFont; ScaleRatio: Double = 1);
Public procedure ReadFont(const Key: string; Font: TFont; ScaleRatio: Double = 1);
Public procedure DeleteFont(const Key: string);
Public procedure DoCompressFile(const OrigFileName, DestFileName: string; DeleteOrigFile: boolean);

Properties

Published property DisableAll: boolean read FDisableAll write FDisableAll default false;
Published property FileName: string read FFileName write SetFileName;
Published property CompressFile: boolean read FCompressFile write SetCompressFile default false;
Published property UseAsGlobalFile: boolean read FUseAsGlobalFile write SetUseAsGlobalFile default false;
Published property OnLoadContent: TNotifyEvent read FOnLoadContent write FOnLoadContent;
Published property OnSaveContent: TNotifyEvent read FOnSaveContent write FOnSaveContent;
Published property OnReadValue: TReadValueEvent read FOnReadValue write FOnReadValue;
Published property OnWriteValue: TWriteValueEvent read FOnWriteValue write FOnWriteValue;
Published property OnGetIniFileEncoding: TGetEncodingEvent read FGetIniFileEncoding write FGetIniFileEncoding;

Description

Methods

Public procedure LoadFile(const AFileName: string);

load ini file from disk

Public procedure LoadFromStream(Source: TStream);

load ini file from stream

Public function SaveFile(const AFileName: string): boolean;

save ini file to disk

Public function SaveFileSilent(const AFileName: string): boolean;

save ini file to disk, do not show error if saving fail

Public procedure SaveToStream(Dest: TStream);

save ini file to stream

Public function SectionExists(const Section: string): boolean;

define whether section exists in ini file

Public function ValueExists(const Section, Ident: string): boolean;

define whether value exists in section in ini file

Public procedure ReadSection(const Section: string; Strings: TStrings);

read whole section to stringlist

Public procedure WriteSection(const Section: string; Strings: TStrings);

write whole section from stringlist

Public procedure EraseSection(const Section: string);

erase whole section - all values

Public procedure DeleteKey(const Section, Ident: String);

erase one key value from the section

Public procedure Clear;

erase whole ini file

Public procedure GetStrings(List: TStrings);

load IniFile content to List

Public procedure SetStrings(List: TStrings);

store List to IniFile content

Public function GetSectionFromLine(const Line: string): string;

find full section name according Line, mask with * can be used

Public function GetFileName: string;

return name of INI file

Public function ReadVariant(const Section, Ident: string; Default: variant): variant;
 
Public procedure WriteVariant(const Section, Ident: string; Value: variant);
 
Public function ReadString(const Section, Ident, Default: string): string;
 
Public procedure WriteString(const Section, Ident, Value: string);
 
Public function ReadInteger(const Section, Ident: string; Default: Longint): Longint;
 
Public procedure WriteInteger(const Section, Ident: string; Value: Longint);
 
Public function ReadWord(const Section, Ident: string; Default: Word): Word;
 
Public procedure WriteWord(const Section, Ident: string; Value: Word);
 
Public function ReadBool(const Section, Ident: string; Default: boolean): boolean;
 
Public procedure WriteBool(const Section, Ident: string; Value: boolean);
 
Public function ReadDateTime(const Section, Ident: string; Default: TDateTime): TDateTime;
 
Public procedure WriteDateTime(const Section, Ident: string; Value: TDateTime);
 
Public function ReadFloat(const Section, Ident: string; Default: Double): Double;
 
Public procedure WriteFloat(const Section, Ident: string; Value: Double);
 
Public procedure WriteStrings(const Key: string; L: TStrings);
 
Public procedure ReadStrings(const Key: string; L: TStrings);
 
Public procedure DeleteStrings(const Key: string);
 
Public procedure WriteFont(const Key: string; Font: TFont; ScaleRatio: Double = 1);
 
Public procedure ReadFont(const Key: string; Font: TFont; ScaleRatio: Double = 1);
 
Public procedure DeleteFont(const Key: string);
 
Public procedure DoCompressFile(const OrigFileName, DestFileName: string; DeleteOrigFile: boolean);

compress original file and store as new file

Properties

Published property DisableAll: boolean read FDisableAll write FDisableAll default false;

Defines whether re/storing is completely disabled

Published property FileName: string read FFileName write SetFileName;

Defines name of ini file, in runtime use LoadFile and SaveFile to change current name of ini file

Published property CompressFile: boolean read FCompressFile write SetCompressFile default false;

Defines whether ini file is commpressed, zlib or bzip2 is used according switch in _rosi.inc

Published property UseAsGlobalFile: boolean read FUseAsGlobalFile write SetUseAsGlobalFile default false;

Defines whether the component is used as global PropSaveFile for all other shared forms

Published property OnLoadContent: TNotifyEvent read FOnLoadContent write FOnLoadContent;

event is called to load ini content, if not defined then standard ini file is used

Published property OnSaveContent: TNotifyEvent read FOnSaveContent write FOnSaveContent;

event is called to save ini content, if not defined then standard ini file is used

Published property OnReadValue: TReadValueEvent read FOnReadValue write FOnReadValue;

event is called after reading of any value

Published property OnWriteValue: TWriteValueEvent read FOnWriteValue write FOnWriteValue;

event is called before writing of any value

Published property OnGetIniFileEncoding: TGetEncodingEvent read FGetIniFileEncoding write FGetIniFileEncoding;

event is called during creating of INI file to define used encoding


Generated by PasDoc 0.15.0.