public static ScriptOutput Add(ScriptInput scriptInput) { int add1 = Convert.ToInt32(scriptInput.GetValue("add1")); int add2 = Convert.ToInt32(scriptInput.GetValue("add2")); ScriptOutput scriptOutput = new ScriptOutput(); scriptOutput.SetValue("result", add1 + add2); return(scriptOutput); }
public static ScriptOutput PrintObject(ScriptInput si) { ScriptOutput scriptOutput = new ScriptOutput(); object obj = si.GetValue("obj") as object; string message = si.GetValue("message").ToString(); string content = ""; content += obj == null ? "" : obj.ToString(); content += message; scriptOutput.Write(content); return(scriptOutput); }
public static ScriptOutput TimeDesc(ScriptInput si) { DateTime time1 = Convert.ToDateTime(si.GetValue("time1")); DateTime time2 = Convert.ToDateTime(si.GetValue("time2")); ScriptOutput so = new ScriptOutput(); TimeSpan ts = time1 - time2; so.SetValue("TotalHours", ts.TotalHours); so.SetValue("TotalMilliseconds", ts.TotalMilliseconds); so.SetValue("TotalMinutes", ts.TotalMinutes); so.SetValue("TotalSeconds", ts.TotalSeconds); so.SetValue("TotalDays", ts.TotalDays); return(so); }
public static ScriptOutput SetBoolValue(ScriptInput idx) { ScriptOutput so = new ScriptOutput(); so.SetValue("result", Convert.ToBoolean(idx.GetValue("value"))); return(so); }
public static ScriptOutput AddFloat(ScriptInput idx) { ScriptOutput so = new ScriptOutput(); so.SetValue("result", Convert.ToDouble(idx.GetValue("f1")) + Convert.ToDouble(idx.GetValue("f2"))); idx.Write("AddFloat结果:" + so.GetValue("result").ToString()); return(so); }
public static ScriptOutput AddInt(ScriptInput idx) { ScriptOutput so = new ScriptOutput(); so.SetValue("result", (Convert.ToInt32(idx.GetValue("d1")) + Convert.ToInt32(idx.GetValue("d2")))); idx.Write("AddInt结果:" + so.GetValue("result").ToString()); return(so); }
public static ScriptOutput EqualDouble(ScriptInput si) { double int1 = Convert.ToDouble(si.GetValue("float1")); double int2 = Convert.ToDouble(si.GetValue("float2")); string option = Convert.ToString(si.GetValue("option")); bool result = false; switch (option) { case ">": result = int1 > int2; break; case "<": result = int1 < int2; break; case "=": result = int1 == int2; break; case ">=": result = int1 >= int2; break; case "<=": result = int1 <= int2; break; default: break; } ScriptOutput so = new ScriptOutput(); so.SetValue("result", result); return(so); }