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> generateFilePickerSettings(
289 ::std::vector<::FileArchiver::ExportType> const& types,
290 ::std::string const& worldId
291 ) const;
292 // NOLINTEND
293
294public:
295 // member functions
296 // NOLINTBEGIN
297 MCAPI FileArchiver(
298 ::Scheduler& scheduler,
299 ::ILevelListCache& levelListCache,
300 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
301 ::Bedrock::NotNullNonOwnerPtr<::IResourcePackRepository> const& resourcePackRepository,
302 bool isEditorModeEnabled,
303 ::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter,
304 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> keyProvider,
305 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
306 ::std::function<void(::std::string const&)> displayMessageFunction
307 );
308
309 MCAPI void _clearArchiverState();
310
311 MCAPI void
312 _copyPackToTemp(::PackInstance const& packInstance, ::Core::Path const& tempPath, ::FileArchiver::Result& result);
313
314 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> _enqueueExportWorldTasks(
315 ::Core::Path const& outputFilePath,
316 ::std::string const& worldId,
317 bool isBundle,
318 ::FileArchiver::ExportType exportType,
319 ::FileArchiver::ShowToast showToast,
321 ::std::function<void(::FileArchiver::Result&)> cleanupTask,
322 ::std::function<void(::LevelData&)> convertPreExportCallback,
323 ::std::vector<::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>>
324 pathCallbacks
325 );
326
327 MCAPI void _exportLevelFiles(
328 ::Core::Path const& outputFilePath,
329 bool isBundle,
330 ::std::shared_ptr<::FileArchiver::ExportData> exportData
331 );
332
333 MCAPI void _printLevelResultMessage(::FileArchiver::Result const& result);
334
335 MCAPI void _printLevelStartMessage();
336
337 MCAPI void _printMessage(::std::string const& message);
338
339 MCAPI ::FileArchiverOutcome
340 _processWorldForTemplate(::std::shared_ptr<::FileArchiver::ExportData> const& exportData);
341
342 MCAPI void _revertPremiumUpgradePacks(::Core::Path const& filePath);
343
344 MCAPI ::FileArchiver::Result _tryBeginExportLevel(
345 ::std::string const& levelId,
346 ::Core::Path const& exportFilePath,
347 ::FileArchiver::ShowToast showToast
348 );
349
350 MCAPI bool _validatePremiumUpgradePacks(::Core::Path const& filePath);
351
352 MCAPI ::std::string copyLevel(::std::string const& worldId);
353
354 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> exportCurrentEditorLevel(
355 ::Level* level,
356 ::Core::Path const& exportFilePath,
357 ::std::function<void(::LevelData&)> preExportConvertedCallback,
358 ::std::vector<::std::function<void(::Core::PathBuffer<::Core::BasicStackString<char, 1024>> const&)>>
359 pathCallbacks,
360 ::FileArchiver::ExportType exportType,
361 ::FileArchiver::ShowToast toast
362 );
363
364 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result> exportCurrentLevel(
365 ::Level* level,
366 bool isBundle,
367 ::FileArchiver::ExportType exportType,
368 ::Core::Path const& exportFilePath
369 );
370
371 MCAPI void exportCurrentLevel(
372 ::Level* level,
373 bool isBundle,
374 ::FileArchiver::ExportType exportType,
375 ::Core::Path const& exportFilePath,
376 ::std::function<void(::FileArchiver::Result&)> exportCallback
377 );
378
379 MCAPI ::Bedrock::Threading::Async<::FileArchiver::Result>
380 exportPack(::Core::Path const& path, ::Core::Path const& exportFilePath);
381
382 MCAPI void exportPack(
383 ::Core::Path const& path,
384 ::Core::Path const& exportFilePath,
385 ::std::function<void(::FileArchiver::Result&)> exportCallback
386 );
387
388 MCAPI ::FileArchiver::State getCurrentState();
389
390 MCAPI ::Bedrock::NotNullNonOwnerPtr<::FileArchiver::ProgressReporter> getProgressReporter();
391
392 MCAPI void setWorldConverter(::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter);
393 // NOLINTEND
394
395public:
396 // static variables
397 // NOLINTBEGIN
398 MCAPI static ::std::string const& EXTENSION_ADDON();
399
400 MCAPI static ::std::string const& EXTENSION_EDITOR_ADDON();
401
402 MCAPI static ::std::string const& EXTENSION_PROJECT();
403
404 MCAPI static ::std::string const& EXTENSION_RESOURCEPACK();
405
406 MCAPI static ::std::string const& EXTENSION_TEMPLATE();
407
408 MCAPI static ::std::string const& EXTENSION_VANILLA();
409
410 MCAPI static ::std::string const& IMPORT_LOCK_FILE();
411 // NOLINTEND
412
413public:
414 // constructor thunks
415 // NOLINTBEGIN
416 MCAPI void* $ctor(
417 ::Scheduler& scheduler,
418 ::ILevelListCache& levelListCache,
419 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
420 ::Bedrock::NotNullNonOwnerPtr<::IResourcePackRepository> const& resourcePackRepository,
421 bool isEditorModeEnabled,
422 ::std::unique_ptr<::FileArchiver::IWorldConverter> worldConverter,
423 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> keyProvider,
424 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
425 ::std::function<void(::std::string const&)> displayMessageFunction
426 );
427 // NOLINTEND
428
429public:
430 // destructor thunk
431 // NOLINTBEGIN
432 MCAPI void $dtor();
433 // NOLINTEND
434
435public:
436 // virtual function thunks
437 // NOLINTBEGIN
438 MCAPI ::std::shared_ptr<::FilePickerSettings> $generateFilePickerSettings(
439 ::std::vector<::FileArchiver::ExportType> const& types,
440 ::std::string const& worldId
441 ) const;
442 // NOLINTEND
443
444public:
445 // vftables
446 // NOLINTBEGIN
447 MCNAPI static void** $vftable();
448 // NOLINTEND
449};
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:243
Definition PackInstance.h:16
Definition Path.h:16
Definition Scheduler.h:13
Definition TaskGroup.h:48
Definition FileArchiver.h:113
Definition FileArchiver.h:231
Definition FileArchiver.h:89
Definition FileArchiver.h:206
Definition FileArchiver.h:66