Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface for filesystem calls used by the saverestore system
  4. // to manupulate the save directory.
  5. //
  6. //=============================================================================//
  7. #ifndef SAVERESTOREFILESYSTEM_H
  8. #define SAVERESTOREFILESYSTEM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "utlmap.h"
  13. #include "utlsymbol.h"
  14. #include "filesystem.h"
  15. abstract_class ISaveRestoreFileSystem
  16. {
  17. public:
  18. virtual FileHandle_t Open( const char *pFileName, const char *pOptions, const char *pathID = NULL ) = 0;
  19. virtual void Close( FileHandle_t ) = 0;
  20. virtual int Read( void *pOutput, int size, FileHandle_t file ) = 0;
  21. virtual int Write( void const* pInput, int size, FileHandle_t file ) = 0;
  22. virtual void Seek( FileHandle_t file, int pos, FileSystemSeek_t method ) = 0;
  23. virtual unsigned int Tell( FileHandle_t file ) = 0;
  24. virtual unsigned int Size( FileHandle_t file ) = 0;
  25. virtual unsigned int Size( const char *pFileName, const char *pPathID = NULL ) = 0;
  26. virtual bool FileExists( const char *pFileName, const char *pPathID = NULL ) = 0;
  27. virtual void RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID = NULL ) = 0;
  28. virtual void RemoveFile( char const* pRelativePath, const char *pathID = NULL ) = 0;
  29. virtual void AsyncFinishAllWrites( void ) = 0;
  30. virtual void AsyncRelease( FSAsyncControl_t hControl ) = 0;
  31. virtual FSAsyncStatus_t AsyncWrite( const char *pFileName, const void *pSrc, int nSrcBytes, bool bFreeMemory, bool bAppend, FSAsyncControl_t *pControl = NULL ) = 0;
  32. virtual FSAsyncStatus_t AsyncFinish( FSAsyncControl_t hControl, bool wait = false ) = 0;
  33. virtual FSAsyncStatus_t AsyncAppend( const char *pFileName, const void *pSrc, int nSrcBytes, bool bFreeMemory, FSAsyncControl_t *pControl = NULL ) = 0;
  34. virtual FSAsyncStatus_t AsyncAppendFile( const char *pDestFileName, const char *pSrcFileName, FSAsyncControl_t *pControl = NULL ) = 0;
  35. virtual void DirectoryCopy( const char *pPath, const char *pDestFileName, bool bIsXSave ) = 0;
  36. virtual bool DirectoryExtract( FileHandle_t pFile, int fileCount, bool bIsXSave ) = 0;
  37. virtual int DirectoryCount( const char *pPath ) = 0;
  38. virtual void DirectoryClear( const char *pPath, bool bIsXSave ) = 0;
  39. virtual void AuditFiles( void ) = 0;
  40. virtual bool LoadFileFromDisk( const char *pFilename ) = 0;
  41. };
  42. extern ISaveRestoreFileSystem *g_pSaveRestoreFileSystem;
  43. #endif // SAVERESTOREFILESYSTEM_H