@@ -18,7 +18,7 @@ public Function_URLENCODE(FunctionBase func1) : base(func1)
1818
1919 public override Operand Calculate ( AlgorithmEngine work )
2020 {
21- var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "UrlEncode" ) ; if ( args1 . IsError ) { return args1 ; } }
21+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "UrlEncode" ) ; if ( args1 . IsError ) { return args1 ; } }
2222 var s = args1 . TextValue ;
2323 var r = System . Web . HttpUtility . UrlEncode ( s ) ;
2424 return Operand . Create ( r ) ;
@@ -37,7 +37,7 @@ public Function_URLDECODE(FunctionBase func1) : base(func1)
3737
3838 public override Operand Calculate ( AlgorithmEngine work )
3939 {
40- var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "UrlDecode" ) ; if ( args1 . IsError ) { return args1 ; } }
40+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "UrlDecode" ) ; if ( args1 . IsError ) { return args1 ; } }
4141 var s = args1 . TextValue ;
4242 var r = System . Web . HttpUtility . UrlDecode ( s ) ;
4343 return Operand . Create ( r ) ;
@@ -56,7 +56,7 @@ public Function_HTMLENCODE(FunctionBase func1) : base(func1)
5656
5757 public override Operand Calculate ( AlgorithmEngine work )
5858 {
59- var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "HtmlEncode" ) ; if ( args1 . IsError ) { return args1 ; } }
59+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "HtmlEncode" ) ; if ( args1 . IsError ) { return args1 ; } }
6060 var s = args1 . TextValue ;
6161 var r = System . Web . HttpUtility . HtmlEncode ( s ) ;
6262 return Operand . Create ( r ) ;
@@ -75,7 +75,7 @@ public Function_HTMLDECODE(FunctionBase func1) : base(func1)
7575
7676 public override Operand Calculate ( AlgorithmEngine work )
7777 {
78- var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "HtmlDecode" ) ; if ( args1 . IsError ) { return args1 ; } }
78+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter is error!" , "HtmlDecode" ) ; if ( args1 . IsError ) { return args1 ; } }
7979 var s = args1 . TextValue ;
8080 var r = System . Web . HttpUtility . HtmlDecode ( s ) ;
8181 return Operand . Create ( r ) ;
@@ -281,24 +281,24 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
281281 }
282282 }
283283
284- internal class Function_MD5 : Function_N
284+ internal class Function_MD5 : Function_2
285285 {
286- public Function_MD5 ( FunctionBase [ ] funcs ) : base ( funcs )
286+ public Function_MD5 ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
287287 {
288288 }
289289
290290 public override Operand Calculate ( AlgorithmEngine work )
291291 {
292- var args = new List < Operand > ( ) ; int index = 1 ;
293- foreach ( var item in funcs ) { var a = item . Calculate ( work ) . ToText ( "Function '{0}' parameter {1} is error!" , "MD5" , index ++ ) ; if ( a . IsError ) { return a ; } args . Add ( a ) ; }
292+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "MD5" , 1 ) ; if ( args1 . IsError ) return args1 ; }
294293 try {
295294 Encoding encoding ;
296- if ( args . Count == 1 ) {
295+ if ( func2 == null ) {
297296 encoding = Encoding . UTF8 ;
298297 } else {
299- encoding = Encoding . GetEncoding ( args [ 1 ] . TextValue ) ;
298+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "MD5" , 2 ) ; if ( args2 . IsError ) return args2 ; }
299+ encoding = Encoding . GetEncoding ( args2 . TextValue ) ;
300300 }
301- var t = Hash . GetMd5String ( encoding . GetBytes ( args [ 0 ] . TextValue ) ) ;
301+ var t = Hash . GetMd5String ( encoding . GetBytes ( args1 . TextValue ) ) ;
302302 return Operand . Create ( t ) ;
303303 } catch ( Exception ex ) {
304304 return Operand . Error ( "Function 'MD5' is error!" + ex . Message ) ;
@@ -310,24 +310,24 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
310310 }
311311 }
312312
313- internal class Function_SHA1 : Function_N
313+ internal class Function_SHA1 : Function_2
314314 {
315- public Function_SHA1 ( FunctionBase [ ] funcs ) : base ( funcs )
315+ public Function_SHA1 ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
316316 {
317317 }
318318
319319 public override Operand Calculate ( AlgorithmEngine work )
320320 {
321- var args = new List < Operand > ( ) ; int index = 1 ;
322- foreach ( var item in funcs ) { var a = item . Calculate ( work ) . ToText ( "Function '{0}' parameter {1} is error!" , "SHA1" , index ++ ) ; if ( a . IsError ) { return a ; } args . Add ( a ) ; }
321+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA1" , 1 ) ; if ( args1 . IsError ) return args1 ; }
323322 try {
324323 Encoding encoding ;
325- if ( args . Count == 1 ) {
324+ if ( func2 == null ) {
326325 encoding = Encoding . UTF8 ;
327326 } else {
328- encoding = Encoding . GetEncoding ( args [ 1 ] . TextValue ) ;
327+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA1" , 2 ) ; if ( args2 . IsError ) return args2 ; }
328+ encoding = Encoding . GetEncoding ( args2 . TextValue ) ;
329329 }
330- var t = Hash . GetSha1String ( encoding . GetBytes ( args [ 0 ] . TextValue ) ) ;
330+ var t = Hash . GetSha1String ( encoding . GetBytes ( args1 . TextValue ) ) ;
331331 return Operand . Create ( t ) ;
332332 } catch ( Exception ex ) {
333333 return Operand . Error ( "Function 'SHA1' is error!" + ex . Message ) ;
@@ -339,24 +339,24 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
339339 }
340340 }
341341
342- internal class Function_SHA256 : Function_N
342+ internal class Function_SHA256 : Function_2
343343 {
344- public Function_SHA256 ( FunctionBase [ ] funcs ) : base ( funcs )
344+ public Function_SHA256 ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
345345 {
346346 }
347347
348348 public override Operand Calculate ( AlgorithmEngine work )
349349 {
350- var args = new List < Operand > ( ) ; int index = 1 ;
351- foreach ( var item in funcs ) { var a = item . Calculate ( work ) . ToText ( "Function '{0}' parameter {1} is error!" , "SHA256" , index ++ ) ; if ( a . IsError ) { return a ; } args . Add ( a ) ; }
350+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA256" , 1 ) ; if ( args1 . IsError ) return args1 ; }
352351 try {
353352 Encoding encoding ;
354- if ( args . Count == 1 ) {
353+ if ( func2 == null ) {
355354 encoding = Encoding . UTF8 ;
356355 } else {
357- encoding = Encoding . GetEncoding ( args [ 1 ] . TextValue ) ;
356+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA256" , 2 ) ; if ( args2 . IsError ) return args2 ; }
357+ encoding = Encoding . GetEncoding ( args2 . TextValue ) ;
358358 }
359- var t = Hash . GetSha256String ( encoding . GetBytes ( args [ 0 ] . TextValue ) ) ;
359+ var t = Hash . GetSha256String ( encoding . GetBytes ( args1 . TextValue ) ) ;
360360 return Operand . Create ( t ) ;
361361 } catch ( Exception ex ) {
362362 return Operand . Error ( "Function 'SHA256' is error!" + ex . Message ) ;
@@ -368,24 +368,24 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
368368 }
369369 }
370370
371- internal class Function_SHA512 : Function_N
371+ internal class Function_SHA512 : Function_2
372372 {
373- public Function_SHA512 ( FunctionBase [ ] funcs ) : base ( funcs )
373+ public Function_SHA512 ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
374374 {
375375 }
376376
377377 public override Operand Calculate ( AlgorithmEngine work )
378378 {
379- var args = new List < Operand > ( ) ; int index = 1 ;
380- foreach ( var item in funcs ) { var a = item . Calculate ( work ) . ToText ( "Function '{0}' parameter {1} is error!" , "SHA512" , index ++ ) ; if ( a . IsError ) { return a ; } args . Add ( a ) ; }
379+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA512" , 1 ) ; if ( args1 . IsError ) return args1 ; }
381380 try {
382381 Encoding encoding ;
383- if ( args . Count == 1 ) {
382+ if ( func2 == null ) {
384383 encoding = Encoding . UTF8 ;
385384 } else {
386- encoding = Encoding . GetEncoding ( args [ 1 ] . TextValue ) ;
385+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "SHA512" , 2 ) ; if ( args2 . IsError ) return args2 ; }
386+ encoding = Encoding . GetEncoding ( args2 . TextValue ) ;
387387 }
388- var t = Hash . GetSha512String ( encoding . GetBytes ( args [ 0 ] . TextValue ) ) ;
388+ var t = Hash . GetSha512String ( encoding . GetBytes ( args1 . TextValue ) ) ;
389389 return Operand . Create ( t ) ;
390390 } catch ( Exception ex ) {
391391 return Operand . Error ( "Function 'SHA512' is error!" + ex . Message ) ;
@@ -397,24 +397,24 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
397397 }
398398 }
399399
400- internal class Function_CRC32 : Function_N
400+ internal class Function_CRC32 : Function_2
401401 {
402- public Function_CRC32 ( FunctionBase [ ] funcs ) : base ( funcs )
402+ public Function_CRC32 ( FunctionBase func1 , FunctionBase func2 ) : base ( func1 , func2 )
403403 {
404404 }
405405
406406 public override Operand Calculate ( AlgorithmEngine work )
407407 {
408- var args = new List < Operand > ( ) ; int index = 1 ;
409- foreach ( var item in funcs ) { var a = item . Calculate ( work ) . ToText ( "Function '{0}' parameter {1} is error!" , "CRC32" , index ++ ) ; if ( a . IsError ) { return a ; } args . Add ( a ) ; }
408+ var args1 = func1 . Calculate ( work ) ; if ( args1 . Type != OperandType . TEXT ) { args1 = args1 . ToText ( "Function '{0}' parameter {1} is error!" , "CRC32" , 1 ) ; if ( args1 . IsError ) return args1 ; }
410409 try {
411410 Encoding encoding ;
412- if ( args . Count == 1 ) {
411+ if ( func2 == null ) {
413412 encoding = Encoding . UTF8 ;
414413 } else {
415- encoding = Encoding . GetEncoding ( args [ 1 ] . TextValue ) ;
414+ var args2 = func2 . Calculate ( work ) ; if ( args2 . Type != OperandType . TEXT ) { args2 = args2 . ToText ( "Function '{0}' parameter {1} is error!" , "CRC32" , 2 ) ; if ( args2 . IsError ) return args2 ; }
415+ encoding = Encoding . GetEncoding ( args2 . TextValue ) ;
416416 }
417- var t = Hash . GetCrc32String ( encoding . GetBytes ( args [ 0 ] . TextValue ) ) ;
417+ var t = Hash . GetCrc32String ( encoding . GetBytes ( args1 . TextValue ) ) ;
418418 return Operand . Create ( t ) ;
419419 } catch ( Exception ex ) {
420420 return Operand . Error ( "Function 'CRC32' is error!" + ex . Message ) ;
0 commit comments