MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / GetStream

Method GetStream

src/openrct2/object/Object.cpp:361–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359 }
360
361 std::unique_ptr<IStream> ObjectAsset::GetStream() const
362 {
363 try
364 {
365 if (_zipPath.empty())
366 {
367 return std::make_unique<FileStream>(_path, FileMode::open);
368 }
369
370 auto zipArchive = Zip::TryOpen(_zipPath, ZipAccess::read);
371 if (zipArchive != nullptr)
372 {
373 auto stream = zipArchive->GetFileStream(_path);
374 if (stream != nullptr)
375 {
376 return std::make_unique<ZipStreamWrapper>(std::move(zipArchive), std::move(stream));
377 }
378 }
379 }
380 catch (...)
381 {
382 }
383 return {};
384 }
385
386 const std::string& ObjectAsset::GetZipPath() const
387 {

Callers 8

StopRecordingMethod · 0.80
CheatsSerialiseFunction · 0.80
CloneFunction · 0.80
PacketClass · 0.80
LoadMethod · 0.80
LoadFromMethod · 0.80
LoadSampleMethod · 0.80

Calls 3

TryOpenFunction · 0.50
emptyMethod · 0.45
GetFileStreamMethod · 0.45

Tested by

no test coverage detected