示例#1
0
        public static void Add(string name, string[] translations)
        {
            WordList loadedList = WordList.LoadList(name);

            loadedList.Add(translations);

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

                    string[] wordInput = new string[loadedList.Languages.Length];

                    do
                    {
                        if (!wordInput.Contains(null))
                        {
                            loadedList.Add(wordInput);

                            loadedList.Save();
                        }

                        Console.WriteLine("Enter translations for the new word:");

                        for (int i = 0; i < wordInput.Length; i++)
                        {
                            Console.Write($"Enter {loadedList.Languages[i]} translation: ");
                            wordInput[i] = Console.ReadLine();

                            if (wordInput[i] == "")
                            {
                                break;
                            }
                        }
                    } while (!wordInput.Contains(""));

                    loadedList.Save();
                }
                else
                {
                    Console.WriteLine("Could not find list.");
                }
            }
            else
            {
                Console.WriteLine("No list name was entered.");
            }
        }