Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public static ScriptOutput SetBoolValue(ScriptInput idx)
        {
            ScriptOutput so = new ScriptOutput();

            so.SetValue("result", Convert.ToBoolean(idx.GetValue("value")));
            return(so);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }