Пример #1
0
        public static InstalledCheck CreateFromXml(XmlElement element)
        {
            if (element.Attributes["type"] == null)
            {
                throw new Exception("Missing installcheck type");
            }

            InstalledCheck l_check;

            if (element.Attributes["type"].InnerText == "check_file")
            {
                l_check = new InstalledCheckFile();
            }
            else if (element.Attributes["type"].InnerText == "check_directory")
            {
                l_check = new InstalledCheckDirectory();
            }
            else if (element.Attributes["type"].InnerText == "check_registry_value")
            {
                l_check = new InstalledCheckRegistry();
            }
            else if (element.Attributes["type"].InnerText == "check_product")
            {
                l_check = new InstalledCheckProduct();
            }
            else
            {
                throw new Exception(string.Format(
                                        "Invalid installcheck type: {0}", element.Attributes["type"].InnerText));
            }

            l_check.FromXml(element);
            return(l_check);
        }
Пример #2
0
        public static InstalledCheck CreateFromXml(XmlElement element)
        {
            if (element.Attributes["type"] == null)
                throw new Exception("Missing installcheck type");

            InstalledCheck l_check;
            if (element.Attributes["type"].InnerText == "check_file")
                l_check = new InstalledCheckFile();
            else if (element.Attributes["type"].InnerText == "check_directory")
                l_check = new InstalledCheckDirectory();
            else if (element.Attributes["type"].InnerText == "check_registry_value")
                l_check = new InstalledCheckRegistry();
            else if (element.Attributes["type"].InnerText == "check_product")
                l_check = new InstalledCheckProduct();
            else
                throw new Exception(string.Format(
                    "Invalid installcheck type: {0}", element.Attributes["type"].InnerText));

            l_check.FromXml(element);
            return l_check;
        }