Пример #1
0
        /// <summary>
        /// Called after all output changes occur and right before the output is bound into its final format.
        /// </summary>
        public override void BundleFinalize(Output output)
        {
            this.overallRegid = null; // always reset overall regid on initialize.

            Table tagTable = output.Tables["WixBundleTag"];

            if (null != tagTable)
            {
                Table        table         = output.Tables["WixBundle"];
                WixBundleRow bundleInfo    = (WixBundleRow)table.Rows[0];
                Version      bundleVersion = TagBinder.CreateFourPartVersion(bundleInfo.Version);

                // Try to collect all the software id tags from all the child packages.
                IList <SoftwareTag> allTags = TagBinder.CollectPackageTags(output);

                foreach (Row tagRow in tagTable.Rows)
                {
                    string regid      = (string)tagRow[1];
                    string name       = (string)tagRow[2];
                    bool   licensed   = (null != tagRow[3] && 0 != (int)tagRow[3]);
                    string typeString = (string)tagRow[5];

                    TagType             type          = String.IsNullOrEmpty(typeString) ? TagType.Unknown : (TagType)Enum.Parse(typeof(TagType), typeString);
                    IList <SoftwareTag> containedTags = TagBinder.CalculateContainedTagsAndType(allTags, ref type);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        TagBinder.CreateTagFile(ms, regid, bundleInfo.BundleId.ToString("D").ToUpperInvariant(), bundleInfo.Name, bundleVersion, bundleInfo.Publisher, licensed, type, containedTags);
                        tagRow[4] = Encoding.UTF8.GetString(ms.ToArray());
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Called after all output changes occur and right before the output is bound into its final format.
        /// </summary>
        public override void BundleFinalize(Output output)
        {
            Table tagTable = output.Tables["WixBundleTag"];

            if (null != tagTable)
            {
                Table        table         = output.Tables["WixBundle"];
                WixBundleRow bundleInfo    = (WixBundleRow)table.Rows[0];
                string       bundleId      = bundleInfo.BundleId.ToString("D").ToUpperInvariant();
                Version      bundleVersion = TagBinder.CreateFourPartVersion(bundleInfo.Version);
                string       upgradeCode   = NormalizeGuid(bundleInfo.UpgradeCode);

                string uniqueId = String.Concat("wix:bundle/", bundleId);

                string persistentId = String.Concat("wix:bundle.upgrade/", upgradeCode);

                // Try to collect all the software id tags from all the child packages.
                IList <SoftwareTag> containedTags = TagBinder.CollectPackageTags(output);

                foreach (Row tagRow in tagTable.Rows)
                {
                    string regid = (string)tagRow[1];
                    string name  = (string)tagRow[2];

                    using (MemoryStream ms = new MemoryStream())
                    {
                        TagBinder.CreateTagFile(ms, uniqueId, bundleInfo.Name, bundleVersion, regid, bundleInfo.Publisher, persistentId, containedTags);
                        tagRow[5] = Encoding.UTF8.GetString(ms.ToArray());
                    }
                }
            }
        }