bool WriteTagAPE(FILE_INFO *pFileMP3) { CTag_Ape ape; if (ape.Load(GetFullPath(pFileMP3)) != ERROR_SUCCESS) { return false; } //ape.Release(); // トラック名 ape.SetComment(CTag_Ape::APE_TAG_FIELD_TITLE, GetTrackNameSI(pFileMP3)); // アーティスト名 ape.SetComment(CTag_Ape::APE_TAG_FIELD_ARTIST, GetArtistNameSI(pFileMP3)); // アルバム名 ape.SetComment(CTag_Ape::APE_TAG_FIELD_ALBUM, GetAlbumNameSI(pFileMP3)); // リリース年号 ape.SetComment(CTag_Ape::APE_TAG_FIELD_YEAR, GetYearSI(pFileMP3)); // コメント ape.SetComment(CTag_Ape::APE_TAG_FIELD_COMMENT, GetCommentSI(pFileMP3)); // トラック番号 ape.SetComment(CTag_Ape::APE_TAG_FIELD_TRACK, GetTrackNumberSI(pFileMP3)); // ジャンル番号 ape.SetComment(CTag_Ape::APE_TAG_FIELD_GENRE, GetGenreSI(pFileMP3)); // 作曲者 ape.SetComment("Composer", GetComposerSI(pFileMP3)); // パフォーマー ape.SetComment("Performer", GetOrigArtistSI(pFileMP3)); if (ape.Save(GetFullPath(pFileMP3)) != ERROR_SUCCESS) { return false; } return true; }
void TextResource::InitialLoad() { /** * Stuff to know about resource loading... * * Currently Sigil when opening an ePub creates Resource objects *prior* * to actually copying the resources from the zip into the Sigil folders. * So in 99% of cases the resource will not exist, so a call to InitialLoad() * from the constructor would fail (which it used to do). * * For some resource types there is a call made afterwards which will result * in the resource being loaded such as for HTML files, CSS, NCX and OPF * (see UniversalUpdates.cpp and code setting default text for new html pages etc). * * For other text resource types, they will only get loaded on demand, when * the tab is actually opened, TextTab.cpp will call this InitialLoad() function. * * If you were to write some code to iterate over resources that do not fall * into the special cases above, you *must* call InitialLoad() first to ensure * the data is loaded, or else it will be blank or have data depending on whether * it had been opened in a tab first. */ QWriteLocker locker(&GetLock()); Q_ASSERT(m_TextDocument); if (m_TextDocument->toPlainText().isEmpty() && QFile::exists(GetFullPath())) { SetText(Utility::ReadUnicodeTextFile(GetFullPath())); } }
/** * * Returns associated file icon. * * @param Nil * @return HICON - Returns file icon * @exception Nil * @see Nil * @since 1.0 */ HICON Process::ExtractAssociatedProcessIcon() { // If there is already an icon return that if( m_ahmProcessFileIcon.IsValid() ) { return m_ahmProcessFileIcon; } // Check path if( GetFullPath().IsEmpty() ) { return 0; } SHFILEINFO shFileInfo = { 0 }; // For retrieving icon VERIFY( SHGetFileInfo( GetFullPath(), FILE_ATTRIBUTE_NORMAL, &shFileInfo, sizeof( shFileInfo ), SHGFI_SMALLICON | SHGFI_ICON | SHGFI_USEFILEATTRIBUTES )); // Do we have an icon, then store this icon handle // for destruction later on if( shFileInfo.hIcon ) { m_ahmProcessFileIcon = shFileInfo.hIcon; } // Icon to return return m_ahmProcessFileIcon; }// End GetAssociatedProcessIcon
BOOL FileMisc::IsSameFile(const CString& sFilePath1, const CString& sFilePath2) { CString sFullPath1 = GetFullPath(sFilePath1); CString sFullPath2 = GetFullPath(sFilePath2); return (sFilePath1.CompareNoCase(sFullPath2) == 0); }
ae3d::FileSystem::FileContentsData ae3d::FileSystem::FileContents(const char* path) { ae3d::FileSystem::FileContentsData outData; outData.path = path == nullptr ? "" : std::string(GetFullPath(path)); for (const auto& pakFile : Global::pakFiles) { for (const auto& entry : pakFile.entries) { if (entry.path == std::string(path)) { outData.data = entry.contents; outData.isLoaded = true; return outData; } } } std::ifstream ifs(GetFullPath(path), std::ios::binary); outData.data.assign(std::istreambuf_iterator< char >(ifs), std::istreambuf_iterator< char >()); outData.isLoaded = ifs.is_open(); if (!outData.isLoaded) { System::Print( "FileSystem: Could not open %s.\n", path ); } return outData; }
~Log() { if (_messages.size() <= 1) { return; } // Build the file name for storing this game auto file = Helper::GetUserDataDir(); file.SetFullName(wxString::Format("%i.hsl", int(_messages[0].first / int(1e9)))); file.AppendDir("Logged"); auto filename = file.GetFullPath(); wxLogVerbose("saving %d messages to %s", _messages.size() - 1, filename); // Create the containing directory if needed if (!file.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) { wxLogError("error creating save directory: %s", filename); return; } // This should't happen, but check and log just in case if (file.Exists()) { wxLogWarning("overwriting existing game: %s", filename); } // Open the file wxFileOutputStream fout(file.GetFullPath()); if (!fout.Ok()) { wxLogError("error opening file: %s", filename); return; } // Zip the data while saving it to save some bandwidth later when the file is uploaded wxZlibOutputStream zout(fout, wxZ_BEST_COMPRESSION, wxZLIB_NO_HEADER); // Add header info // <nanotime> // 48 53 4C 48 09 00 00 00 // 09 XX XX XX XX XX XX XX XX auto version = Helper::GetHearthstoneVersion(); zout.Write(&_messages[0].first, 8) .Write("HSLH\t\0\0\0\t", 9) // HSLH 09000000 09 .Write(&version, 8); // Add the rest of the data auto size = 25; for (auto i = 1u; i < _messages.size(); i++) { auto time = _messages[i].first; auto msg = _messages[i].second; size += 8 + msg.size(); zout.Write(&time, 8).Write(msg.data(), msg.size()); } zout.Close(); wxLogVerbose("saved %d messages from %s (%d bytes, %lld compressed)", _messages.size() - 1, _name, size, fout.GetLength()); // Notify the app that it can upload the log file HearthLogApp::UploadLog(filename); }
bool C_file::RenameFile(const wchar *old_name, const wchar *new_name){ Cstr_w old_full, new_full; GetFullPath(old_name, old_full); GetFullPath(new_name, new_full); #ifndef _WIN32_WCE //don't allow renaming (move) accross drives (helps to catch bugs) if(ToLower(old_full[0])!=ToLower(new_full[0])) return false; #endif return win::MoveFile(old_full, new_full); }
void CFileAndFolder::OnOK() { UINT count = m_Tree.GetSelectedCount(); if (count) { HTREEITEM htree = m_Tree.GetFirstSelectedItem(); m_sSelections.AddTail(GetFullPath(htree)); while ((htree = m_Tree.GetNextSelectedItem(htree)) != NULL) { m_sSelections.AddTail(GetFullPath(htree)); } } CDialog::OnOK(); }
bool LoadAttributeFileWAV(FILE_INFO *pFileMP3) { CRiffSIF riff; wchar_t ext[_MAX_EXT]; _tsplitpath(GetFullPath(pFileMP3), NULL, NULL, NULL, ext); if(_strcmpi(ext, ".wav") == 0){ if(riff.Load(GetFullPath(pFileMP3),'W','A','V','E') != ERROR_SUCCESS){ return false; } } else if(_strcmpi(ext, ".avi") == 0){ if(riff.Load(GetFullPath(pFileMP3),'A','V','I',' ') != ERROR_SUCCESS){ return false; } //ISBJ songname SetTrackNameSI(pFileMP3, riff.GetField('I','S','B','J')); } else{ return false; } //INAM/ISBJ タイトル //ISBJ よりも INAM を優先 SetTrackNameSI(pFileMP3, riff.GetField('I','N','A','M')); if(wcslen(GetTrackNameSI(pFileMP3)) == 0){ SetTrackNameSI(pFileMP3, riff.GetField('I','S','B','J')); } //IART アーティスト名 SetArtistNameSI(pFileMP3, riff.GetField('I','A','R','T')); //IPRD アルバム名 SetAlbumNameSI(pFileMP3, riff.GetField('I','P','R','D')); //ICMT コメント SetCommentSI(pFileMP3, riff.GetField('I','C','M','T')); //ICRD 日付 SetYearSI(pFileMP3, riff.GetField('I','C','R','D')); //IGNR ジャンル SetGenreSI(pFileMP3, riff.GetField('I','G','N','R')); //ICOP 著作権 SetCopyrightSI(pFileMP3, riff.GetField('I','C','O','P')); //IENG エンジニア SetEngineerSI(pFileMP3, riff.GetField('I','E','N','G')); //ISRC ソース SetSourceSI(pFileMP3, riff.GetField('I','S','R','C')); //ISFT ソフトウェア SetSoftwareSI(pFileMP3, riff.GetField('I','S','F','T')); //ITRK トラック番号 SetTrackNumberSI(pFileMP3, riff.GetField('I','T','R','K')); extern bool GetValues_mp3infp(FILE_INFO *pFileMP3); GetValues_mp3infp(pFileMP3); return true; }
void CNFS2Prog::ProcedureRENAME(void) { char *path; char pathFrom[MAXPATHLEN], *pathTo; PrintLog("RENAME"); path = GetFullPath(); if (!CheckFile(path)) return; strcpy(pathFrom, path); pathTo = GetFullPath(); RenameFile(pathFrom, pathTo); m_pOutStream->Write(NFS_OK); }
void ADVANCED_CFG::loadFromConfigFile() { const auto k_advanced = getAdvancedCfgFilename(); if( !k_advanced.FileExists() ) { wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() ); return; } wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() ); wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() ); loadSettings( file_cfg ); }
//删除键 COMMAND_REG_DELKEY void CRegDlg::OnReglDelkey() { // TODO: Add your command handler code here REGMSG msg; int index=m_list.GetSelectionMark(); CString FullPath=GetFullPath(SelectNode); //得到全路径 char bToken=getFatherPath(FullPath); CString key=m_list.GetItemText(index,0); //得到键名 msg.size=FullPath.GetLength(); // 项名大小 msg.valsize=key.GetLength(); //键名大小 int datasize=sizeof(msg)+msg.size+msg.valsize+4; char *buf=new char[datasize]; ZeroMemory(buf,datasize); buf[0]=COMMAND_REG_DELKEY; //命令头 buf[1]=bToken; //主键 memcpy(buf+2,(void*)&msg,sizeof(msg)); //数据头 if(msg.size>0) //根键 就不用写项了 memcpy(buf+2+sizeof(msg),FullPath.GetBuffer(0),FullPath.GetLength()); //项值 memcpy(buf+2+sizeof(msg)+FullPath.GetLength(),key.GetBuffer(0),key.GetLength()); //键值 how=3; this->index=index; m_iocpServer->Send(m_pContext, (LPBYTE)(buf), datasize); delete[] buf; }
void HistoryDlg::OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); *pResult = 0; HistoryDisp *sHistoryDisp = getCurHistoryDisp(); if (sHistoryDisp == XPR_NULL) return; xpr_tchar_t sPath[XPR_MAX_PATH * 2] = {0}; HTREEITEM sTreeItem = mTreeCtrl.GetSelectedItem(); if (sTreeItem != XPR_NULL) { xpr_uint_t sIndex = getItemIndex(sTreeItem); if (FXFILE_STL_IS_INDEXABLE(sIndex, *sHistoryDisp->mHistoryDeque)) { HistoryDeque::const_reverse_iterator sReverseIterator = sHistoryDisp->mHistoryDeque->rbegin() + sIndex; if (sReverseIterator != sHistoryDisp->mHistoryDeque->rend()) { LPITEMIDLIST sFullPidl = *sReverseIterator; if (sFullPidl != XPR_NULL) { if (IsFileSystem(sFullPidl)) GetName(sFullPidl, SHGDN_FORPARSING, sPath); else GetFullPath(sFullPidl, sPath); } } } } SetDlgItemText(IDC_HISTORY_STATUS, sPath); }
void ProtocolHttp::EvalStatic(HttpRequest *httpRequest, HttpResponse *httpResponse) { //EventLog eventLog; char msg[8192]; try { char *str = httpRequest->GetUrl(); string s = GetFullPath(str); ifstream file(s); if (file) { sprintf(msg, "Static %s\n", s.c_str()); //eventLog.WriteEventLogEntry2(msg, EVENTLOG_ERROR_TYPE); httpResponse->SetStaticFileName(s); httpResponse->WriteStatic(s.c_str()); } else { sprintf(msg, "Static %s not found\n", s.c_str()); //eventLog.WriteEventLogEntry2(msg, EVENTLOG_ERROR_TYPE); } } catch (...) { printf("Exception in SocketCompletionPortServer::EvalStatic \n"); exit(0); } }
pascal OSErr AEOpenFiles(AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon) { AEDescList docList; AEKeyword keywd; DescType returnedType; Size actualSize; long itemsInList; FSSpec theSpec; CInfoPBRec pb; Str255 name; short i; if (AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList) != noErr) return; if (AECountItems (&docList, &itemsInList) != noErr) return; SetSelection (TEXTREC->teLength, TEXTREC->teLength); for (i = 1; i <= itemsInList; i++) { AEGetNthPtr (&docList, i, typeFSS, &keywd, &returnedType, (Ptr) &theSpec, sizeof(theSpec), &actualSize); GetFullPath(&theSpec, name); P2CStr(name); // was: pstrterm(name); if (xlload ((char *)name + 1, 1, 0) == 0) xlabort ("load error"); } macputs ("> "); PrepareForInput (); }
nfsstat3 CNFS3Prog::ProcedureLOOKUP(void) { char *path; nfs_fh3 object; post_op_attr obj_attributes; post_op_attr dir_attributes; nfsstat3 stat; PrintLog("LOOKUP"); std::string dirName; std::string fileName; ReadDirectory(dirName, fileName); path = GetFullPath(dirName, fileName); stat = CheckFile((char*)dirName.c_str(), path); if (stat == NFS3_OK) { GetFileHandle(path, &object); obj_attributes.attributes_follow = GetFileAttributesForNFS(path, &obj_attributes.attributes); } dir_attributes.attributes_follow = GetFileAttributesForNFS((char*)dirName.c_str(), &dir_attributes.attributes); Write(&stat); if (stat == NFS3_OK) { Write(&object); Write(&obj_attributes); } Write(&dir_attributes); return stat; }
void OvrApp::OneTimeInit( const char * launchIntent ) { // This is called by the VR thread, not the java UI thread. MaterialParms materialParms; materialParms.UseSrgbTextureFormats = false; const char * scenePath = "Oculus/tuscany.ovrscene"; String SceneFile; Array<String> SearchPaths; const OvrStoragePaths & paths = app->GetStoragePaths(); paths.PushBackSearchPathIfValid(EST_SECONDARY_EXTERNAL_STORAGE, EFT_ROOT, "RetailMedia/", SearchPaths); paths.PushBackSearchPathIfValid(EST_SECONDARY_EXTERNAL_STORAGE, EFT_ROOT, "", SearchPaths); paths.PushBackSearchPathIfValid(EST_PRIMARY_EXTERNAL_STORAGE, EFT_ROOT, "RetailMedia/", SearchPaths); paths.PushBackSearchPathIfValid(EST_PRIMARY_EXTERNAL_STORAGE, EFT_ROOT, "", SearchPaths); if ( GetFullPath( SearchPaths, scenePath, SceneFile ) ) { Scene.LoadWorldModel( SceneFile , materialParms ); } else { LOG( "OvrApp::OneTimeInit SearchPaths failed to find %s", scenePath ); } }
void GSceneSelector::CreatePlayingData() { gstring fullPath; GetWriteablePath( USER_HAVEDATA_FILENAME, fullPath ); if( GnFileUtil::ExitsFile( fullPath.c_str() ) == false ) { GnVerify( GnFileUtil::FileCopy( GetFullPath( USER_HAVEDATA_FILENAME ), fullPath.c_str() ) ); mPlayOpening = true; } GPlayingDataManager* playingDataManager = GPlayingDataManager::GetSingleton(); playingDataManager->LoadData(); guint32 curCount = playingDataManager->GetPlayingDataCount(); GPlayingData* data = NULL; if( curCount == 0 ) { data = playingDataManager->CreatePlayingData(); playingDataManager->AddPlayingData( data ); playingDataManager->SaveData(); } else data = playingDataManager->GetPlayingData( 0 ); playingDataManager->SetPlayingPlayerData( 0 ); }
QString NCXResource::GetRelativePathToRoot() const { QFileInfo info(GetFullPath()); QDir parent_dir = info.dir(); QString parent_name = parent_dir.dirName(); return parent_name + "/" + Filename(); }
void SetCookieUsage(const EA::WebKit::CookieInfo& cookieInfo) { if (!cookieInfo.mCookieFilePath || !cookieInfo.mCookieFilePath[0] ) { EAW_ASSERT_MSG(false,"Cookies persistence disabled. Invalid cookie file path."); return; } const char8_t* pCookieFilePath = cookieInfo.mCookieFilePath; EA::IO::Path::PathString8 fullPath; if(pCookieFilePath) { fullPath.assign(GetFullPath(pCookieFilePath, true)); if(!fullPath.empty()) { pCookieFilePath = fullPath.c_str(); } } WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance(); EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager(); CookieManagerParameters params(pCookieFilePath, cookieInfo.mMaxIndividualCookieSize, cookieInfo.mDiskCookieStorageSize, cookieInfo.mMaxCookieCount); pCM->SetParametersAndInitialize(params); }
bool SetDiskCacheUsage(const EA::WebKit::DiskCacheInfo& diskCacheInfo) { if (!diskCacheInfo.mDiskCacheDirectory || !diskCacheInfo.mDiskCacheDirectory[0] ) { EAW_ASSERT_MSG(false,"Disk cache disabled. Invalid disk cache directory."); return false; } const char8_t* pDiskCacheDir = diskCacheInfo.mDiskCacheDirectory; EA::IO::Path::PathString8 fullPath = GetFullPath(pDiskCacheDir, true); if(!fullPath.empty()) { pDiskCacheDir = fullPath.c_str(); } if(!EA::WebKit::GetFileSystem()->MakeDirectory(pDiskCacheDir)) { EAW_ASSERT_FORMATTED(false , "Could not create directory for %s disk cache directory path \n",pDiskCacheDir); return false; } //11/17/2011 - Bug fix otherwise diskcache does not work with relative path for cache directory. EA::WebKit::DiskCacheInfo diskCacheInfoNew = diskCacheInfo; diskCacheInfoNew.mDiskCacheDirectory = pDiskCacheDir; return WebCore::ResourceHandleManager::sharedInstance()->SetDiskCacheParams(diskCacheInfoNew); }
NTSTATUS RtlCliSetCurrentDirectory(PCHAR Directory) { WCHAR buf[MAX_PATH]; UNICODE_STRING us; if (NULL == Directory) { return STATUS_UNSUCCESSFUL; } // Full path contains at least two symbols, the second is ':' if (strnlen(Directory, MAX_PATH) >= 2 && Directory[1] == ':') { RtlCreateUnicodeStringFromAsciiz(&us, Directory); RtlSetCurrentDirectory_U(&us); RtlFreeUnicodeString(&us); return STATUS_SUCCESS; } GetFullPath(Directory, buf, TRUE); RtlInitUnicodeString(&us, buf); RtlSetCurrentDirectory_U(&us); RtlFreeUnicodeString(&us); return STATUS_SUCCESS; }
void OvrApp::OneTimeInit( const char * fromPackage, const char * launchIntentJSON, const char * launchIntentURI ) { // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150607 // called by_ LOG("enter OvrApp::OneTimeInit"); // This is called by the VR thread, not the java UI thread. MaterialParms materialParms; materialParms.UseSrgbTextureFormats = false; const char * scenePath = "Oculus/tuscany.ovrscene"; String SceneFile; Array<String> SearchPaths; const OvrStoragePaths & paths = app->GetStoragePaths(); paths.PushBackSearchPathIfValid(EST_SECONDARY_EXTERNAL_STORAGE, EFT_ROOT, "RetailMedia/", SearchPaths); paths.PushBackSearchPathIfValid(EST_SECONDARY_EXTERNAL_STORAGE, EFT_ROOT, "", SearchPaths); paths.PushBackSearchPathIfValid(EST_PRIMARY_EXTERNAL_STORAGE, EFT_ROOT, "RetailMedia/", SearchPaths); paths.PushBackSearchPathIfValid(EST_PRIMARY_EXTERNAL_STORAGE, EFT_ROOT, "", SearchPaths); if ( GetFullPath( SearchPaths, scenePath, SceneFile ) ) { LOG("invoke Scene.LoadWorldModel"); Scene.LoadWorldModel( SceneFile , materialParms ); } else { LOG( "OvrApp::OneTimeInit SearchPaths failed to find %s", scenePath ); } }
nfsstat3 CNFS3Prog::ProcedureRMDIR(void) { char *path; wcc_data dir_wcc; nfsstat3 stat; PrintLog("RMDIR"); std::string dirName; std::string fileName; ReadDirectory(dirName, fileName); path = GetFullPath(dirName, fileName); stat = CheckFile((char*)dirName.c_str(), path); dir_wcc.before.attributes_follow = GetFileAttributesForNFS((char*)dirName.c_str(), &dir_wcc.before.attributes); if (stat == NFS3_OK) { if (!RemoveFolder(path)) { stat = NFS3ERR_IO; } } dir_wcc.after.attributes_follow = GetFileAttributesForNFS((char*)dirName.c_str(), &dir_wcc.after.attributes); Write(&stat); Write(&dir_wcc); return stat; }
void CDirectoryTreeCtrl::OnTvnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult) { CWaitCursor curWait; SetRedraw(FALSE); LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); HTREEITEM hItem = pNMTreeView->itemNew.hItem; // remove all subitems HTREEITEM hRemove = GetChildItem(hItem); while(hRemove) { DeleteItem(hRemove); hRemove = GetChildItem(hItem); } // get the directory CString strDir = GetFullPath(hItem); // fetch all subdirectories and add them to the node AddSubdirectories(hItem, strDir); SetRedraw(TRUE); Invalidate(); *pResult = 0; }
void CFilePatchesDlg::OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); *pResult = 0; if ((pNMLV->iItem < 0) || (pNMLV->iItem >= m_arFileStates.GetCount())) return; if (m_pCallBack==NULL) return; if (m_arFileStates.GetAt(pNMLV->iItem) == FPDLG_FILESTATE_ERROR) { MessageBox(m_pPatch->GetPatchRejects(pNMLV->iItem), NULL, MB_ICONERROR); return; } if (m_sPath.IsEmpty()) { m_pCallBack->DiffFiles(GetFullPath(pNMLV->iItem), _T(""), _T(""), _T("")); m_ShownIndex = pNMLV->iItem; m_cFileList.Invalidate(); } else { if (m_arFileStates.GetAt(pNMLV->iItem)!=FPDLG_FILESTATE_PATCHED) { m_pCallBack->PatchFile(m_pPatch->GetStrippedPath(pNMLV->iItem), m_pPatch->GetContentMods(pNMLV->iItem), m_pPatch->GetPropMods(pNMLV->iItem), _T("")); m_ShownIndex = pNMLV->iItem; m_cFileList.Invalidate(); } } }
std::wstring GetFilenamesFromCommandLine() { std::wstring result = L"[]"; if (AppGetCommandLine()->HasArguments()) { bool firstEntry = true; std::vector<CefString> args; AppGetCommandLine()->GetArguments(args); std::vector<CefString>::iterator iterator; result = L"["; for (iterator = args.begin(); iterator != args.end(); iterator++) { std::wstring argument = (*iterator).ToWString(); if (IsFilename(argument)) { std::wstring fullPath; // We check if this is a valid file path. If not just ignore this parameter. if( !GetFullPath(argument, fullPath) ) continue; if (!firstEntry) { result += L","; } firstEntry = false; result += L"\"" + fullPath + L"\""; } } result += L"]"; } return result; }
void CFilePatchesDlg::PatchAll() { if (m_pCallBack) { CSysProgressDlg progDlg; progDlg.SetTitle(IDR_MAINFRAME); progDlg.SetShowProgressBar(true); progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_ALL))); progDlg.ShowModeless(m_hWnd); for (int i=0; i<m_arFileStates.GetCount() && !progDlg.HasUserCancelled(); i++) { if (m_arFileStates.GetAt(i) == FPDLG_FILESTATE_ERROR) MessageBox(m_pPatch->GetPatchRejects(i), NULL, MB_ICONERROR); else if (m_arFileStates.GetAt(i) != FPDLG_FILESTATE_PATCHED) { progDlg.SetLine(2, GetFullPath(i), true); m_pCallBack->PatchFile(m_pPatch->GetStrippedPath(i), m_pPatch->GetContentMods(i), m_pPatch->GetPropMods(i), _T(""), TRUE); m_ShownIndex = i; m_cFileList.Invalidate(); } progDlg.SetProgress64(i, m_arFileStates.GetCount()); } progDlg.Stop(); } }
bool SearchPaths::GetFullPath( char const * relativePath, String & outPath ) const { char largePath[1024]; bool result = GetFullPath( relativePath, largePath, sizeof( largePath ) ); outPath = largePath; return result; }
void CFilePatchesDlg::PatchSelected() { if (m_pCallBack) { CSysProgressDlg progDlg; progDlg.SetTitle(IDR_MAINFRAME); progDlg.SetShowProgressBar(true); progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_PATCH_SELECTED))); progDlg.ShowModeless(m_hWnd); // The list cannot be sorted by user, so the order of the // items in the list is identical to the order in the array // m_arFileStates. int selCount = m_cFileList.GetSelectedCount(); int count = 1; POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); int index; while (((index = m_cFileList.GetNextSelectedItem(pos)) >= 0) && (!progDlg.HasUserCancelled())) { if (m_arFileStates.GetAt(index) == FPDLG_FILESTATE_ERROR) MessageBox(m_pPatch->GetPatchRejects(index), NULL, MB_ICONERROR); else if (m_arFileStates.GetAt(index) != FPDLG_FILESTATE_PATCHED) { progDlg.SetLine(2, GetFullPath(index), true); m_pCallBack->PatchFile(m_pPatch->GetStrippedPath(index), m_pPatch->GetContentMods(index), m_pPatch->GetPropMods(index), _T(""), TRUE); m_ShownIndex = index; m_cFileList.Invalidate(); } progDlg.SetProgress64(count++, selCount); } progDlg.Stop(); } }