MultilineTextDiff/VerySimpleRtfBuilder.cs
/// <summary>
/// Append a single character as RTF data.
/// </summary>
/// <param name="c">Character to be appended.</param>
Append a single character as RTF data.
Append a single character as RTF data .
private void AppendRtf(char c)
    {
      switch (c)
      {
      case '\t':
        this.rtf.Append(tab);
        break;
      case '\\':
      case '{':
      case '}':
        this.rtf.Append('\\').Append(c);
        break;
      case '\r':
        this.rtf.AppendLine(paragraph);
        break;
      case '\n':
        if (this.previousChar != '\r')
        {
          this.rtf.AppendLine(paragraph);
        }
        break;
      default:
        if ((c < '\0') || (c > '\x7f'))
        {
          int n = (int)c;
          if (n > 32767)
          {
            n -= 65536;
          }
          this.rtf.Append(@"\u").Append(n).Append('?');
        }
        else if (c < ' ')
        {
          this.rtf.Append('#').Append(((int)c).ToString("X2", CultureInfo.InvariantCulture));
        }
        else
        {
          this.rtf.Append(c);
        }
        break;
      }
      this.previousChar = c;
    }
private void AppendRtf ( char c ) { switch ( c ) { case ' \t ' : this . rtf . Append ( tab ) ; break ; case ' \\ ' : case ' ' : case ' ' : this . rtf . Append ( ' \\ ' ) . Append ( c ) ; break ; case ' \r ' : this . rtf . AppendLine ( paragraph ) ; break ; case ' \n ' : if ( this . previousChar != ' \r ' ) { this . rtf . AppendLine ( paragraph ) ; } break ; default : if ( ( c < ' \0 ' ) || ( c > ' \x7f ' ) ) { int n = ( int ) c ; if ( n > 32767 ) { n -= 65536 ; } this . rtf . Append ( @"\u" ) . Append ( n ) . Append ( ' ' ) ; } else if ( c < ' ' ) { this . rtf . Append ( ' ' ) . Append ( ( ( int ) c ) . ToString ( " " , CultureInfo . InvariantCulture ) ) ; } else { this . rtf . Append ( c ) ; } break ; } this . previousChar = c ; }
Append a single character as RTF data.
Append a single character as RTF data .
c
char
Character to be appended.
Character to be appended .