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.

42 lines
1.6 KiB

  1. #pragma once
  2. #include "Object.h"
  3. #include "ZipOperation.generated.h"
  4. class SevenZipCallbackHandler;
  5. /**
  6. * Used to track a zip/unzip operation on the WFULambdaRunnable ThreadPool and allows the ability to terminate the
  7. * operation early.
  8. */
  9. UCLASS(BlueprintType)
  10. class ZIPUTILITY_API UZipOperation : public UObject
  11. {
  12. GENERATED_BODY()
  13. public:
  14. UZipOperation();
  15. // Stops this zip/unzip if it is still valid. This stop event can occur in two places:
  16. // 1. The ThreadPool queue, if it can be stopped here then the operation has not yet started.
  17. // 2. The SevenZip layer, once the operation has started, it can be canceled while still running.
  18. // Note that calling this carries no guarantees of a successful stop, the end result might be one of:
  19. // * The file still got extracted (you were too late)
  20. // * The file was never extracted (caught it on time)
  21. // * The file was created but is of zero size (oops)
  22. // * The file was created, is of non-zero size but is not all there (cut off in the middle)
  23. // So, it could be a good idea to do some file housekeeping afterward.
  24. UFUNCTION(BlueprintCallable, Category = "Zip Operation")
  25. void StopOperation();
  26. // Set the callback handler
  27. void SetCallbackHandler(SevenZipCallbackHandler* Handler);
  28. // Set the queued work
  29. void SetThreadPoolWorker(IQueuedWork* Work);
  30. private:
  31. // A pointer to the callback for this operation. Once the operation completes, this
  32. // pointer will become invalid.
  33. SevenZipCallbackHandler* CallbackHandler;
  34. // The work that was queued on the async threadpool in WFULambdaRunnable
  35. IQueuedWork* ThreadPoolWork;
  36. };