MultilineTextDiff/VerySimpleRtfBuilder.cs
/// <summary>
/// Insert formating information to internal RTF string.
/// </summary>
/// <param name="style">Format definition.</param>
Insert formating information to internal RTF string.
Insert formating information to internal RTF string .
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Internal function")]
    private void ProcessStyle(Styles style)
    {
      bool clear = ((style & Styles.Clear) == Styles.Clear);
      if ((style & Styles.InvalidScriptOption) == Styles.InvalidScriptOption)
      {
        if (clear)
        {
          style &= ~Styles.Subscript;
        }
        else
        {
          throw new ArgumentException("Invalid script style!", nameof(style));
        }
      }
      if (style == Styles.Clear)
      {
        this.rtf.Append(@"\i0\b0\ulnone\strike0\nosupersub\caps0");
        return;
      }
      if ((style & Styles.Italic) == Styles.Italic)
      {
        this.rtf.Append(@"\i");
        if (clear)
        {
          this.rtf.Append("0");
        }
      }
      if ((style & Styles.Bold) == Styles.Bold)
      {
        this.rtf.Append(@"\b");
        if (clear)
        {
          this.rtf.Append("0");
        }
      }
      if ((style & Styles.Underline) == Styles.Underline)
      {
        this.rtf.Append(@"\ul");
        if (clear)
        {
          this.rtf.Append("none");
        }
      }
      if ((style & Styles.Strikeout) == Styles.Strikeout)
      {
        this.rtf.Append(@"\strike");
        if (clear)
        {
          this.rtf.Append("0");
        }
      }
      if ((style & Styles.Superscript) == Styles.Superscript)
      {
        if (clear)
        {
          this.rtf.Append(@"\nosupersub");
        }
        else
        {
          this.rtf.Append(@"\super");
        }
      }
      if ((style & Styles.Subscript) == Styles.Subscript)
      {
        if (clear)
        {
          this.rtf.Append(@"\nosupersub");
        }
        else
        {
          this.rtf.Append(@"\sub");
        }
      }
      if ((style & Styles.Capitals) == Styles.Capitals)
      {
        this.rtf.Append(@"\caps");
        if (clear)
        {
          this.rtf.Append("0");
        }
      }
    }
[ SuppressMessage ( " " , " " , Justification = " " ) ] private void ProcessStyle ( Styles style ) { bool clear = ( ( style & Styles . Clear ) == Styles . Clear ) ; if ( ( style & Styles . InvalidScriptOption ) == Styles . InvalidScriptOption ) { if ( clear ) { style &= ~ Styles . Subscript ; } else { throw new ArgumentException ( " " , nameof ( style ) ) ; } } if ( style == Styles . Clear ) { this . rtf . Append ( @"\i0\b0\ulnone\strike0\nosupersub\caps0" ) ; return ; } if ( ( style & Styles . Italic ) == Styles . Italic ) { this . rtf . Append ( @"\i" ) ; if ( clear ) { this . rtf . Append ( " " ) ; } } if ( ( style & Styles . Bold ) == Styles . Bold ) { this . rtf . Append ( @"\b" ) ; if ( clear ) { this . rtf . Append ( " " ) ; } } if ( ( style & Styles . Underline ) == Styles . Underline ) { this . rtf . Append ( @"\ul" ) ; if ( clear ) { this . rtf . Append ( " " ) ; } } if ( ( style & Styles . Strikeout ) == Styles . Strikeout ) { this . rtf . Append ( @"\strike" ) ; if ( clear ) { this . rtf . Append ( " " ) ; } } if ( ( style & Styles . Superscript ) == Styles . Superscript ) { if ( clear ) { this . rtf . Append ( @"\nosupersub" ) ; } else { this . rtf . Append ( @"\super" ) ; } } if ( ( style & Styles . Subscript ) == Styles . Subscript ) { if ( clear ) { this . rtf . Append ( @"\nosupersub" ) ; } else { this . rtf . Append ( @"\sub" ) ; } } if ( ( style & Styles . Capitals ) == Styles . Capitals ) { this . rtf . Append ( @"\caps" ) ; if ( clear ) { this . rtf . Append ( " " ) ; } } }
Insert formating information to internal RTF string.
Insert formating information to internal RTF string .
style
Styles
None