Beispiel #1
0
 public void SetContent(IEnumerable <KeyValuePair <string, string> > lines)
 {
     sectionLines       = new List <string> (lines.Select(p => p.Key + " = " + p.Value));
     properties         = null;
     nestedPropertySets = null;
 }
Beispiel #2
0
        void LoadProjectConfigurationMappings(SlnPropertySetCollection sets, Solution sln, Dictionary <string, SolutionFolderItem> items, ProgressMonitor monitor)
        {
            if (sets == null)
            {
                return;
            }

            Dictionary <string, SolutionConfigurationEntry> cache = new Dictionary <string, SolutionConfigurationEntry> ();
            Dictionary <string, string> ignoredProjects           = new Dictionary <string, string> ();

            foreach (var pset in sets)
            {
                var projGuid = pset.Id;

                if (!items.ContainsKey(projGuid))
                {
                    if (ignoredProjects.ContainsKey(projGuid))
                    {
                        // already warned
                        continue;
                    }

                    LoggingService.LogWarning(GettextCatalog.GetString("{0} ({1}) : Project with guid = '{2}' not found or not loaded. Ignoring",
                                                                       sln.FileName, pset.Line + 1, projGuid));
                    ignoredProjects [projGuid] = projGuid;
                    continue;
                }

                SolutionFolderItem it;
                if (!items.TryGetValue(projGuid, out it))
                {
                    continue;
                }

                SolutionItem item = it as SolutionItem;

                if (item == null || !item.SupportsConfigurations())
                {
                    continue;
                }

                //Format:
                // {projectGuid}.SolutionConfigName|SolutionPlatform.ActiveCfg = ProjConfigName|ProjPlatform
                // {projectGuid}.SolutionConfigName|SolutionPlatform.Build.0 = ProjConfigName|ProjPlatform
                // {projectGuid}.SolutionConfigName|SolutionPlatform.Deploy.0 = ProjConfigName|ProjPlatform

                foreach (var prop in pset)
                {
                    string action;
                    string projConfig = prop.Value;

                    string left = prop.Key;
                    if (left.EndsWith(".ActiveCfg"))
                    {
                        action = "ActiveCfg";
                        left   = left.Substring(0, left.Length - 10);
                    }
                    else if (left.EndsWith(".Build.0"))
                    {
                        action = "Build.0";
                        left   = left.Substring(0, left.Length - 8);
                    }
                    else if (left.EndsWith(".Deploy.0"))
                    {
                        action = "Deploy.0";
                        left   = left.Substring(0, left.Length - 9);
                    }
                    else
                    {
                        LoggingService.LogWarning(GettextCatalog.GetString("{0} ({1}) : Unknown action. Only ActiveCfg, Build.0 and Deploy.0 supported.",
                                                                           sln.FileName, pset.Line));
                        continue;
                    }

                    string slnConfig = left;

                    string key = projGuid + "." + slnConfig;
                    SolutionConfigurationEntry combineConfigEntry = null;
                    if (cache.ContainsKey(key))
                    {
                        combineConfigEntry = cache [key];
                    }
                    else
                    {
                        combineConfigEntry       = GetConfigEntry(sln, item, slnConfig);
                        combineConfigEntry.Build = false;                         // Not buildable by default. Build will be enabled if a Build.0 entry is found
                        cache [key] = combineConfigEntry;
                    }

                    /* If both ActiveCfg & Build.0 entries are missing
                     * for a project, then default values :
                     *	ActiveCfg : same as the solution config
                     *	Build : true
                     *
                     * ELSE
                     * if Build (true/false) for the project will
                     * will depend on presence/absence of Build.0 entry
                     */

                    if (action == "ActiveCfg")
                    {
                        combineConfigEntry.ItemConfiguration = FromSlnConfigurationId(projConfig);
                    }
                    else if (action == "Build.0")
                    {
                        combineConfigEntry.Build = true;
                    }
                    else if (action == "Deploy.0")
                    {
                        combineConfigEntry.Deploy = true;
                    }
                }
            }
        }
Beispiel #3
0
 public void Clear()
 {
     properties         = null;
     nestedPropertySets = null;
     sectionLines       = null;
 }