Unit MyBackup

Classes

TMyBackup -

Functions

Register -

Types

TOperation

Constants

kInfosFile
kMinDiskSpace
sAskForDeletionOfFiles
sCopyOf
sCouldNotDeleteAllFiles
sCouldNotWriteInFile
sDeletingFilesOfDrivePath
sInsertDiskXInUnit
sNeedValidDrivePath
sSystemMessage
sThePathDoesNotExist
sThisDiskContainsNoBackup
sThisDiskIsNotTheFirstOne
sWrongBackupName
sWrongBackupSet

Variables


Functions


procedure Register;


Types


TOperation = (opBackup, opRestore, opNone);
English constants sSystemMessage = 'System message'; sNeedValidDrivePath = 'You must give a valid path to the backup drive'; sInsertDiskXInUnit = 'Please, insert disk #%d in drive %s:'; sDeletingFilesOfDrivePath = 'Deleting files of backup drive...'; sAskForDeletionOfFiles = 'Backup drive contains files. Do you want to delete them ?'; sCouldNotDeleteAllFiles = 'Could not delete all files !'; sThisDiskIsNotTheFirstOne = 'This disk is not the first of the backup disks set.'; sThePathDoesNotExist = 'The path "%s" does not exist'; sCopyOf = 'Copy of %s'; sCouldNotWriteInFile = 'Could not write in file %s'; sThisDiskContainsNoBackup = 'This disk does not contain any backup.'; sWrongBackupSet = 'This disk does not belong to the backup set: %s'; sWrongBackupName = 'This disk contains a backup of "%s" instead of "%s".';

Constants

kInfosFile = 'infos.txt'

kMinDiskSpace = 1024*8

This component are freeware. You may use it, distribute it and modify it, but you may not charge for it. In case of modifications you must mail me (mmm@imaginet.fr) a copy of the modifications. The reason are simple: Any changes that improve this free- ware component should be to benefit for everybody, not only you. That way you can be pretty sure, that this component has few errors and much functionality. In case of modifications, you will be on the credits list beneath:} { Version 1.0 (25/06/97) by Morgan Martinet (France): This version is the base version. This Component let you backup/restore a set of files in a directory. It will split the files if they don't fit in the Backup unit. I use this component with the Delphi Zip component that implements PK(UN)ZIP v2.04g, and it works perfectly ! So I first make a zipped archive of my directories and then I use MyBackup to to put this archives on disks because DelphiZip doesn't implement segmented archives. Properties: DrivePath = sets the path of the backup unit (by default it is A:\) FilesPath = sets the path from where the files will be backed up or to where the files will be restored. BackupCaption = sets a title for the Backup operation RestoreCaption = sets a title for the Restore operation ConfirmDelete = lets you specify if the user will be warned when the component will need to erase the files of DrivePath Version = sets the Version of your software that did the backup, in order to update your files if the backup is older than the current version. ID = sets a personal ID in order to identify the product that did the backup and avoid restoring the backup of another product. IdLabel = sets a label for the Id of the Backup. This label will be displayed when an Id's disk does not match the Id of this component (cf. ID). BackupName = sets a name for the backup. UserName = sets the name of the registered user of your software in order to check the origin of a backup. UserCompany = sets the company of the registered user of your software in order to check the origin of a backup. UserLicence = sets the licence of the registered user of your software in order to check the origin of a backup. InfosFileName = sets the name of the file that contains the informations about the backup and that will be written on each disk. For this properties look at the comments in the CopyFile component Progress OnStartOperation OnFinishOperation OnOperationProgress OnEachFile Methods: Backup = start the backup process Restore = start the restore process CheckFirstDisk = check if the disk inserted contains the first disk of a backup GetInfos = get the file that contains the informations about the backup into a list of strings (TStrings). You can then get the informations like: var SL : TStringList; begin SL := TStringList.Create; try if GetInfos( SL ) then begin version := SL.Values['Version']; disk_num := StrToInt(SL.Values['Disk#']); name := SL.Values['Backup.Name']; end else // error ! finally SL.Free; end; end; { Version 1.1 (09/10/97) Morgan Martinet (France): Added property Filter in order to filter the files of the FilesPath to be backed up. Added property FilesToBackup (StringList) in order to backup a list of files instead of the content of the FilesPath directory. Added property FilesRestored (StringList) in order to know which files were restored. Modified Backup procedure: if the FilesToBackup list is not empty, we use this list in order to do the backup, otherwise we use the files of the FilesPath directory. Modified Restore procedure: we update the FilesRestored list, as we restore a new file.

sAskForDeletionOfFiles = 'L''unité de sauvegarde contient des fichiers. Désirez-vous les supprimer ?'

sCopyOf = 'Copie de %s'

sCouldNotDeleteAllFiles = 'Impossible de supprimer tous les fichiers !'

sCouldNotWriteInFile = 'Impossible d''écrire dans le fichier %s'

sDeletingFilesOfDrivePath = 'Suppression des fichiers sur l''unité de sauvegarde...'

sInsertDiskXInUnit = 'Veuillez insérer la disquette n° %d dans l''unité %s:'

sNeedValidDrivePath = 'Vous devez fournir un chemin d''accès valide pour l''unité de sauvegarde'

sSystemMessage = 'Message système'

French constants

sThePathDoesNotExist = 'Le chemin "%s" n''existe pas'

sThisDiskContainsNoBackup = 'Cette disquette ne contient pas de sauvegarde'

sThisDiskIsNotTheFirstOne = 'Cette disquette n''est pas la première du jeu de sauvegarde.'

sWrongBackupName = 'Cette disquette contient une sauvegarde de "%s" au lieu de "%s".'

sWrongBackupSet = 'Cette disquette n''appartient pas au jeu de sauvegardes: %s'


Variables