Class TAppDirCfg

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAppDirCfg = class(TComponent)

Description

TAppDirCfg is non visual component which provides functionality for automatic loading and processing of txt configuration file. Configuration file has INI file format and can contain following symbols: %APPDIR%, %SYSTEMDIR%, %WINDIR%, %MYDOC%, %LOCALAPP%, %TEMPDIR%

Default name of cfg file: ApplicationName.dir
Example of cfg file:
DataDir=%APPDIR%\Data
ReportDir=%APPDIR%\Reports
DLLDir=%SYSTEMDIR%
INIDir=%WINDIR%

Hierarchy

  • TComponent
  • TAppDirCfg

Overview

Methods

Public function SystemDir: string;
Public function WinDir: string;
Public function MyDocumentDir: string;
Public function LocalApplDir: string;
Public function TemporaryDir: string;
Public function CfgExists(Name: string): boolean;
Public function GetCfg(Name: string): string;
Public function GetCfgDef(Name, DefaultCfg: string): string;
Public function GetDir(DirName: string): string;
Public function GetDirDef(DirName, DefaultDir: string): string;
Public function GetSpecialDir(FolderType: integer): string;
Public procedure LoadCfgFile; virtual;

Properties

Published property CfgFileName: string read FCfgFileName write SetCfgFileName;
Published property CreateAllDir: boolean read FCreateAllDir write FCreateAllDir default false;

Description

Methods

Public function SystemDir: string;

returns current SystemDirectory (e.g. C:\Windows\System\)

Public function WinDir: string;

returns current WindowsDirectory (e.g. C:\Windows\)

Public function MyDocumentDir: string;

returns MyDocument directory for current user

Public function LocalApplDir: string;

returns current Local Application (e.g. C:\Windows\)

Public function TemporaryDir: string;

returns Temporary directory

Public function CfgExists(Name: string): boolean;

tests if "Name" does exist in cfg file

Public function GetCfg(Name: string): string;

returns value of "Name" item from cfg file; e.g. line in cfgfile: DefaultFormat=0.00 ; Name='DefaultFormat', result will be 0.00

Public function GetCfgDef(Name, DefaultCfg: string): string;

returns value of "Name" item from cfg file or "DefaultCfg" if "Name" not found

Public function GetDir(DirName: string): string;

returns value of "DirName" item from cfg file; last character is backslash

Public function GetDirDef(DirName, DefaultDir: string): string;

returns value of "DirName" item from cfg file or "DefaultDir" if "DirName" not found; last character is backslash

Public function GetSpecialDir(FolderType: integer): string;

returns special directory in system according parameter FolderType, see ShlObj for list of values: CSIDL_DESKTOP, CSIDL_INTERNET, CSIDL_PROGRAMS, CSIDL_CONTROLS, CSIDL_PRINTERS, CSIDL_PERSONAL, CSIDL_FAVORITES, CSIDL_STARTUP, CSIDL_RECENT, CSIDL_SENDTO, CSIDL_BITBUCKET, CSIDL_STARTMENU, CSIDL_DESKTOPDIRECTORY, CSIDL_DRIVES, CSIDL_NETWORK, CSIDL_NETHOOD, CSIDL_FONTS, CSIDL_TEMPLATES, CSIDL_COMMON_STARTMENU, CSIDL_COMMON_PROGRAMS, CSIDL_COMMON_STARTUP, CSIDL_COMMON_DESKTOPDIRECTORY, CSIDL_APPDATA, CSIDL_PRINTHOOD, CSIDL_ALTSTARTUP, CSIDL_COMMON_ALTSTARTUP, CSIDL_COMMON_FAVORITES, CSIDL_INTERNET_CACHE, CSIDL_COOKIES, CSIDL_HISTORY

Public procedure LoadCfgFile; virtual;

reload cfg file from disk (called automatically in Loaded event)

Properties

Published property CfgFileName: string read FCfgFileName write SetCfgFileName;

FileName of cfg file, 'ApplicationName.dir' is used if empty

Published property CreateAllDir: boolean read FCreateAllDir write FCreateAllDir default false;

if true, application creates all directories from cfg file on startup


Generated by PasDoc 0.13.0 on 2016-02-19 08:14:10