static void Main(string[] args) { //没有命令无法执行 if (args == null || args.Length == 0) { Console.WriteLine("No commond !"); return; } //args = new string[] { "-x", "-c", "-l" }; //获取指令蕴含信息 CommondInfo info = CommondReader.GetInfo(args); //错误处理 if (info.isError) { ErrorHanding(info.errorType); return; } //生成计数器 WordCounter counter = new WordCounter(); counter.AddFunction(info.funcs); string data; //获取信息 if (!FileDataReader.GetDataByPath(info.filePath, out data)) { Console.WriteLine("Open file failed !"); return; } //设置信息并进行计数 counter.SetString(data); //输出 Console.WriteLine(counter.GetAllLogs()); //Console.ReadKey(); }