Beispiel #1
0
u32 MetaFileSystem::OpenFile(std::string filename, FileAccess access)
{
	std::string of;
	IFileSystem *system;
	if (MapFilePath(filename, of, &system))
	{
		return system->OpenFile(of, access);
	}
	else
	{
		return 0;
	}
}
CString WindowManager::LoadJson(IFileSystem& fileSystem, const CString& cszRelativeFilename)
{
   std::shared_ptr<Stream::IStream> spStream =
      fileSystem.OpenFile(cszRelativeFilename, true);

   Stream::TextStreamFilter stream(*spStream,
      Stream::ITextStream::textEncodingAnsi,
      Stream::ITextStream::lineEndingNative);

   CString cszLine, cszText;
   while (!stream.AtEndOfStream())
   {
      stream.ReadLine(cszLine);
      cszText += cszLine;
      cszText += _T("\r\n");
   }

   return cszText;
}