} // DoVisit // ---------------------------------------------------------------------- protected override bool IsEqual(object obj) { RtfTag compare = obj as RtfTag; // guaranteed to be non-null return(compare != null && base.IsEqual(obj) && fullName.Equals(compare.fullName)); } // IsEqual
// ---------------------------------------------------------------------- private void ParseTag( TextReader reader ) { StringBuilder tagName = new StringBuilder(); StringBuilder tagValue = null; bool readingName = true; bool delimReached = false; int nextChar = PeekNextChar( reader, true ); while ( !delimReached ) { if ( readingName && IsASCIILetter( nextChar ) ) { tagName.Append( ReadOneChar( reader ) ); // must still consume the 'peek'ed char } else if ( IsDigit( nextChar ) || (nextChar == '-' && tagValue == null) ) { readingName = false; if ( tagValue == null ) { tagValue = new StringBuilder(); } tagValue.Append( ReadOneChar( reader ) ); // must still consume the 'peek'ed char } else { delimReached = true; IRtfTag newTag; if ( tagValue != null && tagValue.Length > 0 ) { newTag = new RtfTag( tagName.ToString(), tagValue.ToString() ); } else { newTag = new RtfTag( tagName.ToString() ); } bool skippedContent = HandleTag( reader, newTag ); if ( nextChar == ' ' && !skippedContent ) { reader.Read(); // must still consume the 'peek'ed char } } if ( !delimReached ) { nextChar = PeekNextChar( reader, true ); } } }