예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterSetShuffler"/> class.
 /// </summary>
 /// <param name="characterSetProvider">An instance of the <see cref="ICharacterSetProvider"/>.</param>
 /// <param name="shuffle">An instance of <see cref="IShuffle{T}"/> of type
 /// <see langword="char"/>.</param>
 public CharacterSetShuffler(
     ICharacterSetProvider characterSetProvider,
     IShuffle <char> shuffle)
 {
     this.characterSetProvider = characterSetProvider;
     this.shuffle = shuffle;
 }
예제 #2
0
 public StringEditViewModel(ICharacterSetProvider stringConfiguration, ICharacterSetService characterSetService, IRandomStringGenerator randomStringGenerator)
 {
     this.stringConfiguration   = stringConfiguration;
     this.characterSetService   = characterSetService;
     this.randomStringGenerator = randomStringGenerator;
     GenerateCommand            = new RelayCommand(RunGenerate, CanExecuteGenerate);
     AddCharactersCommand       = new RelayCommand(RunGenerate, CanExecuteGenerate);
     RemoveCharactersCommand    = new RelayCommand(RunRemoveCharacters, CanExecuteRemoveCharacters);
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RandomWordGenerator"/>
        /// class thats able to generate random words.
        /// </summary>
        /// <param name="dictionaryService">A service for retrieving dictionaries.</param>
        /// <param name="characterSetProvider">A service for providing a character list.</param>
        /// <param name="threadService">A service for getting the number of threads.</param>
        /// <param name="dictionaryConfiguration">The dictionary configuration settings.</param>
        public RandomWordGenerator(
            IDictionaryLoader dictionaryService,
            ICharacterSetProvider characterSetProvider,
            IThreadBalancer threadService,
            DictionaryConfiguration dictionaryConfiguration)
        {
            // Set member dependencies.
            this.dictionaryService       = dictionaryService;
            this.threadService           = threadService;
            this.dictionaryConfiguration = dictionaryConfiguration;

            characterList = characterSetProvider.ToCharArray();
            random        = RandomProvider.Random;

            progressPercentage = 0;
        }
예제 #4
0
        /// <summary>
        /// Returns string array of supported collations for document character sets.
        /// </summary>
        /// <param name="document">Document object for which we need standard values.</param>
        /// <param name="connection">Connection to use for standard values extraction.</param>
        /// <returns>Returns string array of supported collations for document character sets.</returns>
        protected override string[] ReadStandartValues(IDocument document, DataConnectionWrapper connection)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            // Extract provider, if available
            ICharacterSetProvider provider = (document as ICharacterSetProvider);

            // If provider not availabel return all collations.
            if (provider == null)
            {
                return(connection.GetCollations());
            }

            // Return collations for provider cahracter set
            return(connection.GetCollationsForCharacterSet(provider.CharcterSet));
        }