Esempio n. 1
0
        private static ScriptAction ParseXmlAction(XmlElement xmlAction)
        {
            ScriptAction action = null;
            switch (xmlAction.GetAttribute(ScriptConsts.ATTR_TYPE))
            {
                case ScriptConsts.TYPE_TEXT:
                    action = new ScriptTextAction();
                    break;

                case ScriptConsts.TYPE_DATE:
                    action = new ScriptDateAction();
                    break;

                case ScriptConsts.TYPE_LOAD:
                    action = new ScriptLoadAction();
                    break;

                case ScriptConsts.TYPE_DOWNLOAD:
                    action = new ScriptDownloadAction();
                    break;

                case ScriptConsts.TYPE_SAVE:
                    action = new ScriptSaveAction();
                    break;

                case ScriptConsts.TYPE_FIND:
                    action = new ScriptFindAction();
                    break;

                case ScriptConsts.TYPE_REPL:
                    action = new ScriptReplaceAction();
                    break;

                case ScriptConsts.TYPE_SET_VAR:
                    action = new ScriptSetVarAction();
                    break;

                case ScriptConsts.TYPE_GET_VAR:
                    action = new ScriptGetVarAction();
                    break;

                case ScriptConsts.TYPE_NEXT_PAGE:
                    action = new ScriptNextURLAction();
                    break;

            }
            // Устанавливаются свойства действия
            action.Load(xmlAction);

            foreach (XmlNode child in xmlAction.SelectNodes(ScriptConsts.TAG_NAME))
                action.Actions.Add(ParseXmlAction(child as XmlElement));

            return action;
        }
Esempio n. 2
0
        public static ActionTreeNode ParseXmlElement(XmlElement Element)
        {
            ScriptAction action = null;
            switch (Element.GetAttribute(ScriptConsts.ATTR_TYPE))
            {
                case ScriptConsts.TYPE_TEXT:
                    action = new ScriptTextAction();
                    break;

                case ScriptConsts.TYPE_COOK:
                    action = new ScriptCookieAction();
                    break;

                case ScriptConsts.TYPE_DATE:
                    action = new ScriptDateAction();
                    break;

                case ScriptConsts.TYPE_LOAD:
                    action = new ScriptLoadAction();
                    break;

                case ScriptConsts.TYPE_DOWNLOAD:
                    action = new ScriptDownloadAction();
                    break;

                case ScriptConsts.TYPE_SAVE:
                    action = new ScriptSaveAction();
                    break;

                case ScriptConsts.TYPE_FIND:
                    action = new ScriptFindAction();
                    break;

                case ScriptConsts.TYPE_REPL:
                    action = new ScriptReplaceAction();
                    break;

                case ScriptConsts.TYPE_SET_VAR:
                    action = new ScriptSetVarAction();
                    break;

                case ScriptConsts.TYPE_GET_VAR:
                    action = new ScriptGetVarAction();
                    break;

                case ScriptConsts.TYPE_NEXT_PAGE:
                    action = new ScriptNextURLAction();
                    break;

                case ScriptConsts.TYPE_INC:
                    action = new ScriptIncAction();
                    break;

            }
            action.Load(Element);

            action.OnLogMessage += new ActionCallback(LogAction);

            ActionTreeNode node = new ActionTreeNode(action);

            foreach (XmlNode child in Element.SelectNodes(ScriptConsts.TAG_NAME))
                node.Nodes.Add(ParseXmlElement(child as XmlElement));

            return node;
        }