A modded EditSaber for making beat saber maps.
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.

102 lines
5.1 KiB

  1. #pragma once
  2. #include "ZipUtilityInterface.h"
  3. #include "ZipOperation.h"
  4. #include "ZipFileFunctionLibrary.generated.h"
  5. UENUM(BlueprintType)
  6. enum ZipUtilityCompressionFormat
  7. {
  8. COMPRESSION_FORMAT_UNKNOWN,
  9. COMPRESSION_FORMAT_SEVEN_ZIP,
  10. COMPRESSION_FORMAT_ZIP,
  11. COMPRESSION_FORMAT_GZIP,
  12. COMPRESSION_FORMAT_BZIP2,
  13. COMPRESSION_FORMAT_RAR,
  14. COMPRESSION_FORMAT_TAR,
  15. COMPRESSION_FORMAT_ISO,
  16. COMPRESSION_FORMAT_CAB,
  17. COMPRESSION_FORMAT_LZMA,
  18. COMPRESSION_FORMAT_LZMA86
  19. };
  20. UENUM(BlueprintType)
  21. enum ZipUtilityCompressionLevel
  22. {
  23. COMPRESSION_LEVEL_NONE,
  24. COMPRESSION_LEVEL_FAST,
  25. COMPRESSION_LEVEL_NORMAL
  26. };
  27. class SevenZipCallbackHandler;
  28. class UZipFileFunctionInternalCallback;
  29. /**
  30. A blueprint function library encapsulating all zip operations for both C++ and blueprint use.
  31. For some operations a UZipOperation object may be returned, if you're interested in it, ensure
  32. you guard it from garbage collection by e.g. storing it as a UProperty, otherwise you may safely
  33. ignore it.
  34. */
  35. UCLASS(ClassGroup = ZipUtility, Blueprintable)
  36. class ZIPUTILITY_API UZipFileFunctionLibrary : public UBlueprintFunctionLibrary
  37. {
  38. GENERATED_UCLASS_BODY()
  39. public:
  40. ~UZipFileFunctionLibrary();
  41. /* Unzips file in archive containing Name via ListFilesInArchive/UnzipFiles. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  42. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  43. static bool UnzipFileNamed(const FString& archivePath, const FString& Name, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  44. /* Unzips file in archive containing Name at destination path via ListFilesInArchive/UnzipFilesTo. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  45. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  46. static bool UnzipFileNamedTo(const FString& archivePath, const FString& Name, const FString& destinationPath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  47. /* Unzips the given file indexes in archive at destination path. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  48. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  49. static UZipOperation* UnzipFilesTo(const TArray<int32> fileIndices, const FString& archivePath, const FString& destinationPath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  50. /* Unzips the given file indexes in archive at current path. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  51. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  52. static UZipOperation* UnzipFiles(const TArray<int32> fileIndices, const FString& ArchivePath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  53. /* Unzips archive at current path. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  54. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  55. static UZipOperation* Unzip(const FString& ArchivePath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat Format = COMPRESSION_FORMAT_UNKNOWN);
  56. /* Lambda C++ simple variant*/
  57. static UZipOperation* UnzipWithLambda( const FString& ArchivePath,
  58. TFunction<void()> OnDoneCallback,
  59. TFunction<void(float)> OnProgressCallback = nullptr,
  60. ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  61. /* Unzips archive at destination path. Automatically determines compression if unknown. Calls ZipUtilityInterface progress events. */
  62. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  63. static UZipOperation* UnzipTo(const FString& ArchivePath, const FString& DestinationPath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  64. /* Compresses the file or folder given at path and places the file in the same root folder. Calls ZipUtilityInterface progress events. Not all formats are supported for compression.*/
  65. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  66. static UZipOperation* Zip( const FString& FileOrFolderPath,
  67. UObject* ZipUtilityInterfaceDelegate,
  68. ZipUtilityCompressionFormat Format = COMPRESSION_FORMAT_SEVEN_ZIP,
  69. TEnumAsByte<ZipUtilityCompressionLevel> Level = COMPRESSION_LEVEL_NORMAL);
  70. /* Lambda C++ simple variant*/
  71. static UZipOperation* ZipWithLambda( const FString& ArchivePath,
  72. TFunction<void()> OnDoneCallback,
  73. TFunction<void(float)> OnProgressCallback = nullptr,
  74. ZipUtilityCompressionFormat Format = COMPRESSION_FORMAT_UNKNOWN,
  75. TEnumAsByte<ZipUtilityCompressionLevel> Level = COMPRESSION_LEVEL_NORMAL);
  76. /*Queries Archive content list, calls ZipUtilityInterface list events (OnFileFound)*/
  77. UFUNCTION(BlueprintCallable, Category = ZipUtility)
  78. static bool ListFilesInArchive(const FString& ArchivePath, UObject* ZipUtilityInterfaceDelegate, ZipUtilityCompressionFormat format = COMPRESSION_FORMAT_UNKNOWN);
  79. static FGraphEventRef RunLambdaOnGameThread(TFunction< void()> InFunction);
  80. };