Esempio n. 1
0
        /// <summary>
        /// Reads the SummaryInformation and creates the Package element.
        /// </summary>
        private void ProcessSummaryInformation()
        {
            using (SummaryInformation summary = new SummaryInformation(this.inputDatabase))
            {
                this.core.Writer.WriteStartElement("Package");
                this.core.OnMessage(WixVerboses.ProcessingSummaryInformation(null, VerboseLevel.Verbose));

                this.core.WriteAttributeString("Id", this.StripBraces(summary.GetProperty(9).ToString())); // PackageCode
                this.core.WriteAttributeString("Keywords", summary.GetProperty(5).ToString()); // package keywords
                this.core.WriteAttributeString("Description", summary.GetProperty(3).ToString()); // description
                this.core.WriteAttributeString("Comments", summary.GetProperty(6).ToString().Trim()); // package comments
                this.core.WriteAttributeString("Manufacturer", summary.GetProperty(4).ToString()); // manufacturer
                this.core.WriteAttributeString("InstallerVersion", summary.GetProperty(14).ToString()); // minimum required installer version
                string[] platformAndLanguage = summary.GetProperty(7).ToString().Split(';');
                if (0 < platformAndLanguage.Length)
                {
                    this.core.WriteAttributeString("Platforms", platformAndLanguage[0]);
                }

                if (1 < platformAndLanguage.Length)
                {
                    this.core.WriteAttributeString("Languages", platformAndLanguage[1]);
                }

                uint sourceFlags = Convert.ToUInt16(summary.GetProperty(15));
                if (0 < (sourceFlags & 1))
                {
                    this.core.WriteAttributeString("ShortNames", "yes");
                }

                if (0 < (sourceFlags & 2))
                {
                    this.core.WriteAttributeString("Compressed", "yes");
                    this.summaryInfoCompressed = true;
                }

                if (0 < (sourceFlags & 4))
                {
                    this.core.WriteAttributeString("AdminImage", "yes");
                }

                if (0 < (sourceFlags & 8))
                {
                    this.core.WriteAttributeString("InstallPrivileges", "limited");
                }
                this.core.WriteAttributeString("SummaryCodepage", summary.GetProperty(1).ToString());

                int security = Convert.ToInt32(summary.GetProperty(19), CultureInfo.InvariantCulture);
                switch (security)
                {
                    case 0:
                        this.core.WriteAttributeString("ReadOnly", "no");
                        break;
                    case 2: // nothing to write; this is the default value
                        break;
                    case 4:
                        this.core.WriteAttributeString("ReadOnly", "yes");
                        break;
                    default: // let the compiler use the default value
                        break;
                }

                this.core.Writer.WriteEndElement();
                summary.Close(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the summary information of a database with the current time.
        /// </summary>
        /// <param name="db">Database to update.</param>
        private void UpdateSummaryInfo(Database db)
        {
            string now = DateTime.Now.ToString(CultureInfo.InvariantCulture);

            using (SummaryInformation summary = new SummaryInformation(db))
            {
                if ("{????????-????-????-????-????????????}" == summary.GetProperty(9).ToString())
                {
                    summary.SetProperty(9, GenerateGuid());
                }
                summary.SetProperty(12, now);
                summary.SetProperty(13, now);
                Version currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                summary.SetProperty(18, String.Format("Windows Installer XML v{0} (candle/light)", currentVersion.ToString()));

                summary.Close(true);
            }
        }