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;
}
}
}