@@ -211,17 +211,18 @@ public override Operand Calculate(AlgorithmEngine work)
211211 }
212212 }
213213 if ( args1 . Type == OperandType . DATE ) {
214- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '*' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
214+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '*' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
215215 if ( args2 . NumberValue == 1 ) { return args1 ; }
216216 return Operand . Create ( ( MyDate ) ( args1 . DateValue * args2 . NumberValue ) ) ;
217217 } else if ( args2 . Type == OperandType . DATE ) {
218- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '*' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
218+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '*' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
219219 if ( args1 . NumberValue == 1 ) { return args2 ; }
220220 return Operand . Create ( ( MyDate ) ( args2 . DateValue * args1 . NumberValue ) ) ;
221221 }
222222
223- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '*' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
224- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '*' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
223+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '*' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
224+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '*' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
225+
225226 if ( args1 . NumberValue == 1 ) { return args2 ; }
226227 if ( args2 . NumberValue == 1 ) { return args1 ; }
227228
@@ -275,13 +276,12 @@ public override Operand Calculate(AlgorithmEngine work)
275276 return Operand . Error ( "Two types cannot be divided" ) ;
276277 }
277278 }
278- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '/' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
279+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '/' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
279280 if ( args2 . NumberValue == 0 ) { return Operand . Error ( "Div 0 is error!" ) ; }
280281 if ( args2 . NumberValue == 1 ) { return args1 ; }
281282
282283 if ( args1 . Type == OperandType . DATE ) { return Operand . Create ( args1 . DateValue / args2 . NumberValue ) ; }
283- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '/' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
284-
284+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '/' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
285285 return Operand . Create ( args1 . NumberValue / args2 . NumberValue ) ;
286286 }
287287 public override void ToString ( StringBuilder stringBuilder , bool addBrackets )
@@ -331,8 +331,9 @@ public override Operand Calculate(AlgorithmEngine work)
331331 return Operand . Error ( "Two types cannot be modulo" ) ;
332332 }
333333 }
334- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function % parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
335- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function % parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
334+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '%' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
335+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '%' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
336+
336337 if ( args2 . NumberValue == 0 ) { return Operand . Error ( "Div 0 is error!" ) ; }
337338
338339 return Operand . Create ( args1 . NumberValue % args2 . NumberValue ) ;
@@ -368,7 +369,7 @@ public override Operand Calculate(AlgorithmEngine work)
368369 } else if ( DateTime . TryParse ( args1 . TextValue , CultureInfo . InvariantCulture , DateTimeStyles . None , out DateTime dt ) ) {
369370 args1 = Operand . Create ( new MyDate ( dt ) ) ;
370371 } else {
371- return Operand . Error ( "Function '+' is error" ) ;
372+ return Operand . Error ( "Function '+' is error" ) ;
372373 }
373374 }
374375 if ( args2 . Type == OperandType . TEXT ) {
@@ -386,16 +387,17 @@ public override Operand Calculate(AlgorithmEngine work)
386387 }
387388 if ( args1 . Type == OperandType . DATE ) {
388389 if ( args2 . Type == OperandType . DATE ) return Operand . Create ( args1 . DateValue + args2 . DateValue ) ;
389- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '+' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
390+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '+' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
390391 if ( args2 . NumberValue == 0 ) { return args1 ; }
391392 return Operand . Create ( args1 . DateValue + args2 . NumberValue ) ;
392393 } else if ( args2 . Type == OperandType . DATE ) {
393- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '+' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
394+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '+' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
394395 if ( args1 . NumberValue == 0 ) { return args2 ; }
395396 return Operand . Create ( args2 . DateValue + args1 . NumberValue ) ;
396397 }
397- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '+' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
398- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '+' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
398+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '+' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
399+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '+' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
400+
399401 if ( args1 . NumberValue == 0 ) { return args2 ; }
400402 if ( args2 . NumberValue == 0 ) { return args1 ; }
401403
@@ -450,15 +452,16 @@ public override Operand Calculate(AlgorithmEngine work)
450452 }
451453 if ( args1 . Type == OperandType . DATE ) {
452454 if ( args2 . Type == OperandType . DATE ) return Operand . Create ( args1 . DateValue - args2 . DateValue ) ;
453- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '-' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
455+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '-' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
454456 if ( args2 . NumberValue == 0 ) { return args1 ; }
455457 return Operand . Create ( args1 . DateValue - args2 . NumberValue ) ;
456458 } else if ( args2 . Type == OperandType . DATE ) {
457- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '-' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
459+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '-' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
458460 return Operand . Create ( args1 . NumberValue - args2 . DateValue ) ;
459461 }
460- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '-' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
461- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '-' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
462+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '-' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
463+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '-' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
464+
462465 if ( args2 . NumberValue == 0 ) { return args1 ; }
463466
464467 return Operand . Create ( args1 . NumberValue - args2 . NumberValue ) ;
@@ -486,12 +489,13 @@ public override Operand Calculate(AlgorithmEngine work)
486489
487490 if ( args1 . IsNull ) {
488491 if ( args2 . IsNull ) return args1 ;
489- return args2 . ToText ( "Function '&' parameter 2 is error!" ) ;
492+ return args2 . ToText ( "Function '&' parameter {0} is error!" , 2 ) ;
490493 } else if ( args2 . IsNull ) {
491- return args1 . ToText ( "Function '&' parameter 1 is error!" ) ;
494+ return args1 . ToText ( "Function '&' parameter {0} is error!" , 1 ) ;
492495 }
493- if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '&' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
494- if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '&' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
496+ if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '&' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
497+ if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '&' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
498+
495499 return Operand . Create ( args1 . TextValue + args2 . TextValue ) ;
496500 }
497501 public override void ToString ( StringBuilder stringBuilder , bool addBrackets )
@@ -557,8 +561,8 @@ public override Operand Calculate(AlgorithmEngine work)
557561 ) {
558562 return Operand . Error ( "Function '==' compare is error." ) ;
559563 }
560- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '==' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
561- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '==' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
564+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '==' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
565+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '==' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
562566
563567 return Operand . Create ( args1 . NumberValue == args2 . NumberValue ) ;
564568 }
@@ -622,8 +626,8 @@ public override Operand Calculate(AlgorithmEngine work)
622626 ) {
623627 return Operand . Error ( "Function '!=' compare is error." ) ;
624628 }
625- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '!=' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
626- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '!=' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
629+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '!=' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
630+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '!=' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
627631
628632 return Operand . Create ( args1 . NumberValue != args2 . NumberValue ) ;
629633 }
@@ -691,8 +695,8 @@ public override Operand Calculate(AlgorithmEngine work)
691695 ) {
692696 return Operand . Error ( "Function '>=' compare is error." ) ;
693697 }
694- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '>=' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
695- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '>=' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
698+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '>=' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
699+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '>=' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
696700
697701 return Operand . Create ( args1 . NumberValue >= args2 . NumberValue ) ;
698702 }
@@ -759,8 +763,8 @@ public override Operand Calculate(AlgorithmEngine work)
759763 ) {
760764 return Operand . Error ( "Function '<=' compare is error." ) ;
761765 }
762- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '<=' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
763- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '<=' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
766+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '<=' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
767+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '<=' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
764768
765769 return Operand . Create ( args1 . NumberValue <= args2 . NumberValue ) ;
766770 }
@@ -828,8 +832,8 @@ public override Operand Calculate(AlgorithmEngine work)
828832 ) {
829833 return Operand . Error ( "Function '>' compare is error." ) ;
830834 }
831- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '>' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
832- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '>' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
835+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '>' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
836+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '>' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
833837
834838 return Operand . Create ( args1 . NumberValue > args2 . NumberValue ) ;
835839 }
@@ -896,8 +900,8 @@ public override Operand Calculate(AlgorithmEngine work)
896900 ) {
897901 return Operand . Error ( "Function '<' compare is error." ) ;
898902 }
899- if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '<' parameter 1 is error!" ) ; if ( args1 . IsError ) { return args1 ; } }
900- if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '<' parameter 2 is error!" ) ; if ( args2 . IsError ) { return args2 ; } }
903+ if ( args1 . Type != OperandType . NUMBER ) { args1 = args1 . ToNumber ( "Function '<' parameter {0} is error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; } }
904+ if ( args2 . Type != OperandType . NUMBER ) { args2 = args2 . ToNumber ( "Function '<' parameter {0} is error!" , 2 ) ; if ( args2 . IsError ) { return args2 ; } }
901905
902906 return Operand . Create ( args1 . NumberValue < args2 . NumberValue ) ;
903907 }
@@ -980,7 +984,7 @@ public override Operand Calculate(AlgorithmEngine work)
980984 var index = 1 ;
981985 bool b = true ;
982986 foreach ( var item in funcs ) {
983- var a = item . Calculate ( work ) . ToBoolean ( "Function AND parameter {0} is error!" , index ++ ) ;
987+ var a = item . Calculate ( work ) . ToBoolean ( "Function ' AND' parameter {0} is error!" , index ++ ) ;
984988 if ( a . IsError ) { return a ; }
985989 if ( a . BooleanValue == false ) b = false ;
986990 }
@@ -1004,7 +1008,7 @@ public override Operand Calculate(AlgorithmEngine work)
10041008 var index = 1 ;
10051009 bool b = false ;
10061010 foreach ( var item in funcs ) {
1007- var a = item . Calculate ( work ) . ToBoolean ( "Function OR parameter {0} is error!" , index ++ ) ;
1011+ var a = item . Calculate ( work ) . ToBoolean ( "Function 'OR' parameter {0} is error!" , index ++ ) ;
10081012 if ( a . IsError ) { return a ; }
10091013 if ( a . BooleanValue ) b = true ;
10101014 }
@@ -1032,22 +1036,22 @@ public override Operand Calculate(AlgorithmEngine work)
10321036 var args = new List < Operand > ( ) ;
10331037 foreach ( var item in funcs ) { var aa = item . Calculate ( work ) ; if ( aa . IsError ) { return aa ; } args . Add ( aa ) ; }
10341038
1035- var args1 = args [ 0 ] . ToArray ( "Function VLOOKUP parameter 1 error!" ) ; if ( args1 . IsError ) { return args1 ; }
1039+ var args1 = args [ 0 ] . ToArray ( "Function ' VLOOKUP' parameter {0} error!" , 1 ) ; if ( args1 . IsError ) { return args1 ; }
10361040 var args2 = args [ 1 ] ;
1037- var args3 = args [ 2 ] . ToNumber ( "Function VLOOKUP parameter 3 is error!" ) ; if ( args3 . IsError ) { return args3 ; }
1041+ var args3 = args [ 2 ] . ToNumber ( "Function ' VLOOKUP' parameter {0} is error!" , 3 ) ; if ( args3 . IsError ) { return args3 ; }
10381042
10391043 var vague = true ;
10401044 if ( args . Count == 4 ) {
1041- var args4 = args [ 3 ] . ToBoolean ( "Function VLOOKUP parameter 4 is error!" ) ; if ( args4 . IsError ) { return args4 ; }
1045+ var args4 = args [ 3 ] . ToBoolean ( "Function ' VLOOKUP' parameter {0} is error!" , 4 ) ; if ( args4 . IsError ) { return args4 ; }
10421046 vague = args4 . BooleanValue ;
10431047 }
10441048 if ( args2 . Type != OperandType . NULL ) {
1045- var sv = args2 . ToText ( "Function VLOOKUP parameter 2 is error!" ) ; if ( sv . IsError ) { return sv ; }
1049+ var sv = args2 . ToText ( "Function ' VLOOKUP' parameter {0} is error!" , 2 ) ; if ( sv . IsError ) { return sv ; }
10461050 args2 = sv ;
10471051 }
10481052
10491053 foreach ( var item in args1 . ArrayValue ) {
1050- var o = item . ToArray ( "Function VLOOKUP parameter 1 error!" ) ; if ( o . IsError ) { return o ; }
1054+ var o = item . ToArray ( "Function ' VLOOKUP' parameter {0} error!" , 1 ) ; if ( o . IsError ) { return o ; }
10511055 if ( o . ArrayValue . Count > 0 ) {
10521056 var o1 = o . ArrayValue [ 0 ] ;
10531057 int b = - 1 ;
@@ -1100,7 +1104,7 @@ public override Operand Calculate(AlgorithmEngine work)
11001104 }
11011105 }
11021106 }
1103- return Operand . Error ( "Function VLOOKUP is not match !" ) ;
1107+ return Operand . Error ( "Function ' VLOOKUP' is not match !" ) ;
11041108 }
11051109 public override void ToString ( StringBuilder stringBuilder , bool addBrackets )
11061110 {
0 commit comments