/// <summary> /// Determines the index of the given word in the current word list. /// </summary> /// <param name="word">The word to get the index of in the current word list.</param> /// <returns>Returns the index of the provided word in the current word list. Returns a negative integer if the word could not be found.</returns> public int GetWordIndex(string word) { // Normalize the word string normalizedWord = MnemonicPhrase.NormalizeString(word); // Determine the word index. int wordIndex = Array.FindIndex(Words, w => string.Equals(w, word, StringComparison.OrdinalIgnoreCase)); // Return the word index return(wordIndex); }
/// <summary> /// Initializes a word list to represent the given language, with the given words. /// </summary> /// <param name="language">The language which this word list will represent.</param> /// <param name="words">The words which constitute the word list to initialize.</param> private WordList(WordListLanguage language, string[] words) : this(language) { // Set our words (normalized). Words = words.Select(s => MnemonicPhrase.NormalizeString(s)).ToArray(); }