Exemplo n.º 1
0
        internal void Init(Trigger _trigger, StatementRaw _raw)
        {
            trigger = _trigger;
            m_Raw   = _raw;

            OnCreate();
        }
Exemplo n.º 2
0
            public static StatementRaw Create(XmlElement elem)
            {
                int  cnt       = elem.Attributes.Count;
                bool has_order = elem.HasAttribute("order");

                StatementRaw raw = new StatementRaw();

                raw.parameters = new ParamRaw(has_order ? cnt - 2 : cnt - 1);

                if (has_order)
                {
                    for (int i = 0; i < cnt; ++i)
                    {
                        if (i == 0)
                        {
                            raw.classname = elem.Attributes[i].Value;
                        }
                        else if (i == 1)
                        {
                            raw.order = XmlConvert.ToInt32(elem.Attributes[i].Value);
                        }
                        else
                        {
                            raw.parameters.Set(i - 2, elem.Attributes[i].Name, System.Uri.UnescapeDataString(elem.Attributes[i].Value));
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < cnt; ++i)
                    {
                        if (i == 0)
                        {
                            raw.classname = elem.Attributes[i].Value;
                        }
                        else
                        {
                            raw.parameters.Set(i - 1, elem.Attributes[i].Name, System.Uri.UnescapeDataString(elem.Attributes[i].Value));
                        }
                    }
                }

                return(raw);
            }
Exemplo n.º 3
0
        internal void FillActionCache(int grp_idx)
        {
            _initActionCache();

            for (int i = 0; i < m_Raw.actions[grp_idx].Length; i++)
            {
                StatementRaw sr = m_Raw.actions[grp_idx][i];

                if (Asm.ActionIsRecyclable(sr.classname))
                {
                    if (m_ActionCache[grp_idx][i] == null)
                    {
                        m_ActionCache[grp_idx][i] = Asm.CreateActionInstance(sr.classname);
                    }

                    if (m_ActionCache[grp_idx][i] != null)
                    {
                        m_ActionCache[grp_idx][i].Init(this, sr);
                    }
                }
            }
        }
Exemplo n.º 4
0
            public static TriggerRaw Create(XmlElement elem)
            {
                TriggerRaw raw = new TriggerRaw();

                raw.name   = System.Uri.UnescapeDataString(elem.Attributes["name"].Value);
                raw.repeat = XmlConvert.ToInt32(elem.Attributes["repeat"].Value);
                if (elem.HasAttribute("multi_threaded"))
                {
                    raw.multiThreaded = (elem.Attributes["multi_threaded"].Value.ToLower()) == "true";
                }
                else
                {
                    raw.multiThreaded = false;
                }
                if (elem.HasAttribute("owner"))
                {
                    raw.owner = System.Uri.UnescapeDataString(elem.Attributes["owner"].Value);
                }
                else
                {
                    raw.owner = "-";
                }

                XmlElement e_elem = elem["EVENTS"];
                XmlElement c_elem = elem["CONDITIONS"];
                XmlElement a_elem = elem["ACTIONS"];

                int ecnt = e_elem.ChildNodes.Count;

                raw.events = new StatementRaw[ecnt];
                for (int i = 0; i < ecnt; ++i)
                {
                    raw.events[i] = StatementRaw.Create(e_elem.ChildNodes[i] as XmlElement);
                }

                int g_cnt = c_elem.ChildNodes.Count;

                raw.conditions = new List <StatementRaw[]> ();
                for (int i = 0; i < g_cnt; ++i)
                {
                    XmlElement     g_elem = c_elem.ChildNodes[i] as XmlElement;
                    int            cnt    = g_elem.ChildNodes.Count;
                    StatementRaw[] stmts  = new StatementRaw[cnt];
                    for (int j = 0; j < cnt; ++j)
                    {
                        stmts[j] = StatementRaw.Create(g_elem.ChildNodes[j] as XmlElement);
                    }
                    raw.conditions.Add(stmts);
                }

                g_cnt       = a_elem.ChildNodes.Count;
                raw.actions = new List <StatementRaw[]> ();
                for (int i = 0; i < g_cnt; ++i)
                {
                    XmlElement     g_elem = a_elem.ChildNodes[i] as XmlElement;
                    int            cnt    = g_elem.ChildNodes.Count;
                    StatementRaw[] stmts  = new StatementRaw[cnt];
                    for (int j = 0; j < cnt; ++j)
                    {
                        stmts[j] = StatementRaw.Create(g_elem.ChildNodes[j] as XmlElement);
                    }
                    raw.actions.Add(stmts);
                }

                return(raw);
            }