源代码修改-Menu

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



                
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值