/// <summary> /// 获取全部分类 /// </summary> /// <param name="args"></param> /// <returns></returns> static async Task Main(string[] args) { try { GlobalSettings.LoadAll(); LiveCategoryDataInfo info = await LiveApi.GetLiveCategoryInfo(); if (info != null && info.Code == 0) { Console.WriteLine("-------------------------"); Console.WriteLine(" ID 名称 "); foreach (var bigCate in info.Data) { Console.WriteLine("-------------------------"); Console.WriteLine(bigCate.Name); Console.WriteLine("-------------------------"); foreach (var item in bigCate.List) { Console.WriteLine(String.Format("{0,-6} | {1,-20} ", item.id, item.name)); } } if (args != null && args.Length > 1) { string path = null; for (int i = 0; i < args.Length; i++) { if (args[i].ToLower() == "-md" && i < args.Length - 1) { path = args[i + 1]; (bool, string)result = OutputToMarkdownFile(info.Data, path); if (result.Item1) { Console.WriteLine("\n写入到文件成功。"); } else { Console.WriteLine($"\n写入到文件失败。{result.Item2}"); } } } } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Environment.Exit(0); } else { Console.ReadKey(false); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// 获取全部分类 /// </summary> /// <param name="args"></param> /// <returns></returns> static async Task Main(string[] args) { try { GlobalSettings.LoadAll(); LiveCategoryDataInfo info = await LiveApi.GetLiveCategoryInfo(); if (info != null && info.Code == 0) { Console.WriteLine("-------------------------"); Console.WriteLine(" ID 名称 "); foreach (var bigCate in info.Data) { Console.WriteLine("-------------------------"); Console.WriteLine(bigCate.Name); Console.WriteLine("-------------------------"); foreach (var item in bigCate.List) { Console.WriteLine(String.Format("{0,-6} | {1,-20} ", item.id, item.name)); } } //生成GITHUB中表格 //foreach (var bigCate in info.Data) //{ // foreach (var item in bigCate.List) // { // Console.WriteLine($" | {item.id} | {item.name} | {item.parent_name} | "); // } //} if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Environment.Exit(0); } else { Console.ReadKey(false); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }