Ejemplo n.º 1
0
        void BuildFunctions(XmlDocument doc)
        {
            events.Clear();
            functions.Clear();

            XmlNodeList evts = doc.SelectNodes("//project/events/event");


            foreach (XmlNode n in evts)
            {
                string name = "";
                try
                {
                    name = n.Attributes.GetNamedItem("name").Value;
                    string code = n.InnerText;
                    events.Add(CLL.FunctionBuilder.BuildFunction(this, name, code));
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in event " + name + ":" + ex.Message);
                }
            }

            evts = doc.SelectNodes("//project/routines/routine");

            foreach (XmlNode n in evts)
            {
                CLL.FunctionBuilder fb = new CLL.FunctionBuilder();

                string       name = n.Attributes.GetNamedItem("name").Value;
                string       code = n.InnerText;
                CLL.Function f    = CLL.FunctionBuilder.BuildFunction(this, name, code);
                functions.Add(name, f);
            }
        }
Ejemplo n.º 2
0
        void BuildFunctions(XmlDocument doc)
        {
            events.Clear();
            functions.Clear();

            XmlNodeList evts = doc.SelectNodes("//project/events/event");


            foreach (XmlNode n in evts)
            {
                string name = "";
                try
                {
                    name = n.Attributes.GetNamedItem("name").Value;
                    string code = n.InnerText;

                    //preprocess out comments and fail strings

                    code = Preprocess(code);

                    events.Add(CLL.FunctionBuilder.BuildFunction(this, name + "_sub", code));
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in Event or Function " + name, ex);
                }
            }

            evts = doc.SelectNodes("//project/routines/routine");

            foreach (XmlNode n in evts)
            {
                string name = "";
                try
                {
                    CLL.FunctionBuilder fb = new CLL.FunctionBuilder();

                    name = n.Attributes.GetNamedItem("name").Value;
                    string code = n.InnerText;

                    code = Preprocess(code);

                    CLL.Function f = CLL.FunctionBuilder.BuildFunction(this, name, code);
                    functions.Add(name, f);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in function or event " + name, ex);
                }
            }
        }