THYAutoUpdateService
Overview
The THYAutoUpdateService service implements the basic functionality of an auto update service. Please refere to this article for more information.
Location
- Unit: HYAutoUpdateService_Impl.pas
- Ancestry: TRORemoteDataModule | THYAutoUpdateService
FileSearchInfo
Stores the list of directories that are used by servers and clients to generate their file lists.
property FileSearchInfo: THYFileSearchInfoCollection read write
GetFileData protected
Reads data from a file with given parameters.
function GetFileData(const UpdateInfo: THYFileUpdateInfo; const Offset: Integer; const Count: Integer; out Data: Binary): Integer
Parameters:
- UpdateInfo: Reference to the update info that stores information about file.
- Offset: Defines starting position.
- Count: Number of bytes to read.
- Data: Output data.
GetUpdatesInfo protected
Scans for a server files and compares them to a client files. Returns an array of items that needs to be updated.
function GetUpdatesInfo(const UpdateID: string; const ClientFiles: THYFileUpdateInfoArray): THYFileUpdateInfoArray
Parameters:
- UpdateID: User-defined identificator of update.
- ClientFiles: Array that holds description of a client files.
OnCompareUpdates
This event is invoked when service needs to compare to files. Please note that this event if fired only when UpdateComparisonMethod
is set to ucmUserDefined
.
property OnCompareUpdates: THYUpdateComparisonEvent read write
delegate: procedure OnCompareUpdates(Sender: TObject; aFileInfo: THYFileUpdateInfo; anUpdate: THYFileUpdateInfo; var FileInfoIsUpToDate: Boolean)
OnGetFileData
Service fires this event when he reads data of a file.
property OnGetFileData: THYGetFileDataEvent read write
delegate: procedure OnGetFileData(Sender: THYAutoUpdateService; FileName: string; Offset: Integer; Count: Integer; ActualData: Binary)
OnGetUpdatesInfo
This event if fired after service finished to process updated info.
property OnGetUpdatesInfo: THYGetUpdatesInfoEvent read write
delegate: procedure OnGetUpdatesInfo(Sender: THYAutoUpdateService; ClientFileList: THYFileUpdateInfoArray; UpdatesList: THYFileUpdateInfoArray)
OnVerifyUpdateStatus
Handle this event to process calls to a VerifyUpdateStatus
.
property OnVerifyUpdateStatus: THYVerifyUpdateStatusEvent read write
delegate: procedure OnVerifyUpdateStatus(Sender: THYAutoUpdateService; const LastUpdateID: string; var UpdateStatus: THYUpdateStatus; var CurrentUpdateID: string; var UserData: string)
UpdateComparisonMethod
Gets or sets the method of file comparison.
property UpdateComparisonMethod: THYUpdateComparisonMethod read write
VerifyUpdateStatus protected
This method can be called to check the update status based on a user-defined identifiers. By default service returns usNeedsUpdate
or fires OnVerifyUpdateStatus
event.
function VerifyUpdateStatus(const LastUpdateID: string; out CurrentUpdateID: string; out UserData: string): THYUpdateStatus
Parameters:
- LastUpdateID: User-defined identifier of update on a client side.
- CurrentUpdateID: User-defined identifier of current update on a server side.
- UserData: Custom data.
FileSearchInfo
Stores the list of directories that are used by servers and clients to generate their file lists.
property FileSearchInfo: THYFileSearchInfoCollection read write
UpdateComparisonMethod
Gets or sets the method of file comparison.
property UpdateComparisonMethod: THYUpdateComparisonMethod read write
GetFileData protected
Reads data from a file with given parameters.
function GetFileData(const UpdateInfo: THYFileUpdateInfo; const Offset: Integer; const Count: Integer; out Data: Binary): Integer
Parameters:
- UpdateInfo: Reference to the update info that stores information about file.
- Offset: Defines starting position.
- Count: Number of bytes to read.
- Data: Output data.
GetUpdatesInfo protected
Scans for a server files and compares them to a client files. Returns an array of items that needs to be updated.
function GetUpdatesInfo(const UpdateID: string; const ClientFiles: THYFileUpdateInfoArray): THYFileUpdateInfoArray
Parameters:
- UpdateID: User-defined identificator of update.
- ClientFiles: Array that holds description of a client files.
VerifyUpdateStatus protected
This method can be called to check the update status based on a user-defined identifiers. By default service returns usNeedsUpdate
or fires OnVerifyUpdateStatus
event.
function VerifyUpdateStatus(const LastUpdateID: string; out CurrentUpdateID: string; out UserData: string): THYUpdateStatus
Parameters:
- LastUpdateID: User-defined identifier of update on a client side.
- CurrentUpdateID: User-defined identifier of current update on a server side.
- UserData: Custom data.
OnCompareUpdates
This event is invoked when service needs to compare to files. Please note that this event if fired only when UpdateComparisonMethod
is set to ucmUserDefined
.
property OnCompareUpdates: THYUpdateComparisonEvent read write
delegate: procedure OnCompareUpdates(Sender: TObject; aFileInfo: THYFileUpdateInfo; anUpdate: THYFileUpdateInfo; var FileInfoIsUpToDate: Boolean)
OnGetFileData
Service fires this event when he reads data of a file.
property OnGetFileData: THYGetFileDataEvent read write
delegate: procedure OnGetFileData(Sender: THYAutoUpdateService; FileName: string; Offset: Integer; Count: Integer; ActualData: Binary)
OnGetUpdatesInfo
This event if fired after service finished to process updated info.
property OnGetUpdatesInfo: THYGetUpdatesInfoEvent read write
delegate: procedure OnGetUpdatesInfo(Sender: THYAutoUpdateService; ClientFileList: THYFileUpdateInfoArray; UpdatesList: THYFileUpdateInfoArray)
OnVerifyUpdateStatus
Handle this event to process calls to a VerifyUpdateStatus
.
property OnVerifyUpdateStatus: THYVerifyUpdateStatusEvent read write
delegate: procedure OnVerifyUpdateStatus(Sender: THYAutoUpdateService; const LastUpdateID: string; var UpdateStatus: THYUpdateStatus; var CurrentUpdateID: string; var UserData: string)