/// <summary> /// List extended information for a dictionary /// </summary> /// <param name="args"></param> /// <returns></returns> private static async Task ListDictionaryInfo(string[] args) { // for simplicity we just fect all dictionaries, and loop for the ones we need! wordbook.cjpg.app.client.Dictionaries dictionaries = await client.Dictionaries(); foreach (string dictId in args) { if (!IsDictionaryId(dictId)) { continue; } // get the matching dictionary wordbook.cjpg.app.client.Dictionary dict; dict = dictionaries.Items.Find(i => i.Id == dictId); if (dict != null) { // load info and print it! string info = await dict.Info(); string alphabet = await dict.Alphabet(); Console.WriteLine($"Id ......: {dict.Id}"); Console.WriteLine($"ShortName: {dict.ShortName}"); Console.WriteLine($"LongName : {dict.LongName}"); Console.WriteLine($"Alphabet : {alphabet}"); Console.WriteLine("============================\n"); Console.WriteLine(info); Console.WriteLine("============================\n"); } } }
/// <summary> /// List all available dictionaries /// </summary> private static async Task ListDictionaries() { wordbook.cjpg.app.client.Dictionaries dictionaries = await client.Dictionaries(); if (dictionaries.Items == null) { Console.WriteLine("Thats wired! we got an empty result!"); return; } foreach (wordbook.cjpg.app.client.Dictionary dict in dictionaries.Items) { Console.WriteLine($"Id ......: {dict.Id}"); Console.WriteLine($"ShortName: {dict.ShortName}"); Console.WriteLine($"LongName : {dict.LongName}"); Console.WriteLine("============================\n"); } }