Advertisement
uniblab

Untitled

Jul 17th, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. private System.Nullable<System.Char> ReadChar( System.IO.StringReader reader, System.Nullable<System.Char> escape, System.Char @break, System.Boolean readNextOnBreak ) {
  2.     if ( null == reader ) {
  3.         throw new System.ArgumentNullException( "reader" );
  4.     }
  5.  
  6.     var p = reader.Peek();
  7.     if ( -1 == p ) {
  8.         return null;
  9.     }
  10.     var c = System.Convert.ToChar( reader.Read() );
  11.     if ( escape.HasValue && escape.Value.Equals( c ) ) {
  12.         return System.Convert.ToChar( reader.Read() );
  13.     }
  14.     if ( @break.Equals( c ) ) {
  15.         if ( readNextOnBreak ) {
  16.             p = reader.Peek();
  17.             if ( -1 == p ) {
  18.                 return null;
  19.             } else if ( @break.Equals( System.Convert.ToChar( p ) ) ) {
  20.                 return System.Convert.ToChar( reader.Read() );
  21.             }
  22.         }
  23.         return null;
  24.     }
  25.     return c;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement