static void Main(string[] args) { var options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { return; } string srcDir = Utils.AbstractPath(options.InputDirectory); string dstDir = Utils.AbstractPath(options.OutputDirectory); if (!Directory.Exists(srcDir)) { Console.WriteLine("目录{0}不存在!", srcDir); return; } try { List <TableFile> list = new List <TableFile>(); var files = Utils.GetAllFiles(srcDir, "*.xls"); foreach (var file in files) { TableFile excel = TableFile.Create(file.FullName); if (excel == null) { break; } string dstFile = Path.Combine(dstDir, Path.GetFileNameWithoutExtension(file.Name)) + ".txt"; bool ok = excel.SaveToTSV(dstFile); if (!ok) { break; } Console.WriteLine("输出文件:{0}", dstFile); list.Add(excel); } if (!string.IsNullOrEmpty(options.SharpOutputDirectory)) { if (options.IsAnnotation) { Generator.Configuration.USE_ANNOTATION = true; } string sharpDir = Utils.AbstractPath(options.SharpOutputDirectory); new Generator(list.ToArray()).DoGenerateAll(sharpDir); Console.WriteLine("\n输出CSharp文件到目录 :{0} ", sharpDir); } } catch (Exception e) { Console.WriteLine(e.Message); } }