Exemple #1
0
        public void AddItem(SolutionItem item, bool createSolutionConfigurations)
        {
            Items.Add(item);

            SolutionEntityItem eitem = item as SolutionEntityItem;

            if (eitem != null && createSolutionConfigurations && eitem.SupportsBuild())
            {
                // Create new solution configurations for item configurations
                foreach (ItemConfiguration iconf in eitem.Configurations)
                {
                    bool found = false;
                    foreach (SolutionConfiguration conf in ParentSolution.Configurations)
                    {
                        if (conf.Name == iconf.Name && (iconf.Platform == conf.Platform || iconf.Platform.Length == 0))
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        SolutionConfiguration sconf = new SolutionConfiguration(iconf.Id);
                        // Add all items to the new configuration
                        foreach (var it in ParentSolution.GetAllSolutionItems <SolutionEntityItem> ())
                        {
                            sconf.AddItem(it);
                        }
                        ParentSolution.Configurations.Add(sconf);
                    }
                }
            }
        }
Exemple #2
0
        void SetupNewItem(SolutionItem item, SolutionItem replacedItem)
        {
            ConvertToSolutionFormat(item, false);

            SolutionEntityItem eitem = item as SolutionEntityItem;

            if (eitem != null)
            {
                eitem.NeedsReload = false;
                if (eitem.SupportsBuild())
                {
                    if (replacedItem == null)
                    {
                        // Register the new entry in every solution configuration
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.AddItem(eitem);
                        }
                        // If there is no startup project or it is an invalid one, use the new project as startup if possible
                        if ((StartupItem == null || !StartupItem.SupportsExecute()) && eitem.SupportsExecute())
                        {
                            StartupItem = eitem;
                        }
                    }
                    else
                    {
                        // Reuse the configuration information of the replaced item
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.ReplaceItem((SolutionEntityItem)replacedItem, eitem);
                        }
                        if (StartupItem == replacedItem)
                        {
                            StartupItem = eitem;
                        }
                        else
                        {
                            int i = MultiStartupItems.IndexOf((SolutionEntityItem)replacedItem);
                            if (i != -1)
                            {
                                MultiStartupItems [i] = eitem;
                            }
                        }
                    }
                }
            }
        }