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函数里面就应该很简单......
本文介绍了一个名为Vtt2Srt的转换工具的实现细节,该工具用于将VTT文件转换为SRT文件。文章展示了如何通过命令行方式运行此工具,并详细解释了程序的Main函数及异常处理部分。
7221

被折叠的 条评论
为什么被折叠?



