Exemple #1
0
        internal bool Equals(ProjectRunConfiguration other)
        {
            var dict1 = new Dictionary <string, string> ();
            var dict2 = new Dictionary <string, string> ();

            var thisData = new ProjectItemMetadata();

            Write(thisData);
            GetProps(MainPropertyGroup, dict1);
            GetProps(thisData, dict1);

            var otherData = new ProjectItemMetadata();

            other.Write(otherData);
            GetProps(other.MainPropertyGroup, dict2);
            GetProps(otherData, dict2);

            if (dict1.Count != dict2.Count)
            {
                return(false);
            }
            foreach (var tp in dict1)
            {
                string v;
                if (!dict2.TryGetValue(tp.Key, out v) || tp.Value != v)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #2
0
        internal protected virtual void Read(Project project, IMSBuildItemEvaluated buildItem)
        {
            ItemName           = buildItem.Name;
            Include            = buildItem.Include;
            UnevaluatedInclude = buildItem.UnevaluatedInclude;
            Condition          = buildItem.Condition;
            metadata           = null;

            if (buildItem.SourceItem != null)
            {
                HashSet <string> knownProps = GetKnownMetadata();
                foreach (var prop in buildItem.SourceItem.Metadata.GetProperties())
                {
                    if (!knownProps.Contains(prop.Name))
                    {
                        if (metadata == null)
                        {
                            metadata = new ProjectItemMetadata(project.MSBuildProject);
                        }
                        // Get the evaluated value for the original metadata property
                        var p = new ItemMetadataProperty(prop.Name, buildItem.Metadata.GetValue(prop.Name), prop.UnevaluatedValue);
                        p.ParentProject = project.MSBuildProject;
                        metadata.AddProperty(p);
                    }
                }
                if (metadata != null)
                {
                    metadata.OnLoaded();
                }
            }
            buildItem.Metadata.ReadObjectProperties(this, GetType(), true);
        }
 internal ProjectItemMetadata(ProjectItemMetadata other)
 {
     this.project = other.project;
     if (other.properties != null)
     {
         properties = new Dictionary <string, MSBuildProperty> (other.properties.Count, StringComparer.OrdinalIgnoreCase);
         foreach (var p in other.propertyList)
         {
             var pc = p.Clone();
             propertyList.Add(pc);
             properties [p.Name] = pc;
         }
     }
     initialMetadataCount = other.initialMetadataCount;
 }
Exemple #4
0
 public ProjectOperationContext()
 {
     GlobalProperties = new ProjectItemMetadata();
 }