Esempio n. 1
0
        // triage found actions and see which ones are runnable
        // cls = object from which to get any needed values from, can be null
        // if se is set passed enabled string expansion of arguments in condition of event..

        public int CheckActions(List <Actions.ActionFileList.MatchingSets> ale, Object cls, ConditionVariables othervars,
                                ConditionFunctions se = null)
        {
            ConditionVariables valuesneeded = new ConditionVariables();

            if (cls != null)
            {
                foreach (MatchingSets ae in ale)                   // for all files
                {
                    foreach (ConditionLists.Condition fe in ae.cl) // find all values needed
                    {
                        fe.IndicateValuesNeeded(ref valuesneeded);
                    }
                }

                valuesneeded.GetValuesIndicated(cls);     // get the values needed for the conditions
            }

            valuesneeded.Add(othervars);

            int progs = 0;

            ConditionFunctions cf = new ConditionFunctions(valuesneeded, null);

            foreach (MatchingSets ae in ale)       // for all files
            {
                string errlist = null;
                ae.passed = new List <ConditionLists.Condition>();

                //System.Diagnostics.Debug.WriteLine("Check `" + ae.af.name + ae.af.actionfieldfilter.ToString() + "`");
                //ActionData.DumpVars(valuesneeded, " Test var:");

                ae.af.actionfieldfilter.CheckConditions(ae.cl, valuesneeded, out errlist, ae.passed, cf);   // indicate which ones passed
                progs += ae.passed.Count;
            }

            return(progs);
        }