~SwitchParser() { ReleaseVectors(); };
void TRAPENTRY TrapFini( void ) /*****************************/ { // Restore old interrupt/exception handlers ReleaseVectors(); }
// pszFull comes from registry's [HKCR\Directory\shell\...\command] // Example: // "C:\Tools\ConEmu.exe" -inside -LoadCfgFile "C:\Tools\ConEmu.xml" -FontDir C:\Tools\ConEmu // -lngfile C:\Tools\ConEmu\ConEmu.l10n -lng ru -dir "%1" -run {cmd} -cur_console:n // Strip switches which match current instance startup arguments // No sense to show them (e.g. "-lng ru") in the Integration dialog page void StripDupSwitches(LPCWSTR pszFull) { bCmdList = false; szCmd = L""; szDirSync = L""; szConfig = L""; ReleaseVectors(); CEStr szArg, szNext; LPCWSTR psz; Switch* ps = NULL; // First, parse our extra args (passed to current ConEmu.exe) ParseStdSwitches(); // Now parse new switches (command from registry or from field on Integration page) // Drop `-dir "..."` (especially from registry) always! psz = pszFull; while (0 == NextArg(&psz, szArg)) { if (!szArg.IsPossibleSwitch()) continue; if (szArg.OneOfSwitches(L"-inside", L"-here")) { // Nop } else if (szArg.IsSwitch(L"-inside:")) // Both "-inside:" and "-inside=" notations are supported { szDirSync.Set(szArg.Mid(8)); // may be empty! } else if (szArg.IsSwitch(L"-config")) { if (0 != NextArg(&psz, szArg)) break; szConfig.Set(szArg); } else if (szArg.IsSwitch(L"-dir")) { if (0 != NextArg(&psz, szArg)) break; _ASSERTE(lstrcmpi(szArg, L"%1")==0); } else if (szArg.OneOfSwitches(L"-Single", L"-NoSingle", L"-ReUse")) { ps = new Switch(szArg.Detach(), NULL); ourSwitches.push_back(ps); } else if (szArg.OneOfSwitches(L"-run", L"-cmd", L"-runlist", L"-cmdlist")) { // FIN! LAST SWITCH! szCmd.Set(psz); bCmdList = szArg.OneOfSwitches(L"-runlist",L"-cmdlist"); break; } else if (NULL != (ps = GetNextSwitch(psz, szArg))) { if (IsIgnored(ps, GetSkipSwitches()) || IsIgnored(ps, stdSwitches)) { SafeDelete(ps); } else { ourSwitches.push_back(ps); } } } };