Esempio n. 1
0
        public void GetPropertyValues()
        {
            foreach (MSBProject project in this.Projects)
            {
                ProjectProperty itemprop = project.GetProperty(this.Name);
                if (itemprop != null)
                {
                    string key = itemprop.EvaluatedValue;
                    if (String.Compare(this.Name, "OutputPath", true) == 0)
                    {
                        key = project.OutputPath;
                    }

                    if (_PropertyValues.ContainsKey(key))
                    {
                        _PropertyValues[key].AddProject(project);
                    }
                    else
                    {
                        _PropertyValues[key] = new ReferencedValues(project)
                        {
                            EvaluatedValue = key, Owner = this
                        };
                    }
                }
            }
        }
Esempio n. 2
0
        public void Remove(ReferencedValues val)
        {
            ReferencedProperty owner = val.Owner;

            owner.Remove(val);
            if (owner.UsedCount == 0)
            {
                _allFoundProperties.Remove(owner.Name);
            }
            // This is a delete, not a move. Do not update the property sheet here.
        }
Esempio n. 3
0
        public void MoveValueAllConfigs(ReferencedValues val)
        {
            ReferencedProperty owner = val.Owner;

            owner.RemoveAllConfigs(val);
            if (owner.UsedCount == 0)
            {
                _allFoundProperties.Remove(owner.Name);
            }
            UpdatePropertySheet(owner.Name, val.EvaluatedValue);
        }
Esempio n. 4
0
        public void RemoveAllConfigs(ReferencedValues val)
        {
            //foreach(MSBProject proj in val.Projects)
            Parallel.ForEach(val.Projects, proj =>
            {
                //Debug.Print("Project: {0}", proj.FullPath);
                // Iterate through all global properties and set the value
                IDictionary <string, List <string> > conProps = proj.ConditionedProperties;
                List <String> configs   = conProps[CONFIG];
                List <String> platforms = conProps[PLATFORM];
                var previousConfig      = proj.GlobalProperties[CONFIG];
                var previousPlatform    = proj.GlobalProperties[PLATFORM];

                foreach (var config in configs)
                {
                    foreach (var platform in platforms)
                    {
                        proj.SetGlobalProperty(CONFIG, config);
                        proj.SetGlobalProperty(PLATFORM, platform);
                        proj.ReevaluateIfNecessary();
                        ProjectProperty p = proj.GetProperty(this.Name);
                        if (p != null &&
                            (!p.IsImported) &&
                            (!p.IsEnvironmentProperty) &&
                            (!p.IsGlobalProperty) &&
                            (!p.IsReservedProperty))
                        {
                            //Debug.Print("\tRemoving {0} for {1}|{2}", this.Name, config, platform);
                            bool removed = proj.RemoveProperty(p);
                            Debug.Assert(removed);
                            proj.MarkDirty();
                            proj.ReevaluateIfNecessary();
                        }
                    }
                }

                proj.SetGlobalProperty(CONFIG, previousConfig);
                proj.SetGlobalProperty(PLATFORM, previousPlatform);
                proj.ReevaluateIfNecessary();
                proj.MarkDirty();
            });

            RemoveProjects(val.Projects);
            string key = val.EvaluatedValue;

            if (_PropertyValues.ContainsKey(key))
            {
                _PropertyValues.Remove(key);
            }
            OnPropertyChanged("PropertyValues");
        }
Esempio n. 5
0
        public void PrintFoundProperties()
        {
            Utils.WL(ConsoleColor.DarkCyan, String.Format("Global Properties: Configuration => {0}", _globalProperties["Configuration"]));
            Utils.WL(ConsoleColor.DarkCyan, String.Format("Global Properties: Platform => {0}", _globalProperties["Platform"]));
            var sorted = from p in _allFoundProperties orderby p.Value.UsedCount descending select p;

            foreach (var pair in sorted)
            {
                ReferencedProperty prop = pair.Value;
                Utils.WL(ConsoleColor.Cyan, String.Format("{0} : {1}", prop.UsedCount, prop.Name));
                var sortedVals = from p in prop.PropertyValues orderby p.Value.Count descending select p;
                foreach (var vp in sortedVals)
                {
                    ReferencedValues val = vp.Value;
                    Utils.WL(ConsoleColor.DarkCyan, String.Format("\t{0} : {1}", val.Count, val.EvaluatedValue));
                }
            }
        }
Esempio n. 6
0
        public void Remove(ReferencedValues val)
        {
            foreach (MSBProject proj in val.Projects)
            {
                ProjectProperty p = proj.GetProperty(this.Name);
                if (p != null && (!p.IsImported))
                {
                    bool removed = proj.RemoveProperty(p);
                    Debug.Assert(removed);
                    proj.MarkDirty();
                }
            }

            RemoveProjects(val.Projects);
            string key = val.EvaluatedValue;

            if (_PropertyValues.ContainsKey(key))
            {
                _PropertyValues.Remove(key);
            }
            OnPropertyChanged("PropertyValues");
        }