1
0

ProgressiveHTTPReader.h 739 B

123456789101112131415161718192021222324252627
  1. #ifndef NULLSOFT_PROGRESSIVEHTTPREADER_H
  2. #define NULLSOFT_PROGRESSIVEHTTPREADER_H
  3. #include <api/service/svcs/svc_fileread.h>
  4. #include <windows.h>
  5. class ProgressiveHTTPReader : public svc_fileReader
  6. {
  7. public:
  8. ProgressiveHTTPReader() : hFile(INVALID_HANDLE_VALUE), hMap(0), offset(0)
  9. {}
  10. int isMine(const wchar_t *filename, int mode=SvcFileReader::READ);
  11. int open(const wchar_t *filename, int mode=SvcFileReader::READ);
  12. size_t read(__int8 *buffer, size_t length);
  13. void IncrementPosition(uint64_t inc);
  14. size_t GetPageNumber() const;
  15. private:
  16. char tempFile[MAX_PATH];
  17. HANDLE hFile;
  18. HANDLE hMap;
  19. uint32_t pageSize;
  20. LARGE_INTEGER pagePosition; // will always be % pageSize == 0
  21. uint32_t offset; // offset into the page
  22. };
  23. #endif