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