blob: 0e55a86864cd5ed23615eda83219bdb69e28de54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// UserInputUtils.cpp
#include "StdAfx.h"
#include "Common/StdInStream.h"
#include "Common/StringConvert.h"
#include "UserInputUtils.h"
static const char kYes = 'Y';
static const char kNo = 'N';
static const char kYesAll = 'A';
static const char kNoAll = 'S';
static const char kAutoRenameAll = '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 all / (Q)uit? ";
// return true if pressed Quite;
NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
{
(*outStream) << kFirstQuestionMessage;
for (;;)
{
(*outStream) << kHelpQuestionMessage;
AString scannedString = g_StdIn.ScanStringUntilNewLine();
scannedString.Trim();
if (!scannedString.IsEmpty())
switch(
::MyCharUpper(
#ifdef UNDER_CE
(wchar_t)
#endif
scannedString[0]))
{
case kYes:
return NUserAnswerMode::kYes;
case kNo:
return NUserAnswerMode::kNo;
case kYesAll:
return NUserAnswerMode::kYesAll;
case kNoAll:
return NUserAnswerMode::kNoAll;
case kAutoRenameAll:
return NUserAnswerMode::kAutoRenameAll;
case kQuit:
return NUserAnswerMode::kQuit;
}
}
}
UString GetPassword(CStdOutStream *outStream)
{
(*outStream) << "\nEnter password:";
outStream->Flush();
return g_StdIn.ScanUStringUntilNewLine();
}
|