Ejemplo n.º 1
0
 private static void List(List <string> args)
 {
     if (args.Count == 0)
     {
         if (currentBook == null)
         {
             Books.List();
         }
         else
         {
             Phrases.List();
         }
     }
     else if (args[0] == "books")
     {
         if (args.Count == 1)
         {
             Books.List();
         }
         else
         {
             Console.WriteLine(strings.Get("WrongArgCount"));
         }
     }
     else if (args[0] == "phrases")
     {
         if (args.Count == 3)
         {
             if (args[1] == "in")
             {
                 VersionedDictionary oldBook = currentBook; //TO-DO: 此处实现别扭,应改
                 if (books.TryGetValue(args[2], out currentBook))
                 {
                     Phrases.List();
                 }
                 else
                 {
                     Console.WriteLine(strings.Get("BookNotFound"));
                 }
                 currentBook = oldBook;
             }
             else
             {
                 Console.WriteLine(strings.Get("WrongSyntax"));
             }
         }
         else if (args.Count == 1)
         {
             Phrases.List();
         }
         else
         {
             Console.WriteLine(strings.Get("WrongSyntax"));
         }
     }
     else
     {
         Console.WriteLine(strings.Get("WrongSyntax"));
     }
 }