源代码修改-Program

本文介绍了一个自动化流程,用于源代码修改、翻译文档生成及格式验证,包括生成翻译文档、根据已翻译文档修改源代码、转换编码格式、显示帮助信息和退出程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 源代码修改
{
    class Program
    {
        static void Main(string[] args)
        {
            Menu.ShowIntroduce();
            Command command ;
            while (true)
            {
                Menu.ShowCommand();
                command = Menu.GetCommand();
                if (command == Command.R)
                {
                    Menu.ShowPacify();
                    //  执行生成翻译文档逻辑
                    ReadDocument readDocument = new ReadDocument();
                    //  判断是否已存在翻译文档
                    if (!readDocument.HasFoundDocument)
                    {
                        //  创建一个翻译文档
                        readDocument.CreateANewDocument();
                    }
                    //  判断是否已有已存在格式正确的翻译文档
                    if (readDocument.DocumentFormatIsOK)
                    {
                        readDocument.OverReading();
                        Menu.ShowFoundAnExistentDocument();
                        Menu.ShowExit();
                        Menu.WaitForExit();
                        return;
                    }
                    readDocument.OverReading();
                    WriteDocument writeDocument = new WriteDocument();
                    ReadSourceFile readSourceFile = new ReadSourceFile(writeDocument);
                    TravelAllFiles trevel = new TravelAllFiles();
                    trevel.Go(readSourceFile);
                    writeDocument.OverWritting();
                    Menu.ShowCommandRExcutedSuccessfully();
                    Menu.ShowExit();
                    Menu.WaitForExit();
                    return;
                }
                else if (command == Command.W)
                {
                    Menu.ShowPacify();
                    //  执行根据已翻译文档修改源代码逻辑
                    ReadDocument readDocument = new ReadDocument();
                    if (!readDocument.HasFoundDocument)
                    {
                        Menu.ShowHasNotFoundDocument();
                        Menu.ShowExit();
                        Menu.WaitForExit();
                        return;
                    }
                    if (!readDocument.DocumentFormatIsOK)
                    {
                        readDocument.OverReading();
                        Menu.ShowErrorOnFormat();
                        Menu.ShowExit();
                        Menu.WaitForExit();
                        return;
                    }
                    WriteSourceFile writeSourceFile = new WriteSourceFile(readDocument);
                    TravelAllFiles travel = new TravelAllFiles();
                    travel.Go(writeSourceFile);
                    Menu.ShowCommandWExcutedSuccessfully(writeSourceFile.AmountOfChanges);
                    Menu.ShowExit();
                    Menu.WaitForExit();
                    return;
                }
                else if (command == Command.C)
                {
                    Menu.ShowPacify();
                    ConvertEncodingToUTF8 convert = new ConvertEncodingToUTF8() ;
                    TravelAllFiles travel = new TravelAllFiles();
                    travel.Go(convert);
                    Menu.ShowCommandCExcutedSuccessfully(convert.AmountOfHasConverted);
                    Menu.ShowExit();
                    Menu.WaitForExit();
                    return;
                }
                else if (command == Command.H)
                {
                    Menu.ShowHelp();
                }
                else if (command == Command.Q)
                    return;
                else
                    Menu.ShowErrorAboutCommand();
            }
        }
    }
}




                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值