Remove more hardcode string to En.rc

svn path=/trunk/; revision=14476
This commit is contained in:
Magnus Olsen 2005-04-03 13:40:15 +00:00
parent 7f6485630b
commit 2f4cc70e0f
5 changed files with 176 additions and 81 deletions

View file

@ -134,6 +134,23 @@ DATE [/T][date]\n\n \
Type DATE without parameters to display the current date setting and\n \
a prompt for a new one. Press ENTER to keep the same date."
STRING_DEL_HELP1, "Deletes one or more files.\n\n \
DEL [/%c /%c /%c /%c /%c /%c /%c] file ...\n \
DELETE [/%c /%c /%c /%c /%c /%c /%c] file ...\n \
ERASE [/%c /%c /%c /%c /%c /%c /%c] file ...\n\n \
file Specifies the file(s) to delete.\n\n \
/%c Nothing.\n \
/%c Prompt. Ask before deleting each file.\n \
/%c Total. Display total number of deleted files and freed disk space.\n \
/%c Quiet.\n \
/%c Wipe. Overwrite the file with random numbers before deleting it.\n \
/%c Yes. Kill even *.* without asking.\n \
/%c Zap. Delete hidden, read-only and system files).\n"
STRING_DEL_HELP3, " %lu file%s deleted\n"
STRING_DEL_HELP4, " %lu files deleted\n"
STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT"
STRING_MKDIR_HELP, "Creates a directory.\n\n \
@ -144,6 +161,9 @@ RMDIR [drive:]path\nRD [drive:]path"
STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?"
@ -152,6 +172,7 @@ STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
STRING_CHOICE_OPTION, "YN"
STRING_COPY_OPTION, "YNA"
STRING_DEL_OPTION, "AENPQSTWXYZ"
STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n"
@ -168,12 +189,24 @@ STRING_CMD_ERROR2, "Error creating temporary file for pipe data\n"
STRING_CMD_ERROR3, "Can't redirect to file %s\n"
STRING_CMD_ERROR4, "Running %s...\n"
STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
STRING_COLOR_ERROR1, "Same colors error! (Background and foreground can't be the same color)"
STRING_COLOR_ERROR2, "error in color specification"
STRING_COLOR_ERROR3, "Color %x\n"
STRING_COLOR_ERROR4, "same colors error!"
STRING_CONSOLE_ERROR, "Unknown error: %d\n"
STRING_COPY_ERROR1, "Error: Cannot open source - %s!\n"
STRING_COPY_ERROR2, "Error: Can't copy onto itself!\n"
STRING_COPY_ERROR3, "Error writing destination!\n"
STRING_COPY_ERROR4, "Error: Not implemented yet!\n"
STRING_DATE_ERROR, "Invalid date."
STRING_DEL_ERROR1, "Wildcards!\n\n"
STRING_DEL_ERROR2, "Full path: %s\n"
STRING_DEL_ERROR3, "File part: %s\n"
STRING_DEL_ERROR4, "Full filename: %s\n"
STRING_DEL_ERROR5, "The file %s will be deleted! "
STRING_DEL_ERROR6, "Are you sure (Y/N)?"
STRING_DEL_ERROR7, "Deleting: %s\n"
STRING_DEL_ERROR8, "No Wildcards!\n"
STRING_PARAM_ERROR, "Required parameter missing\n"

View file

@ -41,10 +41,12 @@ VOID SetScreenColor (WORD wColor, BOOL bFill)
DWORD dwWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
WCHAR szMsg[RC_STRING_MAX_SIZE];
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
ConErrPuts (_T("Same colors error! (Background and foreground can't be the same color)"));
LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPuts (_T((LPTSTR)szMsg));
}
else
{
@ -72,6 +74,8 @@ VOID SetScreenColor (WORD wColor, BOOL bFill)
*/
INT CommandColor (LPTSTR first, LPTSTR rest)
{
WCHAR szMsg[RC_STRING_MAX_SIZE];
if (_tcsncmp (rest, _T("/?"), 2) == 0)
{
ColorHelp ();
@ -88,15 +92,18 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
if (StringToColor (&wColor, &rest) == FALSE)
{
ConErrPuts(_T("error in color specification"));
LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPuts (_T((LPTSTR)szMsg));
return 1;
}
ConErrPrintf (_T("Color %x\n"), wColor);
LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), wColor);
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
ConErrPuts (_T("same colors error!"));
LoadString( GetModuleHandle(NULL), STRING_COLOR_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), wColor);
return 1;
}

View file

@ -303,7 +303,7 @@ Overwrite (LPTSTR fn)
TCHAR Options[3];
WCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR) Options,sizeof(lpOptions));
LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, (LPTSTR) Options,sizeof(Options)+sizeof(WCHAR));
lpOptions = _T(Options);
LoadString( GetModuleHandle(NULL), STRING_COPY_HELP1, (LPTSTR) szMsg,sizeof(szMsg));

View file

@ -35,6 +35,7 @@
*/
#include "precomp.h"
#include "resource.h"
#ifdef INCLUDE_CMD_DEL
@ -108,24 +109,25 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
HANDLE hFile;
WIN32_FIND_DATA f;
LPTSTR lpOptions;
TCHAR Options[11];
WCHAR szMsg[RC_STRING_MAX_SIZE];
LONG ch;
LoadString( GetModuleHandle(NULL), STRING_DEL_OPTION, (LPTSTR) Options,sizeof(Options)+sizeof(WCHAR));
lpOptions = _T(Options);
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Deletes one or more files.\n"
"\n"
"DEL [/N /P /T /Q /W /Y /Z] file ...\n"
"DELETE [/N /P /T /Q /W /Y /Z] file ...\n"
"ERASE [/N /P /T /Q /W /Y /Z] file ...\n"
"\n"
" file Specifies the file(s) to delete.\n"
"\n"
" /N Nothing.\n"
" /P Prompt. Ask before deleting each file.\n"
" /T Total. Display total number of deleted files and freed disk space.\n"
" /Q Quiet.\n"
" /W Wipe. Overwrite the file with random numbers before deleting it.\n"
" /Y Yes. Kill even *.* without asking.\n"
" /Z Zap. Delete hidden, read-only and system files).\n"));
LoadString( GetModuleHandle(NULL), STRING_DEL_HELP1, (LPTSTR) szMsg,sizeof(szMsg));
ConOutPrintf (_T((LPTSTR)szMsg),
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10],
lpOptions[2],Options[3],lpOptions[6],lpOptions[4],lpOptions[7],lpOptions[9],lpOptions[10]
);
return 0;
}
@ -140,37 +142,47 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
{
if (_tcslen (arg[i]) >= 2)
{
switch (_totupper (arg[i][1]))
ch = _totupper (arg[i][1]);
if (_totupper (lpOptions[2]) == ch)
{
case _T('N'):
dwFlags |= DEL_NOTHING;
break;
}
case _T('P'):
else if (_totupper (lpOptions[3]) == ch)
{
dwFlags |= DEL_PROMPT;
break;
}
case _T('Q'):
else if (_totupper (lpOptions[4]) == ch)
{
dwFlags |= DEL_QUIET;
break;
}
case _T('S'):
else if (_totupper (lpOptions[5]) == ch)
{
dwFlags |= DEL_SUBDIR;
break;
}
case _T('T'):
else if (_totupper (lpOptions[6]) == ch)
{
dwFlags |= DEL_TOTAL;
break;
}
case _T('W'):
else if (_totupper (lpOptions[7]) == ch)
{
dwFlags |= DEL_WIPE;
break;
case _T('Y'):
}
else if (_totupper (lpOptions[9]) == ch)
{
dwFlags |= DEL_YES;
break;
case _T('Z'):
}
else if (_totupper (lpOptions[10]) == ch)
{
dwFlags |= DEL_ZAP;
break;
}
}
@ -199,8 +211,10 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
{
if (!((dwFlags & DEL_YES) || (dwFlags & DEL_QUIET) || (dwFlags & DEL_PROMPT)))
{
res = FilePromptYN (_T("All files in the directory will be deleted!\n"
"Are you sure (Y/N)?"));
LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, (LPTSTR) szMsg,sizeof(szMsg));
res = FilePromptYN (_T( (LPTSTR) szMsg));
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
break;
@ -217,7 +231,8 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
{
/* wildcards in filespec */
#ifdef _DEBUG
ConErrPrintf (_T("Wildcards!\n\n"));
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR1, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg));
#endif
GetFullPathName (arg[i],
@ -226,8 +241,12 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
&pFilePart);
#ifdef _DEBUG
ConErrPrintf (_T("Full path: %s\n"), szFullPath);
ConErrPrintf (_T("File part: %s\n"), pFilePart);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR2, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), pFilePart);
#endif
hFile = FindFirstFile (szFullPath, &f);
@ -249,13 +268,18 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
_tcscpy (pFilePart, f.cFileName);
#ifdef _DEBUG
ConErrPrintf (_T("Full filename: %s\n"), szFullPath);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR4, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg));
#endif
/* ask for deleting */
if (dwFlags & DEL_PROMPT)
{
ConErrPrintf (_T("The file %s will be deleted! "), szFullPath);
res = FilePromptYN (_T("Are you sure (Y/N)?"));
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg));
res = FilePromptYN (_T((LPTSTR)szMsg));
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
{
@ -264,7 +288,10 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
}
if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
ConErrPrintf (_T("Deleting: %s\n"), szFullPath);
{
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
}
/* delete the file */
if (!(dwFlags & DEL_NOTHING))
@ -307,7 +334,8 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
{
/* no wildcards in filespec */
#ifdef _DEBUG
ConErrPrintf (_T("No Wildcards!\n"));
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR8, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg));
#endif
GetFullPathName (arg[i],
MAX_PATH,
@ -317,8 +345,11 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
/*ask for deleting */
if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) //Don't ask if the file doesn't exist, the following code will make the error-msg
{
ConErrPrintf (_T("The file %s will be deleted! "), szFullPath);
res = FilePromptYN (_T("Are you sure (Y/N)?"));
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR5, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR6, (LPTSTR) szMsg,sizeof(szMsg));
res = FilePromptYN (_T((LPTSTR)szMsg));
if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
{
@ -327,10 +358,14 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
}
#ifdef _DEBUG
ConErrPrintf (_T("Full path: %s\n"), szFullPath);
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR3, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
#endif
if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
ConOutPrintf (_T("Deleting %s\n"), szFullPath);
{
LoadString( GetModuleHandle(NULL), STRING_DEL_ERROR7, (LPTSTR) szMsg,sizeof(szMsg));
ConErrPrintf (_T((LPTSTR)szMsg), szFullPath);
}
if (!(dwFlags & DEL_NOTHING))
{
@ -380,12 +415,16 @@ INT CommandDelete (LPTSTR cmd, LPTSTR param)
if (!(dwFlags & DEL_QUIET))
{
if (dwFiles == 0)
ConOutPrintf (_T(" 0 files deleted\n"));
if (dwFiles < 2)
{
LoadString( GetModuleHandle(NULL), STRING_DEL_HELP3, (LPTSTR) szMsg,sizeof(szMsg));
}
else
ConOutPrintf (_T(" %lu file%s deleted\n"),
dwFiles,
(dwFiles == 1) ? _T("") : _T("s"));
{
LoadString( GetModuleHandle(NULL), STRING_DEL_HELP4, (LPTSTR) szMsg,sizeof(szMsg));
}
ConOutPrintf (_T((LPTSTR)szMsg), dwFiles);
}
return 0;

View file

@ -2,7 +2,7 @@
#define STRING_CHOICE_OPTION 200
#define STRING_COPY_OPTION 201
#define STRING_DEL_OPTION 202
#define STRING_ALIAS_ERROR 300
#define STRING_BATCH_ERROR 301
@ -18,13 +18,25 @@
#define STRING_CMD_ERROR3 311
#define STRING_CMD_ERROR4 312
#define STRING_CMD_ERROR5 313
#define STRING_CONSOLE_ERROR 314
#define STRING_COPY_ERROR1 315
#define STRING_COPY_ERROR2 316
#define STRING_COPY_ERROR3 317
#define STRING_COPY_ERROR4 318
#define STRING_DATE_ERROR 319
#define STRING_PARAM_ERROR 320
#define STRING_COLOR_ERROR1 314
#define STRING_COLOR_ERROR2 315
#define STRING_COLOR_ERROR3 316
#define STRING_COLOR_ERROR4 317
#define STRING_CONSOLE_ERROR 318
#define STRING_COPY_ERROR1 319
#define STRING_COPY_ERROR2 320
#define STRING_COPY_ERROR3 321
#define STRING_COPY_ERROR4 322
#define STRING_DATE_ERROR 323
#define STRING_DEL_ERROR1 324
#define STRING_DEL_ERROR2 325
#define STRING_DEL_ERROR3 326
#define STRING_DEL_ERROR4 327
#define STRING_DEL_ERROR5 328
#define STRING_DEL_ERROR6 329
#define STRING_DEL_ERROR7 330
#define STRING_DEL_ERROR8 331
#define STRING_PARAM_ERROR 332
#define STRING_ATTRIB_HELP 400
#define STRING_ALIAS_HELP 401
@ -49,10 +61,14 @@
#define STRING_DATE_HELP2 420
#define STRING_DATE_HELP3 421
#define STRING_DATE_HELP4 422
#define STRING_EXIT_HELP 423
#define STRING_MKDIR_HELP 424
#define STRING_RMDIR_HELP 425
#define STRING_REM_HELP 426
#define STRING_DEL_HELP1 423
#define STRING_DEL_HELP2 424
#define STRING_DEL_HELP3 425
#define STRING_DEL_HELP4 426
#define STRING_EXIT_HELP 427
#define STRING_MKDIR_HELP 428
#define STRING_RMDIR_HELP 429
#define STRING_REM_HELP 430