Vtt2Srt工具最终会有一个console和WPF主程序,所以共用的部分会放到一个单独的程序集里面。
以下是Console程序的最顶端
using System; using Autofac; using Vtt2Srt.Core; namespace Vtt2Srt.Console { class Program { static void Main(string[] args) { try { if (args.Length < 1) throw new Exception("The program should be running with 1 argument at least."); var processor = BuilderVtt2SrtProcessor(); processor.Process(args[0]); System.Console.WriteLine("The conversion has been done.\nPlease find srt file at the same directory where vtt file is."); } catch (Exception exception) { System.Console.WriteLine(exception.Message + "\n\n" + exception.StackTrace); } } private static VttToSrtProcessor BuilderVtt2SrtProcessor() { var bootstrapper = new Bootstrapper(); var container = bootstrapper.Bootstrap(); return container.Resolve<VttToSrtProcessor>(); } } }一般来说,Main函数里面就应该很简单......