Example #1
0
        public static List <ActionScript> FromXml(XmlNode actionScriptsNode)
        {
            List <ActionScript> scripts = new List <ActionScript>();

            if (actionScriptsNode != null)
            {
                foreach (XmlNode actionScriptNode in actionScriptsNode.SelectNodes("actionScript"))
                {
                    try
                    {
                        ActionScript script = new ActionScript();
                        //script.Id = actionScriptNode.ReadXmlElementAttr("id", "");
                        script.Name                      = actionScriptNode.ReadXmlElementAttr("name", "");
                        script.ScriptType                = ScriptTypeConverter.FromString(actionScriptNode.ReadXmlElementAttr("type", "dos"));
                        script.Description               = actionScriptNode.ReadXmlElementAttr("description", "");
                        script.WindowSizeStyle           = WindowSizeStyleConverter.FromString(actionScriptNode.ReadXmlElementAttr("windowStyle", "normal"));
                        script.RunAdminMode              = actionScriptNode.ReadXmlElementAttr("adminMode", false);
                        script.IsErrorCorrectiveScript   = actionScriptNode.ReadXmlElementAttr("correctiveErrorScript", false);
                        script.IsWarningCorrectiveScript = actionScriptNode.ReadXmlElementAttr("correctiveWarningScript", false);
                        script.IsRestorationScript       = actionScriptNode.ReadXmlElementAttr("restorationScript", false);
                        //XmlNode parametersNode = actionScriptNode.SelectSingleNode("parameters");
                        //if (parametersNode != null)
                        //{
                        //    script.Parameters = ScriptParameter.FromXml(parametersNode);
                        //}

                        script.Script = actionScriptNode.InnerText;
                        scripts.Add(script);
                    }
                    catch { }
                }
            }
            return(scripts);
        }
Example #2
0
        public static List <ActionScript> FromXml(string config)
        {
            List <ActionScript> scripts = new List <ActionScript>();

            if (config != null && config.Trim().Length > 0)
            {
                XmlDocument configXml = new XmlDocument();
                configXml.LoadXml(config);
                XmlElement root = configXml.DocumentElement;
                foreach (XmlNode scriptItem in root.SelectNodes("script"))
                {
                    try
                    {
                        ActionScript script = new ActionScript();
                        script.Name            = scriptItem.ReadXmlElementAttr("name", "");
                        script.ScriptType      = ScriptTypeConverter.FromString(scriptItem.ReadXmlElementAttr("type", "dos"));
                        script.Description     = scriptItem.ReadXmlElementAttr("description", "");
                        script.WindowSizeStyle = WindowSizeStyleConverter.FromString(scriptItem.ReadXmlElementAttr("windowStyle", "normal"));
                        script.RunAdminMode    = scriptItem.ReadXmlElementAttr("adminMode", false);
                        script.Script          = scriptItem.InnerText;
                        scripts.Add(script);
                    }
                    catch { }
                }
            }
            return(scripts);
        }