| 346 | } |
| 347 | |
| 348 | tSharedBuffer cResourceMan::FileRead(const std::string& pFile) { |
| 349 | std::ifstream* fileStream; |
| 350 | auto fileBuffer = std::make_shared<std::vector<uint8_t>>(); |
| 351 | |
| 352 | // Attempt to open the file |
| 353 | fileStream = new std::ifstream(pFile.c_str(), std::ios::binary); |
| 354 | if (fileStream->is_open() != false) { |
| 355 | |
| 356 | // Get file size |
| 357 | fileStream->seekg(0, std::ios::end); |
| 358 | fileBuffer->resize(static_cast<const unsigned int>(fileStream->tellg())); |
| 359 | fileStream->seekg(std::ios::beg); |
| 360 | |
| 361 | // Allocate buffer, and read the file into it |
| 362 | fileStream->read((char*)fileBuffer->data(), fileBuffer->size()); |
| 363 | if (!(*fileStream)) |
| 364 | fileBuffer->clear(); |
| 365 | } |
| 366 | |
| 367 | // Close the stream |
| 368 | fileStream->close(); |
| 369 | delete fileStream; |
| 370 | |
| 371 | // All done ;) |
| 372 | return fileBuffer; |
| 373 | } |
| 374 | |
| 375 | std::string cResourceMan::GetCampaignData(const std::string& pName) { |
| 376 | for (auto& Campaign : mCampaigns) { |
no test coverage detected