Пример #1
0
        private void OutputWords(RandomWord wd, enWordType wordType, int numWordsToGenerate)
        {
            wd.WordType = wordType;

            for (int i = 0; i < 10; i++)
            {
                _msg.Length = 0;
                _msg.Append("WordType ");
                _msg.Append(wd.WordType.ToString());
                _msg.Append(": ");
                _msg.Append(wd.GetWord());
                _messageLog.WriteLine(_msg.ToString());
            }
        }
Пример #2
0
 private void InitInstance(enWordType wordType, string wordListFile)
 {
     LoadDefaultWordFilePaths();
     if (wordListFile != string.Empty)
     {
         _wordListFile = wordListFile;
     }
     else
     {
         _wordListFile = _defaultRandomWordFileNames[(int)wordType].FilePath;
     }
     _wordType = wordType;
     LoadWordList();
 }
Пример #3
0
        private void InitInstance(enWordType wordType)
        {
            _wordType = wordType;

            switch (wordType)
            {
            case enWordType.NotSpecified:
                _words = _wordArrays.Words;
                break;

            case enWordType.Noun:
                _words = _wordArrays.Nouns;
                break;

            case enWordType.Verb:
                _words = _wordArrays.Verbs;
                break;

            case enWordType.Adjective:
                _words = _wordArrays.Adjectives;
                break;

            case enWordType.Adverb:
                _words = _wordArrays.Adverbs;
                break;

            case enWordType.Pronoun:
                _words = _wordArrays.Pronouns;
                break;

            case enWordType.Determiner:
                _words = _wordArrays.Determiners;
                break;

            case enWordType.DeterminerPronoun:
                _words = _wordArrays.DeterminerPronouns;
                break;

            case enWordType.Preposition:
                _words = _wordArrays.Prepositions;
                break;

            case enWordType.Conjunction:
                _words = _wordArrays.Conjunctions;
                break;

            case enWordType.Interjection:
                _words = _wordArrays.Interjections;
                break;

            case enWordType.Interrogative:
                _words = _wordArrays.Interrogatives;
                break;

            case enWordType.SubordinateConjunction:
                _words = _wordArrays.SubordinateConjunctions;
                break;

            case enWordType.CityName:
                _words = _wordArrays.CityNames;
                break;

            case enWordType.StateName:
                _words = _wordArrays.StateNames;
                break;

            case enWordType.FirstName:
                _words = _wordArrays.FirstNames;
                break;

            case enWordType.FirstNameMale:
                _words = _nameArrays.US_FirstNamesMale;
                break;

            case enWordType.FirstNameFemale:
                _words = _nameArrays.US_FirstNamesFemale;
                break;

            case enWordType.LastName:
                _words = _wordArrays.LastNames;
                break;

            case enWordType.BusinessName:
                _words = _wordArrays.Biz_Names;
                break;

            case enWordType.BizName3Con_1:
                _words = _wordArrays.Biz_3Con1;
                break;

            case enWordType.BizName3Con_2:
                _words = _wordArrays.Biz_3Con2;
                break;

            case enWordType.BizNameSyllable_1:
                _words = _wordArrays.Biz_Syl1;
                break;

            case enWordType.BizNameSyllable_2:
                _words = _wordArrays.Biz_Syl2;
                break;

            case enWordType.BizNameSuffix:
                _words = _wordArrays.Biz_Suffix;
                break;

            case enWordType.BizNamePrefix:
                _words = _wordArrays.Biz_Prefix;
                break;

            case enWordType.SubjectPronoun:
                _words = _wordArrays.SubjectPronouns;
                break;

            case enWordType.ObjectPronoun:
                _words = _wordArrays.ObjectPronouns;
                break;

            default:
                _words = _wordArrays.Words;
                break;
            }
            _maxWordsArrayInx = _words.Length - 1;
        }
Пример #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="wordType">Type of word to generate with this instance (e.g. noun, verb, adjective, etc.).</param>
 /// <param name="customWordsFile">Full path to the file containg the word values.</param>
 public RandomWord(enWordType wordType, string customWordsFile)
 {
     LoadWordsFromFile(wordType, customWordsFile);
 }
Пример #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="wordType">Type of word to generate with this instance (e.g. noun, verb, adjective, etc.).</param>
 public RandomWord(enWordType wordType)
 {
     InitInstance(wordType);
 }
Пример #6
0
 /// <summary>
 /// Method to load a set of custom words to the current word type represented by this instance.
 /// </summary>
 /// <param name="wordType">Type of word to generate with this instance (e.g. noun, verb, adjective, etc.).</param>
 /// <param name="filename">Full path to the file containg the word values.</param>
 /// <param name="textEncoding">Supply a System.Text.Encoding enum value if .NET file routines have trouble reading your files. This will often be needed when incoming data has accents on individual letters.</param>
 /// <remarks>File needs to be in text format with one word per line in the file.</remarks>
 public void LoadWordsFromFile(enWordType wordType, string filename, System.Text.Encoding textEncoding)
 {
     _wordType         = wordType;
     _words            = File.ReadAllLines(filename, textEncoding);
     _maxWordsArrayInx = _words.Length - 1;
 }
Пример #7
0
        //methods

        /// <summary>
        /// Method to load a set of custom words to the current word type represented by this instance.
        /// </summary>
        /// <param name="wordType">Type of word to generate with this instance (e.g. noun, verb, adjective, etc.).</param>
        /// <param name="filename">Full path to the file containg the word values.</param>
        /// <remarks>File needs to be in text format with one word per line in the file.</remarks>
        public void LoadWordsFromFile(enWordType wordType, string filename)
        {
            _wordType         = wordType;
            _words            = File.ReadAllLines(filename);
            _maxWordsArrayInx = _words.Length - 1;
        }
Пример #8
0
 public stRandomWordFileDefinition(enWordType pWordType, string pFilePath)
 {
     WordType = pWordType;
     FilePath = pFilePath;
 }
Пример #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public PFRandomWord(enWordType wordType)
 {
     InitInstance(wordType, string.Empty);
 }
Пример #10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public PFRandomWord(enWordType wordType, string wordListFile)
 {
     InitInstance(wordType, wordListFile);
 }