Ejemplo n.º 1
0
	ContentHandle* ContentManager::ReadFile(std::wstring fileName)
	{
		auto p = MakePath(fileName);
		ContentHandle* ch = nullptr;
		if (m_dictHandles.TryGet(p, &ch))
		{
			if (ch && !ch->IsClosed())
				return ch;
		}
		else if (m_dictHandles.TryGet(fileName, &ch))
		{
			if (ch && !ch->IsClosed())
				return ch;
		}
		if (PathExists(p))
		{
			ch = new ContentHandle(p);
			if (ch->GetStream()->operator!())
				ch = nullptr;
			if (ch)
				RegisterHandle(p, ch);
		}
		else {
			Formats::SMC::smcs_info inf;
			if (m_pSystem->GetEntry(fileName, &inf))
			{
				ch = new ContentHandle(inf);
				if (ch)
					RegisterHandle(fileName, ch);
			}
		}
		return ch;
	}