eec05089cf
Mirror the 26.01-bundle approach for 26.00:
- versions/26.00-bundle/CPP/7zip/Bundles/Nsis7z/: project-owned NSIS plugin
wrapper sources (api.h, nsis7z.cpp, pluginapi.*, resource.*, StdAfx*,
Nsis7z.sln, Nsis7z.vcxproj, Nsis7z.vcxproj.filters, Nsis7z_vs2026.vcxproj).
- versions/26.00-bundle/CPP/7zip/UI/NSIS/: NSIS UI sources (Main.cpp,
ExtractCallbackConsole.*, NSISBreak.*, UserInputUtils2.*, StdAfx.h).
- versions/26.00-bundle/CPP/7zip/LzmaDec_gcc.mak: forwarding stub so that
the CWD-relative `include ../../LzmaDec_gcc.mak` in Arc_gcc.mak resolves
correctly when make runs from the Nsis7z bundle dir.
- versions/26.00-bundle/{C,Asm} and CPP sub-trees: symlinks into versions/26.00/
so the vendor headers and sources are visible without modifying the submodule.
- tools/linux/setup_26_00_bundle_symlinks.py: idempotent script to recreate
all symlinks after a fresh clone + submodule initialisation.
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
// UserInputUtils.cpp
|
|
|
|
#include "StdAfx.h"
|
|
|
|
#include "Common/StdInStream.h"
|
|
#include "Common/StringConvert.h"
|
|
|
|
#include "UserInputUtils2.h"
|
|
|
|
static const char kYes = 'Y';
|
|
static const char kNo = 'N';
|
|
static const char kYesAll = 'A';
|
|
static const char kNoAll = 'S';
|
|
static const char kAutoRename = 'U';
|
|
static const char kQuit = 'Q';
|
|
|
|
static const char *kFirstQuestionMessage = "?\n";
|
|
static const char *kHelpQuestionMessage =
|
|
"(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename / (Q)uit? ";
|
|
|
|
// return true if pressed Quite;
|
|
// in: anAll
|
|
// out: anAll, anYes;
|
|
|
|
NUserAnswerMode::EEnum ScanUserYesNoAllQuit2(CStdOutStream *outStream)
|
|
{
|
|
(*outStream) << kFirstQuestionMessage;
|
|
for(;;)
|
|
{
|
|
(*outStream) << kHelpQuestionMessage;
|
|
AString scannedString;
|
|
g_StdIn.ScanAStringUntilNewLine(scannedString);
|
|
scannedString.Trim();
|
|
if(!scannedString.IsEmpty())
|
|
switch(::MyCharUpper(scannedString[0]))
|
|
{
|
|
case kYes:
|
|
return NUserAnswerMode::kYes;
|
|
case kNo:
|
|
return NUserAnswerMode::kNo;
|
|
case kYesAll:
|
|
return NUserAnswerMode::kYesAll;
|
|
case kNoAll:
|
|
return NUserAnswerMode::kNoAll;
|
|
case kAutoRename:
|
|
return NUserAnswerMode::kAutoRename;
|
|
case kQuit:
|
|
return NUserAnswerMode::kQuit;
|
|
}
|
|
}
|
|
}
|
|
|
|
UString GetPassword(CStdOutStream *outStream)
|
|
{
|
|
(*outStream) << "\nEnter password:";
|
|
outStream->Flush();
|
|
AString oemPassword;
|
|
g_StdIn.ScanAStringUntilNewLine(oemPassword);
|
|
return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
|
|
}
|