PositionalPasswordCharacter.cs 980 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace friaLabbar.Models
  7. {
  8. public class PositionalPasswordCharacter : HashSet<char>
  9. {
  10. private uint expectedLength;
  11. private string _letterString;
  12. public uint Position { get; private set; }
  13. public string Text
  14. {
  15. get { return _letterString; }
  16. set
  17. {
  18. _letterString = value;
  19. this.Clear();
  20. this.UnionWith(value);
  21. }
  22. }
  23. public bool IsComplete { get { return Count >= expectedLength; } }
  24. public bool IsValid { get { return Count <= expectedLength; } }
  25. public PositionalPasswordCharacter(uint expectedLength, uint position)
  26. : base()
  27. {
  28. this.expectedLength = expectedLength;
  29. Text = string.Empty;
  30. Position = position;
  31. }
  32. }
  33. }