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