Skip to content

Commit b0e06d8

Browse files
committed
fix
1 parent aca880b commit b0e06d8

File tree

8 files changed

+461
-450
lines changed

8 files changed

+461
-450
lines changed

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.csharp.cs

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.flow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public Function_IF(FunctionBase func1, FunctionBase func2, FunctionBase func3) :
1515

1616
public override Operand Calculate(AlgorithmEngine work)
1717
{
18-
var args1 = func1.Calculate(work); if (args1.Type != OperandType.BOOLEAN) { args1 = args1.ToBoolean("Function 'If' first parameter must be boolean!"); if (args1.IsError) { return args1; } }
18+
var args1 = func1.Calculate(work); if (args1.Type != OperandType.BOOLEAN) { args1 = args1.ToBoolean("Function '{0}' parameter {1} is error!","If",1); if (args1.IsError) { return args1; } }
1919
if (args1.BooleanValue) return func2.Calculate(work);
2020
if (func3 == null) { return Operand.False; }
2121
return func3.Calculate(work);
@@ -255,7 +255,7 @@ public override Operand Calculate(AlgorithmEngine work)
255255
{
256256
var args1 = func1.Calculate(work);
257257
if (args1.IsNull) { return Operand.True; }
258-
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!","IsNullOrEmpty",1); if (args1.IsError) { return args1; } }
258+
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!", "IsNullOrEmpty", 1); if (args1.IsError) { return args1; } }
259259
return Operand.Create(string.IsNullOrEmpty(args1.TextValue));
260260
}
261261
public override void ToString(StringBuilder stringBuilder, bool addBrackets)
@@ -274,7 +274,7 @@ public override Operand Calculate(AlgorithmEngine work)
274274
{
275275
var args1 = func1.Calculate(work);
276276
if (args1.IsNull) { return Operand.True; }
277-
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!","IsNullOrWhiteSpace",1); if (args1.IsError) { return args1; } }
277+
if (args1.Type != OperandType.TEXT) { args1 = args1.ToText("Function '{0}' parameter {1} is error!", "IsNullOrWhiteSpace", 1); if (args1.IsError) { return args1; } }
278278
return Operand.Create(string.IsNullOrWhiteSpace(args1.TextValue));
279279
}
280280
public override void ToString(StringBuilder stringBuilder, bool addBrackets)

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.math.cs

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.string.cs

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.sum.cs

Lines changed: 152 additions & 152 deletions
Large diffs are not rendered by default.

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.time.cs

Lines changed: 67 additions & 67 deletions
Large diffs are not rendered by default.

csharp/ToolGood.Algorithm/Internals/Functions/FunctionBase.value.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public override void ToString(StringBuilder stringBuilder, bool addBrackets)
5656
stringBuilder.Append(_value.ToString());
5757
}
5858
}
59-
6059
}
6160

6261
internal class Function_ERROR : Function_1
@@ -177,12 +176,12 @@ public override Operand Calculate(AlgorithmEngine work)
177176
if (((OperandKeyValueList)obj).TryGetValue(op.NumberValue.ToString(), out Operand operand)) {
178177
return operand;
179178
}
180-
return Operand.Error($"Parameter name `{op.TextValue}` is missing!");
179+
return Operand.Error("Parameter name '{0}' is missing!", op.TextValue);
181180
} else if (op.Type == OperandType.TEXT) {
182181
if (((OperandKeyValueList)obj).TryGetValue(op.TextValue, out Operand operand)) {
183182
return operand;
184183
}
185-
return Operand.Error($"Parameter name `{op.TextValue}` is missing!");
184+
return Operand.Error("Parameter name '{0}' is missing!", op.TextValue);
186185
}
187186
return Operand.Error("Parameter name is missing!");
188187
}
@@ -203,7 +202,7 @@ public override Operand Calculate(AlgorithmEngine work)
203202
if (v.IsNull) return Operand.CreateNull();
204203
return Operand.Create(v);
205204
}
206-
return Operand.Error($"JSON index {index} greater than maximum length!");
205+
return Operand.Error("JSON index {0} greater than maximum length!", index.ToString());
207206
} else {
208207
op = op.ToText("JSON parameter name is error!");
209208
if (op.IsError) { return op; }

csharp/ToolGood.Algorithm/Operand.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using ToolGood.Algorithm.Enums;
55
using ToolGood.Algorithm.LitJson;
66
using System.Text;
7+
using System.Reflection;
8+
79

810
#if WebAssembly
911
using System.Linq2;
@@ -365,6 +367,16 @@ public static Operand Error(string msg)
365367
/// </summary>
366368
/// <param name="msg"></param>
367369
/// <param name="funName"></param>
370+
/// <returns></returns>
371+
public static Operand Error(string msg, string funName)
372+
{
373+
return new OperandError(string.Format(msg, funName));
374+
}
375+
/// <summary>
376+
/// 创建操作数
377+
/// </summary>
378+
/// <param name="msg"></param>
379+
/// <param name="funName"></param>
368380
/// <param name="index"></param>
369381
/// <returns></returns>
370382
public static Operand Error(string msg, string funName, int index)

0 commit comments

Comments
 (0)