Source/NFX/Security/CAPTCHA/PuzzleKeypad.cs
/// <summary>
/// Translates user action coordinates (i.e. screen touches or mouse clicks) into a string.
/// The coordinates are supplied as IEnumerable(Point)
/// </summary>
Translates user action coordinates  into a string.
The coordinates are supplied as IEnumerable(Point)
Translates user action coordinates into a string . The coordinates are supplied as IEnumerable ( Point )
public string DecipherCoordinates(IEnumerable<Point> coords, int? offsetX = null, int? offsetY = null)
      {
        var result = new StringBuilder();
        var ox = offsetX.HasValue? offsetX.Value : DEFAULT_RENDER_OFFSET_X;
        var oy = offsetY.HasValue? offsetY.Value : DEFAULT_RENDER_OFFSET_Y;
        foreach(var pnt in coords)
        {
          var op = pnt;
          op.Offset(-ox, -oy);
          var box = m_Boxes.Reverse<CharBox>().FirstOrDefault(b=>b.Rect.Contains(op));
          if (box.Char>0)
           result.Append(box.Char);
        }
        return result.ToString();
      }
public string DecipherCoordinates ( IEnumerable < Point > coords , int ? offsetX = null , int ? offsetY = null ) { var result = new StringBuilder ( ) ; var ox = offsetX . HasValue ? offsetX . Value : DEFAULT_RENDER_OFFSET_X ; var oy = offsetY . HasValue ? offsetY . Value : DEFAULT_RENDER_OFFSET_Y ; foreach ( var pnt in coords ) { var op = pnt ; op . Offset ( - ox , - oy ) ; var box = m_Boxes . Reverse < CharBox > ( ) . FirstOrDefault ( b => b . Rect . Contains ( op ) ) ; if ( box . Char > 0 ) result . Append ( box . Char ) ; } return result . ToString ( ) ; }
Translates user action coordinates (i.e.
Translates user action coordinates ( i . e .
coords
IEnumerable<Point>
offsetX
int?
offsetY
int?