本文整理汇总了C++中NppParameters::safeWow64EnableWow64FsRedirection方法的典型用法代码示例。如果您正苦于以下问题:C++ NppParameters::safeWow64EnableWow64FsRedirection方法的具体用法?C++ NppParameters::safeWow64EnableWow64FsRedirection怎么用?C++ NppParameters::safeWow64EnableWow64FsRedirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NppParameters
的用法示例。
在下文中一共展示了NppParameters::safeWow64EnableWow64FsRedirection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSession
// return true if all the session files are loaded
// return false if one or more sessions files fail to load (and session is modify to remove invalid files)
bool Notepad_plus::loadSession(Session & session)
{
NppParameters *pNppParam = NppParameters::getInstance();
bool allSessionFilesLoaded = true;
BufferID lastOpened = BUFFER_INVALID;
size_t i = 0;
showView(MAIN_VIEW);
switchEditViewTo(MAIN_VIEW); //open files in main
for ( ; i < session.nbMainFiles() ; )
{
const TCHAR *pFn = session._mainViewFiles[i]._fileName.c_str();
if (NotepadFile(pFn, -1).isFileSession())
{
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
bool isWow64Off = false;
if (!PathFileExists(pFn))
{
pNppParam->safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
if (PathFileExists(pFn))
{
lastOpened = doOpen(pFn, false, session._mainViewFiles[i]._encoding);
}
else
{
lastOpened = BUFFER_INVALID;
}
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false;
}
if (lastOpened != BUFFER_INVALID)
{
showView(MAIN_VIEW);
const TCHAR *pLn = session._mainViewFiles[i]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TEXT;
if (id != 0 && id != IDM_LANG_USER)
typeToSet = menuID2LangType(id);
if (typeToSet == L_EXTERNAL )
typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
Buffer * buf = MainFileManager->getBufferByID(lastOpened);
buf->setPosition(session._mainViewFiles[i], &_mainEditView);
buf->setLangType(typeToSet, pLn);
if (session._mainViewFiles[i]._encoding != -1)
buf->setEncoding(session._mainViewFiles[i]._encoding);
//Force in the document so we can add the markers
//Dont use default methods because of performance
Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER);
_mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++)
{
_mainEditView.execute(SCI_MARKERADD, session._mainViewFiles[i].marks[j], MARK_BOOKMARK);
}
_mainEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
i++;
}
else
{
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
allSessionFilesLoaded = false;
}
}
size_t k = 0;
showView(SUB_VIEW);
switchEditViewTo(SUB_VIEW); //open files in sub
for ( ; k < session.nbSubFiles() ; )
{
const TCHAR *pFn = session._subViewFiles[k]._fileName.c_str();
if (NotepadFile(pFn, -1).isFileSession()) {
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
session._subViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
bool isWow64Off = false;
if (!PathFileExists(pFn))
{
pNppParam->safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
if (PathFileExists(pFn))
{
lastOpened = doOpen(pFn, false, session._subViewFiles[k]._encoding);
//check if already open in main. If so, clone
if (_mainDocTab.getIndexByBuffer(lastOpened) != -1) {
loadBufferIntoView(lastOpened, SUB_VIEW);
//.........这里部分代码省略.........
示例2: checkFileState
bool Buffer::checkFileState() //eturns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise
{
if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment
return false;
struct _stat buf;
bool isWow64Off = false;
NppParameters *pNppParam = NppParameters::getInstance();
if (!PathFileExists(_fullPathName.c_str()))
{
pNppParam->safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
bool isOK = false;
if (_currentStatus != DOC_DELETED && !PathFileExists(_fullPathName.c_str())) //document has been deleted
{
_currentStatus = DOC_DELETED;
_isFileReadOnly = false;
_isDirty = true; //dirty sicne no match with filesystem
_timeStamp = 0;
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
isOK = true;
}
else if (_currentStatus == DOC_DELETED && PathFileExists(_fullPathName.c_str()))
{ //document has returned from its grave
if (!generic_stat(_fullPathName.c_str(), &buf))
{
_isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
_currentStatus = DOC_MODIFIED;
_timeStamp = buf.st_mtime;
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
isOK = true;
}
}
else if (!generic_stat(_fullPathName.c_str(), &buf))
{
int mask = 0; //status always 'changes', even if from modified to modified
bool isFileReadOnly = (bool)(!(buf.st_mode & _S_IWRITE));
if (isFileReadOnly != _isFileReadOnly)
{
_isFileReadOnly = isFileReadOnly;
mask |= BufferChangeReadonly;
}
if (_timeStamp != buf.st_mtime)
{
_timeStamp = buf.st_mtime;
mask |= BufferChangeTimestamp;
_currentStatus = DOC_MODIFIED;
mask |= BufferChangeStatus; //status always 'changes', even if from modified to modified
}
if (mask != 0)
{
doNotify(mask);
isOK = true;
}
isOK = false;
}
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
//isWow64Off = false;
}
return isOK;
}
示例3: doClose
void Notepad_plus::doClose(BufferID id, int whichOne) {
Buffer * buf = MainFileManager->getBufferByID(id);
// Notify plugins that current file is about to be closed
SCNotification scnN;
scnN.nmhdr.code = NPPN_FILEBEFORECLOSE;
scnN.nmhdr.hwndFrom = getMainWindowHandle();
scnN.nmhdr.idFrom = (uptr_t)id;
_pluginsManager.notify(&scnN);
//add to recent files if its an existing file
if (!buf->isUntitled())
{
// if the file doesn't exist, it could be redirected
// So we turn Wow64 off
bool isWow64Off = false;
NppParameters *pNppParam = NppParameters::getInstance();
const TCHAR *fn = buf->getFullPathName();
if (!PathFileExists(fn))
{
pNppParam->safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
if (PathFileExists(buf->getFullPathName()))
_lastRecentFileList.add(buf->getFullPathName());
// We enable Wow64 system, if it was disabled
if (isWow64Off)
{
pNppParam->safeWow64EnableWow64FsRedirection(TRUE);
isWow64Off = false;
}
}
int nrDocs = whichOne==MAIN_VIEW?(_mainDocTab.nbItem()):(_subDocTab.nbItem());
//Do all the works
bool isBufRemoved = removeBufferFromView(id, whichOne);
int hiddenBufferID = -1;
if (nrDocs == 1 && canHideView(whichOne))
{ //close the view if both visible
hideView(whichOne);
// if the current activated buffer is in this view,
// then get buffer ID to remove the entry from File Switcher Pannel
hiddenBufferID = ::SendMessage(getMainWindowHandle(), NPPM_GETBUFFERIDFROMPOS, 0, whichOne);
}
// Notify plugins that current file is closed
if (isBufRemoved)
{
scnN.nmhdr.code = NPPN_FILECLOSED;
_pluginsManager.notify(&scnN);
// The document could be clonned.
// if the same buffer ID is not found then remove the entry from File Switcher Pannel
if (_pFileSwitcherPanel)
{
//int posInfo = ::SendMessage(getMainWindowHandle(), NPPM_GETPOSFROMBUFFERID, (WPARAM)id ,0);
_pFileSwitcherPanel->closeItem((int)id, whichOne);
if (hiddenBufferID != -1)
_pFileSwitcherPanel->closeItem((int)hiddenBufferID, whichOne);
}
}
return;
}