CefZipReader.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright aXiuShen. All Rights Reserved.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "warp_macro.h"
  5. namespace webview {
  6. struct _ZIPFILES;
  7. }
  8. class CEFBROWSER_DLL UZipReaderImp
  9. {
  10. public:
  11. /**
  12. * Open on zip file
  13. * @param zipFile only support zip
  14. * @param passwd pass word
  15. * @return false is failed,true is successful and move to first file
  16. */
  17. bool Open(const FString& zipFile, const FString& passwd);
  18. /**
  19. * Get zip all file list. contains dir
  20. * @return all file
  21. * e.g: file1.txt dir/ dir/file.png
  22. */
  23. TArray<FString> GetAllFileNames();
  24. /**
  25. * move pointer of file to first
  26. * @return false is failed,true is successful
  27. */
  28. bool MoveToFirstFile();
  29. /**
  30. * move pointer of file to next from cur position
  31. * @return false is failed,true is successful
  32. */
  33. bool MoveToNextFile();
  34. /**
  35. * move pointer of file to special file
  36. * @param fileName Move to destination file location
  37. * @param caseSensitive Match case
  38. * @return false is failed,true is successful
  39. */
  40. bool MoveToFile(const FString& fileName, bool caseSensitive = true);
  41. /**
  42. * Get the current file name
  43. * @return file name
  44. */
  45. FString GetFileName();
  46. /**
  47. * Get the current file size
  48. * @return file size
  49. */
  50. int32 GetFileSize();
  51. /**
  52. * Get the current file content into buffer
  53. * @param data file content
  54. * @return false is failed,true is successful
  55. */
  56. bool ReadToString(FString& data);
  57. /**
  58. * Get the current file content into directory
  59. * @param Dir directory used to save file
  60. * @return false is failed,true is successful
  61. */
  62. bool ReadToDir(const FString& Dir);
  63. /**
  64. * Get all files content into directory
  65. * @param Dir directory used to save file
  66. * @return false is failed,true is successful
  67. */
  68. bool ReadAllToDir(const FString& Dir);
  69. /**
  70. * check object has open zip file
  71. * @return false is failed,true is successful
  72. */
  73. bool IsValid();
  74. private:
  75. private:
  76. TSharedPtr<webview::_ZIPFILES> zipFilePtr;
  77. };