using System;using System.Collections.Generic;
namespace 源代码修改
{
public enum Command
{
R,
W,
C,
H,
Q,
WrongCommand
}
static public class Menu
{
static private string introduce =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 请将本程序置于源代码根文件夹\n" +
"┃ 输入对应命令字符进行操作:\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoAboutcommand =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ R - 根据源代码生成待翻译文档\n" +
"┃ W - 根据已翻译文档修改源代码\n" +
"┃ C - 将源代码编码方式改为UTF-8\n" +
"┃ H - 查看帮助\n" +
"┃ Q - 退出程序\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string errorAboutCommand =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 无效的命令!\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoToPacify =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 处理中...\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoCommandRExcutedSuccessfully =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 成功:已在当前目录下生成ConstantString.txt!\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoCommandWExcutedSuccessfullyPartA =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 成功:已根据ConstantString.txt完成了对源代码的 " ;
static private string infoCommandWExcutedSuccessfullyPartB =
" 处修改\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoCommandCExcutedSuccessfullyPartA =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 成功:已将 " ;
static private string infoCommandCExcutedSuccessfullyPartB =
" 个源代码文件编码方式改为UTF-8\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoHasNotFoundDocument =
"┏┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┓\n" +
"┃ 失败:修改源代码失败!\n" +
"┃ 原因:未在本程序所在目录找到:ConstantString.txt\n" +
"┗┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┛";
static private string infoWrongFormat =
"┏┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┓\n" +
"┃ 失败:修改源代码失败!\n" +
"┃ 原因:ConstantString.txt格式错误!\n" +
"┗┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┛";
static private string infoFoundAnExistentDocument =
"┏┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┓\n" +
"┃ 失败:生成ConstantString.txt失败!\n" +
"┃ 原因:当前目录中已存在格式正确的ConstantString.txt!\n" +
"┗┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┛";
static private string infoExit =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 按任意键退出程序...\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static private string infoHelp =
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n" +
"┃ 请查看帮助文档help.txt\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
static public void ShowIntroduce()
{
Console.WriteLine(introduce);
}
static public void ShowCommand()
{
Console.WriteLine(infoAboutcommand);
}
static public void ShowErrorAboutCommand()
{
Console.WriteLine("\n" + errorAboutCommand);
}
static public void ShowPacify()
{
Console.WriteLine("\n" + infoToPacify);
}
static public void ShowCommandRExcutedSuccessfully()
{
Console.WriteLine(infoCommandRExcutedSuccessfully);
}
static public void ShowCommandWExcutedSuccessfully(int amountOfChanges)
{
Console.WriteLine(infoCommandWExcutedSuccessfullyPartA + amountOfChanges + infoCommandWExcutedSuccessfullyPartB);
}
static public void ShowCommandCExcutedSuccessfully(int amountOfConverted)
{
Console.WriteLine(infoCommandCExcutedSuccessfullyPartA + amountOfConverted + infoCommandCExcutedSuccessfullyPartB);
}
static public void ShowHasNotFoundDocument()
{
Console.WriteLine(infoHasNotFoundDocument);
Console.Write('\a');
}
static public void ShowErrorOnFormat()
{
Console.WriteLine(infoWrongFormat);
Console.Write('\a');
}
static public void ShowFoundAnExistentDocument()
{
Console.WriteLine(infoFoundAnExistentDocument);
Console.Write('\a');
}
static public void ShowExit()
{
Console.WriteLine(infoExit);
}
static public void WaitForExit()
{
Console.ReadKey();
}
static public void ShowHelp()
{
Console.WriteLine("\n" + infoHelp);
}
static public Command GetCommand()
{
char command = Console.ReadKey().KeyChar;
command = char.ToUpper(command);
if (command == char.Parse(Command.R.ToString()))
return Command.R;
else if (command == char.Parse(Command.W.ToString()))
return Command.W;
else if (command == char.Parse(Command.C.ToString()))
return Command.C;
else if (command == char.Parse(Command.H.ToString()))
return Command.H;
else if (command == char.Parse(Command.Q.ToString()))
return Command.Q;
else
return Command.WrongCommand;
}
}
}

被折叠的 条评论
为什么被折叠?



