Пример #1
0
        /// <summary>
        /// Uses the Wordlist Index to create a scentence ow words provided by the wordlist of this objects language attribute
        /// </summary>
        /// <returns>A scentence of words</returns>
        private string GetMnemonicSentence()
        {
            //trap for words that were not in the word list when built. If custom words were used, we will not support the rebuild as we don't have the words
            if (_wordIndexList.Contains(-1))
            {
                throw new Exception("the wordlist index contains -1 which means words were used in the mnemonic sentence that cannot be found in the wordlist and the index to sentence feature cannot be used. Perhaps a different language wordlist is needed?");
            }

            string mSentence = cEmptyString;

            Wordlists.Wordlist wordlist = new Wordlists.English();

            for (int i = 0; i < _wordIndexList.Count; i++)
            {
                mSentence += wordlist.GetWordAtIndex(_wordIndexList[i]);
                if (i + 1 < _wordIndexList.Count)
                {
                    mSentence += " ";
                }
            }

            return(mSentence);
        }