11using System ;
22using System . Collections . Generic ;
3+ using System . Reflection ;
34using System . Text ;
45using ToolGood . Algorithm . Enums ;
56
@@ -22,12 +23,25 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
2223 {
2324 if ( _value . Type == OperandType . TEXT ) {
2425 stringBuilder . Append ( '"' ) ;
25- stringBuilder . Append ( _value . TextValue . Replace ( "\" " , "\" \" " ) ) ;
26+ var stringValue = _value . TextValue ;
27+ stringValue = stringValue . Replace ( "\\ " , "\\ \\ " ) ;
28+ stringValue = stringValue . Replace ( "\r " , "\\ r" ) ;
29+ stringValue = stringValue . Replace ( "\n " , "\\ n" ) ;
30+ stringValue = stringValue . Replace ( "\t " , "\\ t" ) ;
31+ stringValue = stringValue . Replace ( "\0 " , "\\ 0" ) ;
32+ stringValue = stringValue . Replace ( "\v " , "\\ v" ) ;
33+ stringValue = stringValue . Replace ( "\a " , "\\ a" ) ;
34+ stringValue = stringValue . Replace ( "\b " , "\\ b" ) ;
35+ stringValue = stringValue . Replace ( "\f " , "\\ f" ) ;
36+ stringValue = stringValue . Replace ( "\" " , "\\ \" " ) ;
37+ stringBuilder . Append ( stringValue ) ;
2638 stringBuilder . Append ( '"' ) ;
2739 } else if ( _value . Type == OperandType . DATE ) {
2840 stringBuilder . Append ( '"' ) ;
2941 stringBuilder . Append ( _value . DateValue . ToString ( ) ) ;
3042 stringBuilder . Append ( '"' ) ;
43+ } else if ( _value . Type == OperandType . BOOLEAN ) {
44+ stringBuilder . Append ( _value . BooleanValue ? "true" : "false" ) ;
3145 } else {
3246 stringBuilder . Append ( _value . ToString ( ) ) ;
3347 }
0 commit comments