TEnumerateFiles
Return to Introduction  Previous page  Next page
A pointer to a method of this type is passed by the server as a parameter to the VcsInitAddin method. This method can be called to enumerate through all files in the repository. Depending on the parameters you provide, it will enumerate Projects, Archive, or both. As each file is enumerated, it is passed back through a call to the procedure of type TEnumerateFilesProc.

type  
  TEnumerateFilesProc = procedure( pFile: PChar ); stdcall;  
 
  TEnumerateFiles = procedure ( pPath: PChar; EnumerateProjects, EnumerateArchives: Boolean;   
                                EnumerateProc: TEnumerateFilesProc ); stdcall;  

Parameters

Name
Description
pPath
The path to the repository you want to enumerate. Normally the path passed into VcsInitAddin
EnumerateProjects
Set this to True to enumerate the project files
EnumerateArchives
Set this to True to enumerate individual file archives
EnumerateProc
Procedure of type TEnumerateFilesProc that is called for each Project or Archive that is enumerated. The parameter pFile contains the full path of the file being enumerated.



Example (Delphi)

procedure EnumFiles( pFile: PChar ); stdcall;  
var  
  BackupFile: String;  
begin  
  // Each file in the repository (depending on user options) will be passed to this procedure.  
  // Simple backup procedure to copy the passed file to another folder...  
  BackupFile := FPath + ExtractFileName( String( pFile ) );  
  if FilesDifferent( String( pFile ), BackupFile ) then  
    CopyFile( pFile, PChar( BackupFile ), False );  
end;  
 
procedure TBackupThread.Backup;  
begin  
  FBusy := True;  
  try  
    // Backup can only be executed when the server is disabled  
    DoDisableServer;  
    try  
      // Flush the buffers before running the Backup routine to make sure  
      // the files are current  
      DoFlushBuffers;  
      // The backup will actually be done in the EnumFiles procedure  
      DoEnumerateFiles( PChar( RepositoryPath ), True, True, EnumFiles );  
    finally  
      DoEnableServer;  
    end;  
  finally  
    FBusy := False;  
  end;  
end;  
 

 


© 1995-2018 MCN Software