Example #1
0
        public static void Words(string[] args)
        {
            if (args.Length > 1)
            {
                if (File.Exists($"{WordList.LocalApplicationDirectory}{args[1]}.dat"))
                {
                    WordList loadedList = WordList.LoadList(args[1]);

                    if (loadedList.Count() != 0)
                    {
                        foreach (string language in loadedList.Languages)
                        {
                            Console.Write($"{language.ToUpper(),-15}");
                        }

                        int languageIndex = 0;

                        if (args.Length == 3)
                        {
                            for (int index = 0; index < loadedList.Languages.Length; index++)
                            {
                                if (loadedList.Languages[index] == args[2])
                                {
                                    languageIndex = index;
                                    break;
                                }
                            }
                        }

                        loadedList.List(languageIndex, translations =>
                        {
                            for (int i = 0; i < translations.Length; i++)
                            {
                                if (i % loadedList.Languages.Length == 0)
                                {
                                    Console.WriteLine();
                                }

                                Console.Write($"{translations[i],-15}");
                            }
                        });
                    }
                    else
                    {
                        Console.WriteLine("List doesn't contain any words.");
                    }
                }
                else
                {
                    Console.WriteLine("Could not find list.");
                }
            }
            else
            {
                Console.WriteLine("Please provide list name.");
            }
        }
Example #2
0
        public static void Count(string[] args)
        {
            if (args.Length > 1)
            {
                if (File.Exists($"{WordList.LocalApplicationDirectory}{args[1]}.dat"))
                {
                    WordList loadedList = WordList.LoadList(args[1]);

                    Console.WriteLine($"There are {loadedList.Count()} words in {args[1]}.");
                }
                else
                {
                    Console.WriteLine("Could not find list.");
                }
            }
            else
            {
                Console.WriteLine("Enter a list name.");
            }
        }
        public static int Count(string args)
        {
            WordList loadedList = WordList.LoadList(args);

            return(loadedList.Count());
        }