Пример #1
0
        public static dynamic INVOKE(Function func, params object[] inputs)
        {
            if (!Accessibility.IsAccess(MCL.EnvironmentAccess, func.Access))
            {
                throw new MethodAccessException("You not access to this function");
            }
            if (inputs == null)
            {
                inputs = new object[0];
            }
            string nam    = nameof(VARIABLE).ToLower();
            int    length = Math.Min(func.Inputs.Length, inputs.Length);

            for (int i = 0; i < func.Inputs.Length; i++)
            {
                if (func.Inputs[i].ToLower().StartsWith(nam))
                {
                    MCL.Parse(func.Inputs[i]);
                    if (inputs.Length > i)
                    {
                        MCL.SetVar(func.Inputs[i].Substring(nam.Length).Split('=')[0].Trim(), inputs[i]);
                    }
                }
                else
                {
                    MCL.AddVar(func.Inputs[i], (inputs.Length > i) ? inputs[i] : Null);
                }
            }
            return(MCL.Parser(func.Commands));
        }
Пример #2
0
        public virtual MiMFa_List <object> each(string def, dynamic collection, string cmd)
        {
            MiMFa_List <object> result = new MiMFa_List <object>();

            MCL.PushAccess();
            MCL.Parse(def);
            string name = def.Trim().Split(' ').Last().Trim();

            foreach (var item in collection)
            {
                if (breakrun-- != 0)
                {
                    break;
                }
                MCL.SetVar(name, item);
                object str = echo(cmd);
                curr = str;
                result.Add(str);
            }
            MCL.PopRemoveAccess();
            return(result);
        }