Beispiel #1
0
 private static bool previoushlightcheck(Highlight high)
 {
     foreach (Highlight hlight in hlights)
     {
         if (high.Start > hlight.Start & high.Start < hlight.Start + hlight.Length)
         {
             return true;
         }
     }
     return false;
 }
Beispiel #2
0
        private static string ApplyFormat2(Highlight high, string text, string color)
        {
            string hstring = text.Substring(high.Start, high.Length);
            if (hstring.EndsWith("\n"))
            {
                text = text.Insert(high.Start + high.Length -1, "\\cf0");
                text = text.Insert(high.Start, color);
                
            }
            else
            {
                text = text.Insert(high.Start + high.Length, "\\cf0");
                text = text.Insert(high.Start, color);
                

            }
            return text;

        }
Beispiel #3
0
 internal static Highlight GetNextHighlight(string text, string startstring, string endstring, int offset,bool checks)
 {
     Highlight retval = new Highlight(-1, -1, Color.Black);
     int start = text.IndexOf(startstring,offset);
     int end = text.IndexOf(endstring, start + 1);
     if (end < 0) { return retval; }
     int length = (end + endstring.Length) - start;
     string previouschar = "";
     string postchar = "";
     if (start - 1 < 0)
     {
         previouschar = " ";
     }
     else
     {
         previouschar = text.Substring(start - 1, 1);
     }
     if (endstring == "\n")
     {
         postchar = "\n";
     }
     else
     {
         postchar = text.Substring(start + length, 1);
     }
     bool prevcheck = isnonletter(previouschar);
     bool postcheck = isnonletter(postchar);
     if (checks)
     {
         if (prevcheck & postcheck)
         {
             retval = new Highlight(start, length, Color.Black);
         }
     }
     else
     {
         retval = new Highlight(start, length, Color.Black);
     }
     
     return retval;
 }