Example #1
0
 public void Replace(int offset, int length, string pattern)
 {
     if (CurrentDocumentInformation != null && TextIterator != null)
     {
         CurrentDocumentInformation.Replace(offset, length, pattern);
         TextIterator.InformReplace(offset, length, pattern.Length);
     }
 }
Example #2
0
 public static string Parse(Grid <bool> grid, bool trim = false)
 {
     if (grid.Rows != 6)
     {
         throw new ArgumentException("Should contain 6 rows", nameof(grid));
     }
     try
     {
         var chs = new TextIterator(grid, trim).Select(bits => Lookup[bits]).ToArray();
         return(new string(chs, 0, chs.Length).Trim());
     }
     catch (KeyNotFoundException)
     {
         throw new FormatException($"Not a valid ASCII text:\r\n{grid.ToString(b => b ? '█' : '░')}");
     }
 }