예제 #1
0
 private bool isValidConfiguration()
 {
     if (_codeConfiguration.GetLength() == 0)
     {
         _isValidConfig = false;
         throw new Exception(_rm.GetString("MissingDefineCodeLength"));
     }
     _isValidConfig = true;
     return(_isValidConfig);
 }
예제 #2
0
        public string Generate(ICodeConfiguration codeConfiguration)
        {
            _codeConfiguration = codeConfiguration;
            if (!isValidConfiguration())
            {
                return(_code);
            }

            Random obj = new Random();

            int  length = _possibles.Length;
            char letter;
            int  lengthnewstring = codeConfiguration.GetLength();

            for (int i = 0; i < lengthnewstring; i++)
            {
                letter = _possibles[obj.Next(length)];
                _code += letter.ToString();
            }

            return(_code);
        }