コード例 #1
0
        private void LoadProducts(XmlNode xmlNode, ODTAdd addItem)
        {
            var products = xmlNode.SelectNodes("./Product");

            foreach (XmlNode productNode in products)
            {
                var product = new ODTProduct();

                if (productNode.Attributes["ID"] != null)
                {
                    var productId = productNode.Attributes["ID"].Value;
                    if (!string.IsNullOrEmpty(productId))
                    {
                        product.ID     = productId;
                        IsLanguagePack = productId.ToLower() == "languagepack";
                    }
                }

                if (addItem.Products == null)
                {
                    addItem.Products = new List <ODTProduct>();
                }

                addItem.Products.Add(product);

                LoadLanguages(productNode, product);

                LoadExcludedApps(productNode, product);
            }
        }
コード例 #2
0
        private void LoadAdds()
        {
            var addNodes = _xmlDoc.DocumentElement.SelectNodes("./Add");

            foreach (XmlNode addNode in addNodes)
            {
                var odtAdd = new ODTAdd();

                if (addNode.Attributes["OfficeClientEdition"] != null)
                {
                    var officeEdition = addNode.Attributes["OfficeClientEdition"].Value;
                    if (officeEdition == "32")
                    {
                        odtAdd.OfficeClientEdition = OfficeClientEdition.Office32Bit;
                    }
                    if (officeEdition == "64")
                    {
                        odtAdd.OfficeClientEdition = OfficeClientEdition.Office64Bit;
                    }
                }

                if (addNode.Attributes["Branch"] != null)
                {
                    var branch = addNode.Attributes["Branch"].Value;
                    if (!string.IsNullOrEmpty(branch))
                    {
                        odtAdd.Branch = (Branch)Enum.Parse(typeof(Branch), branch);
                    }
                }

                if (addNode.Attributes["Channel"] != null)
                {
                    var channel = addNode.Attributes["Channel"].Value;
                    if (!string.IsNullOrEmpty(channel))
                    {
                        if (channel.ToLower() == "business")
                        {
                            channel = "Deferred";
                        }

                        if (channel.ToLower() == "firstreleasebusiness")
                        {
                            channel = "FirstReleaseDeferred";
                        }

                        odtAdd.ODTChannel = (ODTChannel)Enum.Parse(typeof(ODTChannel), channel);
                    }
                }

                odtAdd.SourcePath = null;
                if (addNode.Attributes["SourcePath"] != null)
                {
                    var sourcePath = addNode.Attributes["SourcePath"].Value;
                    if (!string.IsNullOrEmpty(sourcePath))
                    {
                        odtAdd.SourcePath = sourcePath;
                    }
                }

                odtAdd.DownloadPath = null;
                if (addNode.Attributes["DownloadPath"] != null)
                {
                    var downloadPath = addNode.Attributes["DownloadPath"].Value;
                    if (!string.IsNullOrEmpty(downloadPath))
                    {
                        odtAdd.DownloadPath = downloadPath;
                    }
                }

                odtAdd.Version = null;
                if (addNode.Attributes["Version"] != null)
                {
                    var version = addNode.Attributes["Version"].Value;
                    if (!string.IsNullOrEmpty(version))
                    {
                        odtAdd.Version = new Version(version);
                    }
                }

                odtAdd.OfficeMgmtCOM = null;
                if (addNode.Attributes["OfficeMgmtCOM"] != null)
                {
                    var strOfficeMgmtCOM = addNode.Attributes["OfficeMgmtCOM"].Value;
                    if (!string.IsNullOrEmpty(strOfficeMgmtCOM))
                    {
                        try
                        {
                            odtAdd.OfficeMgmtCOM = Convert.ToBoolean(strOfficeMgmtCOM);
                        }
                        catch { }
                    }
                }

                ConfigurationXml.Add = odtAdd;

                LoadProducts(addNode, odtAdd);
            }
        }