private static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("沒有可執行的參數!"); Console.ReadLine(); Environment.Exit(-1); return; } args.ToList().ForEach(d => { string fileName = Path.GetFullPath(ConfigurationManager.AppSettings.Get(d)); using (SpireXls xls = new SpireXls()) { xls.Load(fileName); AttendanceManagement att = new AttendanceManagement(xls); switch (d) { // 應用題 case "MathWordProblems": att.SetMathWordProblemsJson("MathWordProblemsLibrary"); break; // 填空題 case "GapFillingProblems": att.SetGapFillingProblemsJson("GapFillingProblemsLibrary"); break; case "TopicManagement": att.SetTopicManagementJson("TopicManagement"); break; } } Console.WriteLine("JSON文件已經作成,請及時更新。"); }); Console.Write("準備移動文件..."); Console.ReadLine(); // 是否執行COPY處理 if (Convert.ToBoolean(ConfigurationManager.AppSettings.Get("IsCopy"))) { RunCopyBat(); Console.Write("文件移動完畢..."); Console.ReadLine(); } Environment.Exit(0); }
/// <summary> /// 構造函數 /// </summary> /// <param name="xls">SHEET對象</param> public AttendanceManagement(SpireXls xls) { Xls = xls; }