Exemplo n.º 1
0
        /// <summary>
        /// Finalize the XmlFile table.
        /// </summary>
        /// <param name="tables">The collection of all tables.</param>
        /// <remarks>
        /// Some of the XmlFile table rows are compiler generated from util:EventManifest node
        /// These rows should not be appended to component.
        /// </remarks>
        private void FinalizeXmlFileTable(TableCollection tables)
        {
            Table xmlFileTable = tables["XmlFile"];
            Table eventManifestTable = tables["EventManifest"];

            if (null != xmlFileTable)
            {
                foreach (Row row in xmlFileTable.Rows)
                {
                    bool bManifestGenerated = false;
                    string xmlFileConfigId = (string)row[0];
                    if (null != eventManifestTable)
                    {
                        foreach (Row emrow in eventManifestTable.Rows)
                        {
                            string formattedFile = (string)emrow[1];
                            if ((formattedFile.StartsWith("[#", StringComparison.Ordinal) || formattedFile.StartsWith("[!", StringComparison.Ordinal))
                                && formattedFile.EndsWith("]", StringComparison.Ordinal))
                            {
                                string fileId = formattedFile.Substring(2, formattedFile.Length - 3);
                                if (String.Equals(String.Concat("Config_", fileId, "ResourceFile"), xmlFileConfigId))
                                {
                                    Util.EventManifest eventManifest = (Util.EventManifest)this.Core.GetIndexedElement(emrow);
                                    if (null != eventManifest)
                                    {
                                        eventManifest.ResourceFile = (string)row[4];
                                    }
                                    bManifestGenerated = true;
                                }
                                
                                else if (String.Equals(String.Concat("Config_", fileId, "MessageFile"), xmlFileConfigId))
                                {
                                    Util.EventManifest eventManifest = (Util.EventManifest)this.Core.GetIndexedElement(emrow);
                                    if (null != eventManifest)
                                    {
                                        eventManifest.MessageFile = (string)row[4];
                                    }
                                    bManifestGenerated = true;
                                }
                            }
                        }
                    }

                    if (true == bManifestGenerated)
                        continue;
                    
                    Util.XmlFile xmlFile = new Util.XmlFile();

                    xmlFile.Id = (string)row[0];
                    xmlFile.File = (string)row[1];
                    xmlFile.ElementPath = (string)row[2];

                    if (null != row[3])
                    {
                        xmlFile.Name = (string)row[3];
                    }

                    if (null != row[4])
                    {
                        xmlFile.Value = (string)row[4];
                    }

                    int flags = (int)row[5];
                    if (0x1 == (flags & 0x1) && 0x2 == (flags & 0x2))
                    {
                        this.Core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, xmlFileTable.Name, row.Fields[5].Column.Name, row[5]));
                    }
                    else if (0x1 == (flags & 0x1))
                    {
                        xmlFile.Action = Util.XmlFile.ActionType.createElement;
                    }
                    else if (0x2 == (flags & 0x2))
                    {
                        xmlFile.Action = Util.XmlFile.ActionType.deleteValue;
                    }
                    else
                    {
                        xmlFile.Action = Util.XmlFile.ActionType.setValue;
                    }

                    if (0x100 == (flags & 0x100))
                    {
                        xmlFile.SelectionLanguage = Util.XmlFile.SelectionLanguageType.XPath;
                    }

                    if (0x00001000 == (flags & 0x00001000))
                    {
                        xmlFile.PreserveModifiedDate = Util.YesNoType.yes;
                    }

                    if (0x00010000 == (flags & 0x00010000))
                    {
                        xmlFile.Permanent = Util.YesNoType.yes;
                    }

                    if (null != row[7])
                    {
                        xmlFile.Sequence = (int)row[7];
                    }

                    Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[6]);

                    if (null != component)
                    {
                        component.AddChild(xmlFile);
                    }
                    else
                    {
                        this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, xmlFileTable.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "Component_", (string)row[6], "Component"));
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Decompile the XmlFile table.
        /// </summary>
        /// <param name="table">The table to decompile.</param>
        private void DecompileXmlFileTable(Table table)
        {
            foreach (Row row in table.Rows)
            {
                Util.XmlFile xmlFile = new Util.XmlFile();

                xmlFile.Id = (string)row[0];

                xmlFile.File = (string)row[1];

                xmlFile.ElementPath = (string)row[2];

                if (null != row[3])
                {
                    xmlFile.Name = (string)row[3];
                }

                if (null != row[4])
                {
                    xmlFile.Value = (string)row[4];
                }

                int flags = (int)row[5];
                if (0x1 == (flags & 0x1) && 0x2 == (flags & 0x2))
                {
                    this.Core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5]));
                }
                else if (0x1 == (flags & 0x1))
                {
                    xmlFile.Action = Util.XmlFile.ActionType.createElement;
                }
                else if (0x2 == (flags & 0x2))
                {
                    xmlFile.Action = Util.XmlFile.ActionType.deleteValue;
                }
                else
                {
                    xmlFile.Action = Util.XmlFile.ActionType.setValue;
                }

                if (0x00010000 == (flags & 0x00010000))
                {
                    xmlFile.Permanent = Util.YesNoType.yes;
                }

                if (null != row[7])
                {
                    xmlFile.Sequence = (int)row[7];
                }

                Wix.Component component = (Wix.Component) this.Core.GetIndexedElement("Component", (string)row[6]);

                if (null != component)
                {
                    component.AddChild(xmlFile);
                }
                else
                {
                    this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerCore.PrimaryKeyDelimiter), "Component_", (string)row[6], "Component"));
                }
            }
        }