コード例 #1
0
 public object this[IDocument document, LineSegment line, int offset, int length]
 {
     get
     {
         if (length == 0)
         {
             return(null);
         }
         LookupTable.Node node = this.root;
         int num = line.Offset + offset;
         if (this.casesensitive)
         {
             for (int i = 0; i < length; i++)
             {
                 int num2 = (int)(document.GetCharAt(num + i) % 'Ā');
                 node = node.leaf[num2];
                 if (node == null)
                 {
                     return(null);
                 }
                 if (node.color != null && TextUtility.RegionMatches(document, num, length, node.word))
                 {
                     return(node.color);
                 }
             }
         }
         else
         {
             for (int j = 0; j < length; j++)
             {
                 int num3 = (int)(char.ToUpper(document.GetCharAt(num + j)) % 'Ā');
                 node = node.leaf[num3];
                 if (node == null)
                 {
                     return(null);
                 }
                 if (node.color != null && TextUtility.RegionMatches(document, this.casesensitive, num, length, node.word))
                 {
                     return(node.color);
                 }
             }
         }
         return(null);
     }
 }
コード例 #2
0
 public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word)
 {
     if (casesensitive)
     {
         return(TextUtility.RegionMatches(document, offset, length, word));
     }
     if (length != word.Length || document.TextLength < offset + length)
     {
         return(false);
     }
     for (int i = 0; i < length; i++)
     {
         if (char.ToUpper(document.GetCharAt(offset + i)) != char.ToUpper(word[i]))
         {
             return(false);
         }
     }
     return(true);
 }