示例#1
0
文件: WordList.cs 项目: zutobg/Meadow
        /// <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);
        }
示例#2
0
文件: WordList.cs 项目: zutobg/Meadow
 /// <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();
 }