Exemplo n.º 1
0
        public void IsDataTest2()
        {
            IPM pm = new PM("pname = true");

            Assert.AreEqual(false, pm.IsData("property1", "property2", "property2", "property3"));
            Assert.AreEqual(true, pm.IsData("property1", "property2", "pname", "property3"));
        }
Exemplo n.º 2
0
        public void IsDataTest2()
        {
            IPM pm = new PM("pname = true");

            Assert.False(pm.IsData("property1", "property2", "property2", "property3"));
            Assert.True(pm.IsData("property1", "property2", "pname", "property3"));
        }
Exemplo n.º 3
0
        public void IsDataTest1()
        {
            IPM pm = new PM("pname . m1(true, 123).right = true");

            Assert.AreEqual(true, pm.IsData("pname"));
            Assert.AreEqual(false, pm.IsData("pname "));
            pm.pinTo(1);

            Assert.AreEqual(true, pm.IsData("m1"));
            pm.pinTo(1);

            Assert.AreEqual(true, pm.IsData("right"));
            pm.pinTo(1);

            Assert.AreEqual(true, pm.IsData(" true"));
        }
Exemplo n.º 4
0
        public void IsDataTest1()
        {
            IPM pm = new PM("pname . m1(true, 123).right = true");

            Assert.True(pm.IsData("pname"));
            Assert.False(pm.IsData("pname "));
            pm.PinTo(1);

            Assert.True(pm.IsData("m1"));
            pm.PinTo(1);

            Assert.True(pm.IsData("right"));
            pm.PinTo(1);

            Assert.True(pm.IsData(" true"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Prepare, parse, and evaluate mixed data through SobaScript supported syntax.
        /// </summary>
        /// <param name="data">Mixed input data.</param>
        /// <returns>Evaluated end value.</returns>
        public override string Eval(string data)
        {
            var    point   = EntryPoint(data, RegexOptions.Singleline);
            string subtype = point.Key;
            string request = point.Value;

            LSender.Send(this, $"`{ToString()}`: subtype - `{subtype}`, request - `{request}`", MsgLevel.Trace);

            IPM pm = new PM(request, emsbuild);

            if (pm.IsData("get"))
            {
                return(StGet(pm));
            }
            if (pm.IsData("call", "out", "scall", "sout", "cmd"))
            {
                return(StCallFamily(pm));
            }
            if (pm.IsData("write", "append", "writeLine", "appendLine"))
            {
                return(StWriteFamily(pm));
            }
            if (pm.IsData("replace"))
            {
                return(StReplace(pm));
            }
            if (pm.IsData("exists"))
            {
                return(StExists(pm));
            }
            if (pm.IsData("remote"))
            {
                return(StRemote(pm));
            }
            if (pm.IsData("copy"))
            {
                return(StCopy(pm));
            }
            if (pm.IsData("delete"))
            {
                return(StDelete(pm));
            }

            throw new IncorrectNodeException(pm);
        }