LeviLamina
Loading...
Searching...
No Matches
FileArchiver.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/file/ZipProgress.h"
8#include "mc/deps/core/string/BasicStackString.h"
9#include "mc/deps/core/threading/Async.h"
10#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
11#include "mc/deps/core/utility/NonOwnerPointer.h"
12#include "mc/deps/core/utility/UniqueOwnerPointer.h"
13#include "mc/platform/threading/Mutex.h"
14#include "mc/world/level/FileArchiverOutcome.h"
15
16// auto generated forward declare list
17// clang-format off
20class ILevelListCache;
22class Level;
23class LevelData;
24class LevelDbEnv;
25class LevelStorage;
26class PackInstance;
27class Scheduler;
28class TaskGroup;
29namespace Core { class FilePathManager; }
30namespace Core { class Path; }
31// clang-format on
32
34public:
35 // FileArchiver inner types declare
36 // clang-format off
37 struct CopyWorldResult;
38 struct EduCloudImportInfo;
39 struct ExportData;
40 class IWorldConverter;
41 struct ImportWorldsResult;
42 class ProgressReporter;
43 struct Result;
44 // clang-format on
45
46 // FileArchiver inner types define
47 enum class State : int {
48 Idle = 0,
49 Importing = 1,
50 Exporting = 2,
51 };
52
53 enum class ExportType : int {
54 Level = 0,
55 Template = 1,
56 Project = 2,
57 PlayableEditorLevel = 3,
58 PackagedLevel = 4,
59 };
60
61 enum class ShowToast : int {
62 Enabled = 0,
63 Disabled = 1,
64 };
65
66 struct Result {
67 public:
68 // member variables
69 // NOLINTBEGIN
70 ::ll::TypedStorage<4, 4, ::FileArchiverOutcome> outcome;
71 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> fileName;
72 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> levelId;
73 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> originalLevelId;
74 // NOLINTEND
75
76 public:
77 // member functions
78 // NOLINTBEGIN
79 MCAPI ~Result();
80 // NOLINTEND
81
82 public:
83 // destructor thunk
84 // NOLINTBEGIN
85 MCFOLD void $dtor();
86 // NOLINTEND
87 };
88
89 struct ExportData {
90 public:
91 // member variables
92 // NOLINTBEGIN
93 ::ll::TypedStorage<8, 32, ::std::string> mLevelId;
94 ::ll::TypedStorage<8, 8, uint64> mTotalFileCount;
95 ::ll::TypedStorage<8, 104, ::FileArchiver::Result> mResult;
96 ::ll::TypedStorage<8, 16, ::Bedrock::UniqueOwnerPointer<::LevelStorage>> mLevelStorage;
97 ::ll::TypedStorage<8, 8, ::LevelData*> mLevelData;
98 // NOLINTEND
99
100 public:
101 // member functions
102 // NOLINTBEGIN
103 MCAPI ExportData();
104 // NOLINTEND
105
106 public:
107 // constructor thunks
108 // NOLINTBEGIN
109 MCAPI void* $ctor();
110 // NOLINTEND
111 };
112
114 public:
115 // member variables
116 // NOLINTBEGIN
117 ::ll::TypedStorage<4, 4, ::FileArchiverOutcome> outcome;
118 ::ll::TypedStorage<8, 32, ::std::string> copiedLevelId;
119 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> copiedLevelPath;
120 // NOLINTEND
121 };
122
124 public:
125 // member variables
126 // NOLINTBEGIN
127 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mProgressLock;
128 ::ll::TypedStorage<8, 32, ::std::string> mProgressTitle;
129 ::ll::TypedStorage<8, 32, ::std::string> mProgressMessage;
130 // NOLINTEND
131
132 public:
133 // virtual functions
134 // NOLINTBEGIN
135 // vIndex: 0
136 virtual ~ProgressReporter() /*override*/;
137
138 // vIndex: 1
139 virtual void clear() /*override*/;
140 // NOLINTEND
141
142 public:
143 // destructor thunk
144 // NOLINTBEGIN
145 MCAPI void $dtor();
146 // NOLINTEND
147
148 public:
149 // virtual function thunks
150 // NOLINTBEGIN
151 MCAPI void $clear();
152 // NOLINTEND
153
154 public:
155 // vftables
156 // NOLINTBEGIN
157 MCNAPI static void** $vftableForZipProgress();
158
160 // NOLINTEND
161 };
162
164 public:
165 // IWorldConverter inner types define
166 using PreExportConvertedCallback = ::std::function<void(::LevelData&)>;
167
168 using InTaskFilePathCallBack =
169 ::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>;
170
171 public:
172 // virtual functions
173 // NOLINTBEGIN
174 // vIndex: 0
175 virtual ~IWorldConverter() = default;
176
177 // vIndex: 1
178 virtual void enqueueConvertImportingWorldTasks(
179 ::std::shared_ptr<::FileArchiver::Result>&,
180 ::Bedrock::NotNullNonOwnerPtr<::FileArchiver::ProgressReporter>,
182 ) = 0;
183
184 // vIndex: 2
185 virtual bool shouldCopyWorldForConversion(::std::string const&) const = 0;
186
187 // vIndex: 3
188 virtual void enqueueConvertExportingWorldTasks(
189 ::std::shared_ptr<::FileArchiver::ExportData>&,
190 ::Bedrock::NotNullNonOwnerPtr<::FileArchiver::ProgressReporter>,
192 ::std::function<void(::LevelData&)>,
193 ::std::vector<::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>>
194 ) = 0;
195 // NOLINTEND
196
197 public:
198 // virtual function thunks
199 // NOLINTBEGIN
200
201 // NOLINTEND
202 };
203
204 using OperationCallback = ::std::function<void(::FileArchiver::Result&)>;
205
207 public:
208 // ImportWorldsResult inner types declare
209 // clang-format off
210 struct ImportWorldResult;
211 // clang-format on
212
213 // ImportWorldsResult inner types define
215 public:
216 // member variables
217 // NOLINTBEGIN
218 ::ll::TypedStorage<4, 4, ::FileArchiverOutcome> outcome;
219 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> path;
220 // NOLINTEND
221 };
222
223 public:
224 // member variables
225 // NOLINTBEGIN
226 ::ll::TypedStorage<4, 4, ::FileArchiverOutcome> outcome;
227 ::ll::TypedStorage<8, 24, ::std::vector<::FileArchiver::ImportWorldsResult::ImportWorldResult>> worlds;
228 // NOLINTEND
229 };
230
232 public:
233 // member variables
234 // NOLINTBEGIN
235 ::ll::TypedStorage<1, 1, bool> isCloudImport;
236 ::ll::TypedStorage<1, 1, bool> allowMultiplayer;
237 ::ll::TypedStorage<8, 32, ::std::string> educationOid;
238 ::ll::TypedStorage<8, 32, ::std::string> cTag;
239 ::ll::TypedStorage<8, 32, ::std::string> name;
240 // NOLINTEND
241
242 public:
243 // member functions
244 // NOLINTBEGIN
245 MCAPI ~EduCloudImportInfo();
246 // NOLINTEND
247
248 public:
249 // destructor thunk
250 // NOLINTBEGIN
251 MCFOLD void $dtor();
252 // NOLINTEND
253 };
254
255public:
256 // member variables
257 // NOLINTBEGIN
258 ::ll::TypedStorage<8, 192, ::FileArchiver::ProgressReporter> mProgress;
259 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mStateLock;
260 ::ll::TypedStorage<4, 4, ::FileArchiver::State> mCurrentState;
261 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
262 ::ll::TypedStorage<8, 64, ::std::function<void(::std::string const&)>> mDisplayMessageCallback;
263 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IResourcePackRepository>> mResourcePackRepository;
264 ::ll::TypedStorage<8, 8, ::ILevelListCache&> mLevelListCache;
265 ::ll::TypedStorage<8, 24, ::std::vector<::Core::PathBuffer<::std::string>>> mSuccessfullyFiledArchives;
266 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mIOTaskGroup;
267 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::FileArchiver::IWorldConverter>> mWorldConverter;
268 ::ll::TypedStorage<1, 1, bool> mIsEditorModeEnabled;
269 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const>> mKeyProvider;
270 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv>> mLevelDbEnv;
271 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::FileArchiver::EduCloudImportInfo>>
272 mEduCloudImportInfo;
273 // NOLINTEND
274
275public:
276 // prevent constructor by default
277 FileArchiver& operator=(FileArchiver const&);
279 FileArchiver();
280
281public:
282 // virtual functions
283 // NOLINTBEGIN
284 // vIndex: 0
285 virtual ~FileArchiver() /*override*/;
286
287 // vIndex: 1
288 virtual ::std::shared_ptr<::FilePickerSettings>
289 generateFilePickerSettings(::std::vector<::FileArchiver::ExportType> const& types, ::std::string const&) const;
290 // NOLINTEND
291
292public:
293 // member functions
294 // NOLINTBEGIN
295 MCAPI FileArchiver(
296 ::Scheduler& scheduler,
297 ::ILevelListCache& levelListCache,
298 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
299 ::Bedrock::NotNullNonOwnerPtr<::IResourcePackRepository> const& resourcePackRepository,
300 bool isEditorModeEnabled,
301 ::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter,
302 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> keyProvider,
303 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
304 ::std::function<void(::std::string const&)> displayMessageFunction
305 );
306
307 MCAPI void _clearArchiverState();
308
309 MCAPI void
310 _copyPackToTemp(::PackInstance const& packInstance, ::Core::Path const& tempPath, ::FileArchiver::Result& result);
311
312 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> _enqueueExportWorldTasks(
313 ::Core::Path const& outputFilePath,
314 ::std::string const& worldId,
315 bool isBundle,
316 ::FileArchiver::ExportType exportType,
317 ::FileArchiver::ShowToast showToast,
319 ::std::function<void(::FileArchiver::Result&)> cleanupTask,
320 ::std::function<void(::LevelData&)> convertPreExportCallback,
321 ::std::vector<::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>>
322 pathCallbacks
323 );
324
325 MCAPI void _exportLevelFiles(
326 ::Core::Path const& outputFilePath,
327 bool isBundle,
328 ::std::shared_ptr<::FileArchiver::ExportData> exportData
329 );
330
331 MCAPI void _printLevelResultMessage(::FileArchiver::Result const& result);
332
333 MCAPI void _printLevelStartMessage();
334
335 MCAPI void _printMessage(::std::string const& message);
336
337 MCAPI ::FileArchiverOutcome
338 _processWorldForTemplate(::std::shared_ptr<::FileArchiver::ExportData> const& exportData);
339
340 MCAPI void _revertPremiumUpgradePacks(::Core::Path const& filePath);
341
342 MCAPI ::FileArchiver::Result _tryBeginExportLevel(
343 ::std::string const& levelId,
344 ::Core::Path const& exportFilePath,
345 ::FileArchiver::ShowToast showToast
346 );
347
348 MCAPI bool _validatePremiumUpgradePacks(::Core::Path const& filePath);
349
350 MCAPI ::std::string copyLevel(::std::string const& worldId);
351
352 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> exportCurrentEditorLevel(
353 ::Level* level,
354 ::Core::Path const& exportFilePath,
355 ::std::function<void(::LevelData&)> preExportConvertedCallback,
356 ::std::vector<::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>>
357 pathCallbacks,
358 ::FileArchiver::ExportType exportType,
359 ::FileArchiver::ShowToast toast
360 );
361
362 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> exportCurrentLevel(
363 ::Level* level,
364 bool isBundle,
365 ::FileArchiver::ExportType exportType,
366 ::Core::Path const& exportFilePath
367 );
368
369 MCAPI void exportCurrentLevel(
370 ::Level* level,
371 bool isBundle,
372 ::FileArchiver::ExportType exportType,
373 ::Core::Path const& exportFilePath,
374 ::std::function<void(::FileArchiver::Result&)> exportCallback
375 );
376
377 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result>
378 exportPack(::Core::Path const& path, ::Core::Path const& exportFilePath);
379
380 MCAPI void exportPack(
381 ::Core::Path const& path,
382 ::Core::Path const& exportFilePath,
383 ::std::function<void(::FileArchiver::Result&)> exportCallback
384 );
385
386 MCAPI ::FileArchiver::State getCurrentState();
387
388 MCAPI ::Bedrock::NotNullNonOwnerPtr<::FileArchiver::ProgressReporter> getProgressReporter();
389
390 MCAPI void setWorldConverter(::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter);
391 // NOLINTEND
392
393public:
394 // static variables
395 // NOLINTBEGIN
396 MCAPI static ::std::string const& EXTENSION_ADDON();
397
398 MCAPI static ::std::string const& EXTENSION_EDITOR_ADDON();
399
400 MCAPI static ::std::string const& EXTENSION_PROJECT();
401
402 MCAPI static ::std::string const& EXTENSION_RESOURCEPACK();
403
404 MCAPI static ::std::string const& EXTENSION_TEMPLATE();
405
406 MCAPI static ::std::string const& EXTENSION_VANILLA();
407
408 MCAPI static ::std::string const& IMPORT_LOCK_FILE();
409 // NOLINTEND
410
411public:
412 // constructor thunks
413 // NOLINTBEGIN
414 MCAPI void* $ctor(
415 ::Scheduler& scheduler,
416 ::ILevelListCache& levelListCache,
417 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
418 ::Bedrock::NotNullNonOwnerPtr<::IResourcePackRepository> const& resourcePackRepository,
419 bool isEditorModeEnabled,
420 ::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter,
421 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> keyProvider,
422 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
423 ::std::function<void(::std::string const&)> displayMessageFunction
424 );
425 // NOLINTEND
426
427public:
428 // destructor thunk
429 // NOLINTBEGIN
430 MCAPI void $dtor();
431 // NOLINTEND
432
433public:
434 // virtual function thunks
435 // NOLINTBEGIN
436 MCAPI ::std::shared_ptr<::FilePickerSettings>
437 $generateFilePickerSettings(::std::vector<::FileArchiver::ExportType> const& types, ::std::string const&) const;
438 // NOLINTEND
439
440public:
441 // vftables
442 // NOLINTBEGIN
443 MCNAPI static void** $vftable();
444 // NOLINTEND
445};
Definition EnableNonOwnerReferences.h:7
Definition Async.h:8
Definition BasicStackString.h:8
Definition PathBuffer.h:8
Definition Path.h:11
Definition ZipProgress.h:7
Definition FileArchiver.h:163
Definition FileArchiver.h:123
static MCAPI void ** $vftableForZipProgress()
static MCAPI void ** $vftableForEnableNonOwnerReferences()
Definition FileArchiver.h:33
static MCAPI void ** $vftable()
Definition FilePickerSettings.h:5
Definition IContentKeyProvider.h:13
Definition ILevelListCache.h:27
Definition IResourcePackRepository.h:34
Definition LevelData.h:49
Definition LevelDbEnv.h:8
Definition LevelStorage.h:25
Definition Level.h:247
Definition PackInstance.h:16
Definition Path.h:16
Definition Scheduler.h:13
Definition TaskGroup.h:53
Definition FileArchiver.h:113
Definition FileArchiver.h:231
Definition FileArchiver.h:89
Definition FileArchiver.h:206
Definition FileArchiver.h:66