Exemplo n.º 1
0
        /// <summary>
        /// Gets an array of matching symbols for a reference.
        /// </summary>
        /// <param name="wixSimpleReferenceRow">Simple references to resolve.</param>
        /// <returns>Symbols if they were found or empty array if the symbols were not found.</returns>
        internal Symbol[] GetSymbolsForSimpleReference(WixSimpleReferenceRow wixSimpleReferenceRow)
        {
            Symbol[] symbols = null;

            try
            {
                Symbol symbol = this[wixSimpleReferenceRow.SymbolicName];

                if (null == symbol)
                {
                    symbols = new Symbol[0];
                }
                else
                {
                    symbols    = new Symbol[1];
                    symbols[0] = symbol;
                }
            }
            catch (DuplicateSymbolsException e)
            {
                symbols = e.GetDuplicateSymbols();
            }

            return(symbols);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new row in the table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <param name="add">Specifies whether to only create the row or add it to the table automatically.</param>
        /// <returns>Row created in table.</returns>
        public Row CreateRow(SourceLineNumberCollection sourceLineNumbers, bool add)
        {
            Row row;

            switch (this.Name)
            {
            case "BBControl":
                row = new BBControlRow(sourceLineNumbers, this);
                break;

            case "ChainMsiPackage":
                row = new ChainMsiPackageRow(sourceLineNumbers, this);
                break;

            case "Component":
                row = new ComponentRow(sourceLineNumbers, this);
                break;

            case "Control":
                row = new ControlRow(sourceLineNumbers, this);
                break;

            case "File":
                row = new FileRow(sourceLineNumbers, this);
                break;

            case "Media":
                row = new MediaRow(sourceLineNumbers, this);
                break;

            case "PayloadInfo":
                row = new PayloadInfoRow(sourceLineNumbers, this);
                break;

            case "Upgrade":
                row = new UpgradeRow(sourceLineNumbers, this);
                break;

            case "Variable":
                row = new VariableRow(sourceLineNumbers, this);
                break;

            case "WixAction":
                row = new WixActionRow(sourceLineNumbers, this);
                break;

            case "WixApprovedExeForElevation":
                row = new WixApprovedExeForElevationRow(sourceLineNumbers, this);
                break;

            case "WixBundle":
                row = new WixBundleRow(sourceLineNumbers, this);
                break;

            case "WixBundlePatchTargetCode":
                row = new WixBundlePatchTargetCodeRow(sourceLineNumbers, this);
                break;

            case "WixBundleUpdate":
                row = new WixBundleUpdateRow(sourceLineNumbers, this);
                break;

            case "WixCatalog":
                row = new WixCatalogRow(sourceLineNumbers, this);
                break;

            case "WixCommandLine":
                row = new WixCommandLineRow(sourceLineNumbers, this);
                break;

            case "WixComplexReference":
                row = new WixComplexReferenceRow(sourceLineNumbers, this);
                break;

            case "WixFile":
                row = new WixFileRow(sourceLineNumbers, this);
                break;

            case "WixMedia":
                row = new WixMediaRow(sourceLineNumbers, this);
                break;

            case "WixMediaTemplate":
                row = new WixMediaTemplateRow(sourceLineNumbers, this);
                break;

            case "WixMerge":
                row = new WixMergeRow(sourceLineNumbers, this);
                break;

            case "WixProperty":
                row = new WixPropertyRow(sourceLineNumbers, this);
                break;

            case "WixSimpleReference":
                row = new WixSimpleReferenceRow(sourceLineNumbers, this);
                break;

            case "WixUpdateRegistration":
                row = new WixUpdateRegistrationRow(sourceLineNumbers, this);
                break;

            case "WixVariable":
                row = new WixVariableRow(sourceLineNumbers, this);
                break;

            default:
                row = new Row(sourceLineNumbers, this);
                break;
            }

            if (add)
            {
                this.rows.Add(row);
            }

            return(row);
        }
Exemplo n.º 3
0
Arquivo: Table.cs Projeto: zooba/wix3
        /// <summary>
        /// Creates a new row in the table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <param name="add">Specifies whether to only create the row or add it to the table automatically.</param>
        /// <returns>Row created in table.</returns>
        public Row CreateRow(SourceLineNumberCollection sourceLineNumbers, bool add)
        {
            Row row;

            switch (this.Name)
            {
                case "BBControl":
                    row = new BBControlRow(sourceLineNumbers, this);
                    break;
                case "ChainMsiPackage":
                    row = new ChainMsiPackageRow(sourceLineNumbers, this);
                    break;
                case "Component":
                    row = new ComponentRow(sourceLineNumbers, this);
                    break;
                case "Control":
                    row = new ControlRow(sourceLineNumbers, this);
                    break;
                case "File":
                    row = new FileRow(sourceLineNumbers, this);
                    break;
                case "Media":
                    row = new MediaRow(sourceLineNumbers, this);
                    break;
                case "PayloadInfo":
                    row = new PayloadInfoRow(sourceLineNumbers, this);
                    break;
                case "Upgrade":
                    row = new UpgradeRow(sourceLineNumbers, this);
                    break;
                case "Variable":
                    row = new VariableRow(sourceLineNumbers, this);
                    break;
                case "WixAction":
                    row = new WixActionRow(sourceLineNumbers, this);
                    break;
                case "WixApprovedExeForElevation":
                    row = new WixApprovedExeForElevationRow(sourceLineNumbers, this);
                    break;
                case "WixBundle":
                    row = new WixBundleRow(sourceLineNumbers, this);
                    break;
                case "WixBundlePatchTargetCode":
                    row = new WixBundlePatchTargetCodeRow(sourceLineNumbers, this);
                    break;
                case "WixBundleUpdate":
                    row = new WixBundleUpdateRow(sourceLineNumbers, this);
                    break;
                case "WixCatalog":
                    row = new WixCatalogRow(sourceLineNumbers, this);
                    break;
                case "WixCommandLine":
                    row = new WixCommandLineRow(sourceLineNumbers, this);
                    break;
                case "WixComplexReference":
                    row = new WixComplexReferenceRow(sourceLineNumbers, this);
                    break;
                case "WixFile":
                    row = new WixFileRow(sourceLineNumbers, this);
                    break;
                case "WixMedia":
                    row = new WixMediaRow(sourceLineNumbers, this);
                    break;
                case "WixMediaTemplate":
                    row = new WixMediaTemplateRow(sourceLineNumbers, this);
                    break;
                case "WixMerge":
                    row = new WixMergeRow(sourceLineNumbers, this);
                    break;
                case "WixProperty":
                    row = new WixPropertyRow(sourceLineNumbers, this);
                    break;
                case "WixSimpleReference":
                    row = new WixSimpleReferenceRow(sourceLineNumbers, this);
                    break;
                case "WixUpdateRegistration":
                    row = new WixUpdateRegistrationRow(sourceLineNumbers, this);
                    break;
                case "WixVariable":
                    row = new WixVariableRow(sourceLineNumbers, this);
                    break;

                default:
                    row = new Row(sourceLineNumbers, this);
                    break;
            }

            if (add)
            {
                this.rows.Add(row);
            }

            return row;
        }
Exemplo n.º 4
0
Arquivo: Linker.cs Projeto: zooba/wix3
        /// <summary>
        /// Resolves the features connected to other features in the active output.
        /// </summary>
        /// <param name="featuresToFeatures">Feature to feature complex references.</param>
        /// <param name="allSymbols">All symbols loaded from the sections.</param>
        private void ResolveFeatureToFeatureConnects(
            ConnectToFeatureCollection featuresToFeatures,
            SymbolCollection allSymbols)
        {
            foreach (ConnectToFeature connection in featuresToFeatures)
            {
                WixSimpleReferenceRow wixSimpleReferenceRow = new WixSimpleReferenceRow(null, this.tableDefinitions["WixSimpleReference"]);
                wixSimpleReferenceRow.TableName = "Feature";
                wixSimpleReferenceRow.PrimaryKeys = connection.ChildId;
                Symbol symbol = allSymbols.GetSymbolForSimpleReference(wixSimpleReferenceRow, this);
                if (null == symbol)
                {
                    continue;
                }

                Row row = symbol.Row;
                row[1] = connection.PrimaryFeature;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new row in the table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <returns>Row created in table.</returns>
        public Row CreateRow(SourceLineNumberCollection sourceLineNumbers)
        {
            Row row;

            switch (this.Name)
            {
            case "BBControl":
                row = new BBControlRow(sourceLineNumbers, this);
                break;

            case "Control":
                row = new ControlRow(sourceLineNumbers, this);
                break;

            case "File":
                row = new FileRow(sourceLineNumbers, this);
                break;

            case "Media":
                row = new MediaRow(sourceLineNumbers, this);
                break;

            case "Upgrade":
                row = new UpgradeRow(sourceLineNumbers, this);
                break;

            case "WixAction":
                row = new WixActionRow(sourceLineNumbers, this);
                break;

            case "WixComplexReference":
                row = new WixComplexReferenceRow(sourceLineNumbers, this);
                break;

            case "WixFile":
                row = new WixFileRow(sourceLineNumbers, this);
                break;

            case "WixMedia":
                row = new WixMediaRow(sourceLineNumbers, this);
                break;

            case "WixMerge":
                row = new WixMergeRow(sourceLineNumbers, this);
                break;

            case "WixProperty":
                row = new WixPropertyRow(sourceLineNumbers, this);
                break;

            case "WixSimpleReference":
                row = new WixSimpleReferenceRow(sourceLineNumbers, this);
                break;

            case "WixVariable":
                row = new WixVariableRow(sourceLineNumbers, this);
                break;

            default:
                row = new Row(sourceLineNumbers, this);
                break;
            }

            this.rows.Add(row);

            return(row);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the symbol for a reference.
        /// </summary>
        /// <param name="wixSimpleReferenceRow">Simple references to resolve.</param>
        /// <param name="messageHandler">Message handler to report errors through.</param>
        /// <returns>Symbol if it was found or null if the symbol was not specified.</returns>
        internal Symbol GetSymbolForSimpleReference(WixSimpleReferenceRow wixSimpleReferenceRow, IMessageHandler messageHandler)
        {
            Symbol symbol = null;

            try
            {
                symbol = this[wixSimpleReferenceRow.SymbolicName];
            }
            catch (DuplicateSymbolsException e)
            {
                Hashtable uniqueSourceLineNumbers = new Hashtable();
                Symbol[]  duplicateSymbols        = e.GetDuplicateSymbols();
                Debug.Assert(1 < duplicateSymbols.Length);

                // index the row source line numbers to determine how many are unique
                foreach (Symbol duplicateSymbol in duplicateSymbols)
                {
                    if (null != duplicateSymbol.Row && null != duplicateSymbol.Row.SourceLineNumbers)
                    {
                        uniqueSourceLineNumbers[duplicateSymbol.Row.SourceLineNumbers] = null;
                    }
                }

                // if only 1 unique source line number was found, switch to the section source line numbers
                // (sections use the file name of the intermediate, library, or extension they came from)
                if (1 >= uniqueSourceLineNumbers.Count)
                {
                    uniqueSourceLineNumbers.Clear();

                    foreach (Symbol duplicateSymbol in duplicateSymbols)
                    {
                        if (null != duplicateSymbol.Section.SourceLineNumbers)
                        {
                            uniqueSourceLineNumbers[duplicateSymbol.Section.SourceLineNumbers] = null;
                        }
                    }
                }

                // display errors for the unique source line numbers
                bool displayedFirstError = false;
                foreach (SourceLineNumberCollection sourceLineNumbers in uniqueSourceLineNumbers.Keys)
                {
                    if (!displayedFirstError)
                    {
                        messageHandler.OnMessage(WixErrors.DuplicateSymbol(sourceLineNumbers, duplicateSymbols[0].Name));
                        displayedFirstError = true;
                    }
                    else
                    {
                        messageHandler.OnMessage(WixErrors.DuplicateSymbol2(sourceLineNumbers));
                    }
                }

                // display an error, even if no source line information was found
                if (!displayedFirstError)
                {
                    messageHandler.OnMessage(WixErrors.DuplicateSymbol(null, duplicateSymbols[0].Name));
                }
            }

            return(symbol);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Creates an object that ties simple references to their section.
 /// </summary>
 /// <param name="section">Section that owns the simple reference.</param>
 /// <param name="wixSimpleReferenceRow">The simple reference in the section.</param>
 public SimpleReferenceSection(Section section, WixSimpleReferenceRow wixSimpleReferenceRow)
 {
     this.Section = section;
     this.WixSimpleReferenceRow = wixSimpleReferenceRow;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Gets an array of matching symbols for a reference.
        /// </summary>
        /// <param name="wixSimpleReferenceRow">Simple references to resolve.</param>
        /// <returns>Symbols if they were found or empty array if the symbols were not found.</returns>
        internal Symbol[] GetSymbolsForSimpleReference(WixSimpleReferenceRow wixSimpleReferenceRow)
        {
            Symbol[] symbols = null;

            try
            {
                Symbol symbol = this[wixSimpleReferenceRow.SymbolicName];

                if (null == symbol)
                {
                    symbols = new Symbol[0];
                }
                else
                {
                    symbols = new Symbol[1];
                    symbols[0] = symbol;
                }
            }
            catch (DuplicateSymbolsException e)
            {
                symbols = e.GetDuplicateSymbols();
            }

            return symbols;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the symbol for a reference.
        /// </summary>
        /// <param name="wixSimpleReferenceRow">Simple references to resolve.</param>
        /// <param name="messageHandler">Message handler to report errors through.</param>
        /// <returns>Symbol if it was found or null if the symbol was not specified.</returns>
        internal Symbol GetSymbolForSimpleReference(WixSimpleReferenceRow wixSimpleReferenceRow, IMessageHandler messageHandler)
        {
            Symbol symbol = null;

            try
            {
                symbol = this[wixSimpleReferenceRow.SymbolicName];
            }
            catch (DuplicateSymbolsException e)
            {
                Hashtable uniqueSourceLineNumbers = new Hashtable();
                Symbol[] duplicateSymbols = e.GetDuplicateSymbols();
                Debug.Assert(1 < duplicateSymbols.Length);

                // index the row source line numbers to determine how many are unique
                foreach (Symbol duplicateSymbol in duplicateSymbols)
                {
                    if (null != duplicateSymbol.Row && null != duplicateSymbol.Row.SourceLineNumbers)
                    {
                        uniqueSourceLineNumbers[duplicateSymbol.Row.SourceLineNumbers] = null;
                    }
                }

                // if only 1 unique source line number was found, switch to the section source line numbers
                // (sections use the file name of the intermediate, library, or extension they came from)
                if (1 >= uniqueSourceLineNumbers.Count)
                {
                    uniqueSourceLineNumbers.Clear();

                    foreach (Symbol duplicateSymbol in duplicateSymbols)
                    {
                        if (null != duplicateSymbol.Section.SourceLineNumbers)
                        {
                            uniqueSourceLineNumbers[duplicateSymbol.Section.SourceLineNumbers] = null;
                        }
                    }
                }

                // display errors for the unique source line numbers
                bool displayedFirstError = false;
                foreach (SourceLineNumberCollection sourceLineNumbers in uniqueSourceLineNumbers.Keys)
                {
                    if (!displayedFirstError)
                    {
                        messageHandler.OnMessage(WixErrors.DuplicateSymbol(sourceLineNumbers, duplicateSymbols[0].Name));
                        displayedFirstError = true;
                    }
                    else
                    {
                        messageHandler.OnMessage(WixErrors.DuplicateSymbol2(sourceLineNumbers));
                    }
                }

                // display an error, even if no source line information was found
                if (!displayedFirstError)
                {
                    messageHandler.OnMessage(WixErrors.DuplicateSymbol(null, duplicateSymbols[0].Name));
                }
            }

            return symbol;
        }
Exemplo n.º 10
0
 /// <summary>
 /// Creates an object that ties simple references to their section.
 /// </summary>
 /// <param name="section">Section that owns the simple reference.</param>
 /// <param name="wixSimpleReferenceRow">The simple reference in the section.</param>
 public SimpleReferenceSection(Section section, WixSimpleReferenceRow wixSimpleReferenceRow)
 {
     this.Section = section;
     this.WixSimpleReferenceRow = wixSimpleReferenceRow;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Creates a new row in the table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <returns>Row created in table.</returns>
        public Row CreateRow(SourceLineNumberCollection sourceLineNumbers)
        {
            Row row;

            switch (this.Name)
            {
                case "BBControl":
                    row = new BBControlRow(sourceLineNumbers, this);
                    break;
                case "ChainMsiPackage":
                    row = new ChainMsiPackageRow(sourceLineNumbers, this);
                    break;
                case "Component":
                    row = new ComponentRow(sourceLineNumbers, this);
                    break;
                case "Control":
                    row = new ControlRow(sourceLineNumbers, this);
                    break;
                case "File":
                    row = new FileRow(sourceLineNumbers, this);
                    break;
                case "Media":
                    row = new MediaRow(sourceLineNumbers, this);
                    break;
                case "PayloadInfo":
                    row = new PayloadInfoRow(sourceLineNumbers, this);
                    break;
                case "Upgrade":
                    row = new UpgradeRow(sourceLineNumbers, this);
                    break;
                case "WixAction":
                    row = new WixActionRow(sourceLineNumbers, this);
                    break;
                case "WixComplexReference":
                    row = new WixComplexReferenceRow(sourceLineNumbers, this);
                    break;
                case "WixFile":
                    row = new WixFileRow(sourceLineNumbers, this);
                    break;
                case "WixMedia":
                    row = new WixMediaRow(sourceLineNumbers, this);
                    break;
                case "WixMediaTemplate":
                    row = new WixMediaTemplateRow(sourceLineNumbers, this);
                    break;
                case "WixMerge":
                    row = new WixMergeRow(sourceLineNumbers, this);
                    break;
                case "WixProperty":
                    row = new WixPropertyRow(sourceLineNumbers, this);
                    break;
                case "WixSimpleReference":
                    row = new WixSimpleReferenceRow(sourceLineNumbers, this);
                    break;
                case "WixVariable":
                    row = new WixVariableRow(sourceLineNumbers, this);
                    break;

                default:
                    row = new Row(sourceLineNumbers, this);
                    break;
            }

            this.rows.Add(row);

            return row;
        }