SampleLayout::SampleLayout() : BaseLayout("SampleLayout.layout") { assignWidget(mpResourcesTree, "ResourcesTree"); mpResourcesTree->eventTreeNodePrepare += newDelegate(this, &SampleLayout::notifyTreeNodePrepare); MyGUI::TreeControl::Node* pRoot = mpResourcesTree->getRoot(); /*#ifdef MYGUI_OGRE_PLATFORM Ogre::ArchiveManager::ArchiveMapIterator ArchiveIterator = Ogre::ArchiveManager::getSingleton().getArchiveIterator(); while (ArchiveIterator.hasMoreElements()) { Ogre::Archive* pArchive = ArchiveIterator.getNext(); MyGUI::TreeControl::Node* pNode = new MyGUI::TreeControl::Node(pArchive->getName(), "Data"); pNode->setData(pArchive); pRoot->add(pNode); } #else*/ common::VectorFileInfo result; common::getSystemFileList(result, gMediaBase, L"*.*"); for (common::VectorFileInfo::iterator item = result.begin(); item != result.end(); ++item) { if ((*item).name == L".." || (*item).name == L".") continue; MyGUI::TreeControl::Node* pNode = new MyGUI::TreeControl::Node((*item).name, "Data"); pNode->setData(PairFileInfo(gMediaBase, *item)); pRoot->add(pNode); } //#endif }
void FilesView::scanFiles() { DiZipArchive* zip = DiK2Configs::RESOURCE_PACK; if (!zip) return; DiTimer timer; mResources = nullptr; zip->GenerateFileTree(mResources, "*.mdf"); MyGUI::TreeControl::Node* root = mResourcesTree->getRoot(); root->removeAll(); DiFileTree* nullfile = nullptr; root->setData(nullfile); for (auto i = mResources->children.begin(); i != mResources->children.end(); ++i) { DiFileTree* cur = i->second; MyGUI::TreeControl::Node* pNode = new MyGUI::TreeControl::Node(cur->fileName.c_str(), cur->folder ? "Folder" : "File"); pNode->setData(cur); if (!cur->folder) pNode->setPrepared(true); root->add(pNode); } double loadingTime = timer.GetElapse(); DI_LOG("Zip files scanning time: %f", loadingTime); }