bool Groups::is_group(std::string m_name) { if (GetNameIndex(m_name) >= 0) { return true; } return false; }
std::string Groups::group_get_parent(std::string m_name) { int GroupIndex = GetNameIndex(m_name); if (GroupIndex >= 0) { return g[GroupIndex]->get_inheritedgroup(); } return "NULL"; }
bool Groups::group_add_commands(std::string m_name, std::string m_commands) { int GroupIndex = GetNameIndex(m_name); if (GroupIndex >= 0) { //g[GroupIndex]->add_commands(m_commands); return true; } return false; }
bool Groups::group_init(std::string m_id, std::string m_name, std::string m_admin, std::string m_canmodifyworld, std::string m_defaultgroup, std::string m_ignorerestrictions) { int GroupIndex = GetNameIndex(m_name); if (GroupIndex >= 0) { g[GroupIndex]->init(m_id, m_name, m_admin, m_canmodifyworld, m_defaultgroup, m_ignorerestrictions); return true; } return false; }
bool Groups::group_add_parent(std::string m_name, std::string m_parent) { int GroupIndex = GetNameIndex(m_name); if (GroupIndex >= 0) { g[GroupIndex]->add_inherit_group(m_parent); cout << "group: " << m_name << " has parent: " << m_parent << endl; return true; } return false; }
bool Groups::DelGroup(std::string m_name) { boost::mutex::scoped_lock lock(Group_mutex); int i = GetNameIndex(m_name); if (i >= 0) { name.erase(name.begin()+i); g[i]->~Group(); g.erase(g.begin()+i); return true; } return false; }
bool Groups::AddGroup(std::string m_name) { boost::mutex::scoped_lock lock(Group_mutex); int i = GetNameIndex(m_name); if (i == -1) { name.push_back (m_name); Group *tmpgroup = new Group(); g.push_back (tmpgroup); return true; } return false; }
std::vector< std::string > Groups::group_get_childs(std::string m_name) { std::vector< std::string > childs; int GroupIndex = GetNameIndex(m_name); if (GroupIndex >= 0) { for (unsigned int group_it = 0; group_it < g.size(); group_it++) { if (boost::iequals(g[group_it]->get_inheritedgroup(),m_name)) { childs.push_back(g[group_it]->get_name()); cout << "group: " << m_name << " has child: " << g[group_it]->get_name() << endl; } } } if (childs.size() > 0) { return childs; } return NULLvector; }
BOOL CKatakoi::MountIar(CArcFile* pclArc) { if (pclArc->GetArcExten() != _T(".iar")) return FALSE; if (memcmp(pclArc->GetHed(), "iar ", 4) != 0) return FALSE; // Version check DWORD dwVersion = *(LPDWORD)&pclArc->GetHed()[4]; DWORD dwFileEntrySize = 0; if (dwVersion == 2) { dwFileEntrySize = 4; } else if (dwVersion == 3) { dwFileEntrySize = 8; } else { return FALSE; } pclArc->SeekHed(0x1C); // Get number of files DWORD dwFiles; pclArc->Read(&dwFiles, 4); // Get index size DWORD dwIndexSize = dwFiles * dwFileEntrySize; // Get index YCMemory<BYTE> clmbtIndex(dwIndexSize); pclArc->Read(&clmbtIndex[0], dwIndexSize); // Get index filename YCMemory<BYTE> clmbtSec; DWORD dwNameIndex; BOOL bSec = GetNameIndex(pclArc, clmbtSec, dwNameIndex); // File information retrieval TCHAR szFileName[_MAX_FNAME]; TCHAR szWork[_MAX_FNAME]; if (!bSec) { // Failed to get the filename index lstrcpy(szWork, pclArc->GetArcName()); PathRemoveExtension(szWork); } for (DWORD i = 0; i < dwFiles; i++) { if (!bSec) { // Create a sequential filename _stprintf(szFileName, _T("%s_%06u"), szWork, i); } else { // Get the name of the file from the filename index lstrcpy(szFileName, (LPCTSTR)&clmbtSec[dwNameIndex]); dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // Filename dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // File type dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // Archive type dwNameIndex += 4 + *(LPDWORD)&clmbtSec[dwNameIndex]; // Archive name length + Archive name + File number } SFileInfo stfiWork; stfiWork.name = szFileName; stfiWork.start = *(LPDWORD)&clmbtIndex[i * dwFileEntrySize]; stfiWork.end = ((i + 1) < dwFiles) ? *(LPDWORD)&clmbtIndex[(i+1) * dwFileEntrySize] : pclArc->GetArcSize(); stfiWork.sizeCmp = stfiWork.end - stfiWork.start; stfiWork.sizeOrg = stfiWork.sizeCmp; pclArc->AddFileInfo(stfiWork); } return TRUE; }
BOOL CKatakoi::MountWar(CArcFile* pclArc) { if (pclArc->GetArcExten() != _T(".war")) return FALSE; if (memcmp(pclArc->GetHed(), "war ", 4) != 0) return FALSE; // Version check DWORD dwVersion = *(LPDWORD)&pclArc->GetHed()[4]; DWORD dwFileEntrySize = 0; if (dwVersion == 8) { dwFileEntrySize = 24; } else { return FALSE; } pclArc->SeekHed(0x08); // Get the number of files DWORD dwFiles; pclArc->Read(&dwFiles, 4); // Get index size DWORD dwIndexSize = dwFiles * dwFileEntrySize; // Get index YCMemory<BYTE> clmbtIndex(dwIndexSize); pclArc->SeekCur(0x04); pclArc->Read(&clmbtIndex[0], dwIndexSize); // Get the filename index YCMemory<BYTE> clmbtSec; DWORD dwNameIndex; BOOL bSec = GetNameIndex(pclArc, clmbtSec, dwNameIndex); // Set index for each archive filename to see if it is correct(Used in delta synthesis/decoding) pclArc->SetFlag(bSec); // Getting file info TCHAR szFileName[_MAX_FNAME]; TCHAR szWork[_MAX_FNAME]; if (!bSec) { // Failed to get the filename index lstrcpy(szWork, pclArc->GetArcName()); PathRemoveExtension(szWork); } for (DWORD i = 0; i < dwFiles; i++) { if (!bSec) { // Create a sequential filename _stprintf(szFileName, _T("%s_%06u"), szWork, i); } else { // Get filename from the filename index lstrcpy(szFileName, (LPCTSTR)&clmbtSec[dwNameIndex]); dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // File name dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // File type dwNameIndex += strlen((char*)&clmbtSec[dwNameIndex]) + 1; // Archive type dwNameIndex += 4 + *(LPDWORD)&clmbtSec[dwNameIndex]; // Archive name length + Archive name + File number } SFileInfo stfiWork; stfiWork.name = szFileName; stfiWork.start = *(LPDWORD)&clmbtIndex[i * dwFileEntrySize]; stfiWork.sizeCmp = *(LPDWORD)&clmbtIndex[i * dwFileEntrySize + 4]; stfiWork.sizeOrg = stfiWork.sizeCmp; stfiWork.end = stfiWork.start + stfiWork.sizeCmp; pclArc->AddFileInfo(stfiWork); } return TRUE; }