private bool isValidConfiguration() { if (_codeConfiguration.GetLength() == 0) { _isValidConfig = false; throw new Exception(_rm.GetString("MissingDefineCodeLength")); } _isValidConfig = true; return(_isValidConfig); }
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); }