public static InstallationOptions FromXml(XmlReader reader)
        {
            InstallationOptions options = new InstallationOptions();
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (reader.Name == Resources.InstallInOrder)
                            options.InstallInOrder = true;
                        else if (reader.Name == Resources.Proxy)
                        {
                            options.ProxyOptions = ProxyOptions.FromXml(reader);
                            options.XmlErrors.AddRange(options.ProxyOptions.XmlErrors);
                        }
                        else if (reader.Name == Resources.SilentInstall)
                        {
                            options.SilentInstall = true;
                        }
                        else if (reader.Name == Resources.SimultaneousDownloads)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                options.SimultaneousDownloads = int.Parse(reader.ReadString());
                                reader.ReadEndElement();
                            }
                        }
                        else if (reader.Name == Resources.InstallationRoot)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                options.InstallationRoot = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        else if (reader.Name == Resources.AlternateDownloadLocation)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                options.AlternateDownloadLocation = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        else
                            options.XmlErrors.Add(
                                String.Format("{0}: \"{1}\"", Resources.AppListXmlUnknown, reader.Name));
                        break;

                    case XmlNodeType.EndElement:
                        // Only stop reading when we've hit the end of the InstallationOptions element
                        if (reader.Name == Resources.InstallationOptions)
                            return options;
                        break;
                }

            }
            return options;
        }
        public static InstallationOptions FromXml(XmlReader reader)
        {
            InstallationOptions options = new InstallationOptions();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    if (reader.Name == Resources.InstallInOrder)
                    {
                        options.InstallInOrder = true;
                    }
                    else if (reader.Name == Resources.Proxy)
                    {
                        options.ProxyOptions = ProxyOptions.FromXml(reader);
                        options.XmlErrors.AddRange(options.ProxyOptions.XmlErrors);
                    }
                    else if (reader.Name == Resources.SilentInstall)
                    {
                        options.SilentInstall = true;
                    }
                    else if (reader.Name == Resources.SimultaneousDownloads)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            options.SimultaneousDownloads = int.Parse(reader.ReadString());
                            reader.ReadEndElement();
                        }
                    }
                    else if (reader.Name == Resources.InstallationRoot)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            options.InstallationRoot = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    else if (reader.Name == Resources.AlternateDownloadLocation)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            options.AlternateDownloadLocation = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    else
                    {
                        options.XmlErrors.Add(
                            String.Format("{0}: \"{1}\"", Resources.AppListXmlUnknown, reader.Name));
                    }
                    break;

                case XmlNodeType.EndElement:
                    // Only stop reading when we've hit the end of the InstallationOptions element
                    if (reader.Name == Resources.InstallationOptions)
                    {
                        return(options);
                    }
                    break;
                }
            }
            return(options);
        }