static void Main(string[] args) { Parser.Default.ParseArguments <Options>(args).WithParsed(o => { CharTable charTable = new CharTable(o.ChartablePath); Narc font = new Narc(o.FontPath); FontTable fontTable_0 = new FontTable(font.Files[0]); Generation.Gen gen = fontTable_0.Gen; switch (gen) { case Generation.Gen.Gen4: font.Files[0] = fontTable_0.Save(charTable); font.Files[1] = new FontTable(font.Files[1]).Save(charTable); font.Files[2] = new FontTable(font.Files[2]).Save(charTable, StyleType.TOP_LEFT); if (font.Files.Count == 10) // HGSS { font.Files[4] = new FontTable(font.Files[4]).Save(charTable, StyleType.ROUND); } break; case Generation.Gen.Gen5: font.Files[0] = fontTable_0.Save(charTable, StyleType.BOTTOM_RIGHT_5); font.Files[1] = new FontTable(font.Files[1]).Save(charTable, StyleType.BOTTOM_RIGHT_5, FontType.PIXEL_9); font.Files[2] = new FontTable(font.Files[2]).Save(charTable, StyleType.ROUND, FontType.PIXEL_9); break; default: return; } font.Save(o.OutputPath); }); }
static void Main(string[] args) { Parser.Default.ParseArguments <Options>(args).WithParsed(o => { CharTable charTable = new CharTable(o.ChartablePath); Narc msg = new Narc(o.MessagePath); Text text; switch (msg.Files.Count) { case 610: // DP case 709: // Pt case 814: // HGSS text = new Text_4(msg, charTable); break; case 273: case 472: text = new Text_5(msg, charTable); break; default: throw new FormatException(); } if (o.ExtractPath != null) { text.Extract(o.ExtractPath); } if (o.ImportPath != null && o.OutputPath != null) { text.Import(o.ImportPath); text.Save(ref msg, charTable); msg.Save(o.OutputPath); } if (charTable.NoCode.Count > 0) { Console.WriteLine("以下字符未在码表中:" + string.Join("", charTable.NoCode)); } if (charTable.NoChar.Count > 0) { Console.WriteLine("以下编码未在码表中:" + string.Join(", ", charTable.NoChar)); } }); }