Counter Strike : Global Offensive Source Code
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.

90 lines
3.5 KiB

  1. //===== Copyright Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Implementation to execute traditional save to disk behavior
  4. //
  5. //===========================================================================//
  6. #ifndef SAVERESTORE_FILESYSTEM_PASSTHROUGH_H
  7. #define SAVERESTORE_FILESYSTEM_PASSTHROUGH_H
  8. //-----------------------------------------------------------------------------
  9. // Purpose: Implementation to execute traditional save to disk behavior
  10. //-----------------------------------------------------------------------------
  11. class CSaveRestoreFileSystemPassthrough : public ISaveRestoreFileSystem
  12. {
  13. public:
  14. CSaveRestoreFileSystemPassthrough();
  15. bool FileExists( const char *pFileName, const char *pPathID );
  16. void RemoveFile( char const* pRelativePath, const char *pathID );
  17. void RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID );
  18. void AsyncFinishAllWrites( void );
  19. FileHandle_t Open( const char *pFullName, const char *pOptions, const char *pathID );
  20. void Close( FileHandle_t hSaveFile );
  21. int Read( void *pOutput, int size, FileHandle_t hFile );
  22. int Write( void const* pInput, int size, FileHandle_t hFile );
  23. FSAsyncStatus_t AsyncWrite( const char *pFileName, const void *pSrc, int nSrcBytes, bool bFreeMemory, bool bAppend, FSAsyncControl_t *pControl );
  24. void Seek( FileHandle_t hFile, int pos, FileSystemSeek_t method );
  25. unsigned int Tell( FileHandle_t hFile );
  26. unsigned int Size( FileHandle_t hFile );
  27. unsigned int Size( const char *pFileName, const char *pPathID );
  28. FSAsyncStatus_t AsyncFinish( FSAsyncControl_t hControl, bool wait );
  29. void AsyncRelease( FSAsyncControl_t hControl );
  30. FSAsyncStatus_t AsyncAppend(const char *pFileName, const void *pSrc, int nSrcBytes, bool bFreeMemory, FSAsyncControl_t *pControl );
  31. FSAsyncStatus_t AsyncAppendFile(const char *pDestFileName, const char *pSrcFileName, FSAsyncControl_t *pControl );
  32. //-----------------------------------------------------------------------------
  33. // Purpose: Copies the contents of the save directory into a single file
  34. //-----------------------------------------------------------------------------
  35. void DirectoryCopy( const char *pPath, const char *pDestFileName, bool bIsXSave );
  36. //-----------------------------------------------------------------------------
  37. // Purpose: Extracts all the files contained within pFile
  38. //-----------------------------------------------------------------------------
  39. bool DirectoryExtract( FileHandle_t pFile, int fileCount, bool bIsXSave );
  40. //-----------------------------------------------------------------------------
  41. // Purpose: returns the number of files in the specified filter
  42. //-----------------------------------------------------------------------------
  43. int DirectoryCount( const char *pPath );
  44. //-----------------------------------------------------------------------------
  45. // Purpose: Clears the save directory of all temporary files (*.hl)
  46. //-----------------------------------------------------------------------------
  47. void DirectoryClear( const char *pPath, bool bIsXSave );
  48. void AuditFiles( void );
  49. bool LoadFileFromDisk( const char *pFilename );
  50. struct filelistelem_t
  51. {
  52. char szFileName[MAX_PATH];
  53. };
  54. private:
  55. int m_iContainerOpens;
  56. enum { FILECOPYBUFSIZE = (1024 * 1024) };
  57. //-----------------------------------------------------------------------------
  58. // Purpose: Copy one file to another file
  59. //-----------------------------------------------------------------------------
  60. static bool FileCopy( FileHandle_t pOutput, FileHandle_t pInput, int fileSize );
  61. };
  62. #endif