Esempio n. 1
0
 /// <summary>
 /// Adds a line in the <see cref="PropertyLines"/>.
 /// </summary>
 /// <param name="p">The line to add.</param>
 public void AddPropertyLine(PropertyLine p)
 {
     _propertyLines.Add(p.Name, p);
     _container.Solution.SetDirtyStructure(true);
 }
Esempio n. 2
0
 /// <summary>
 /// Adds a new line in <see cref="VersionControlLines"/>.
 /// </summary>
 /// <param name="p">The new line.</param>
 public void AddVersionControl(PropertyLine p)
 {
     _platformConfigurationProperties.Add(p.Name, p);
     Solution.SetDirtyStructure(true);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds a new project configuration entry in <see cref="ProjectConfigurationPlatformsLines"/>.
 /// </summary>
 /// <param name="p"></param>
 public void AddProjectConfigurationPlatform(PropertyLine p)
 {
     _platformConfigurationProperties.Add(p.Name, p);
     Solution.SetDirtyStructure(true);
 }
Esempio n. 4
0
        static Section HandleVersionControlLines(SolutionFile s, Reader r, string name, string step, Dictionary <string, PropertyLine> propertyLines)
        {
            var propertyLinesByIndex = new Dictionary <int, List <PropertyLine> >();

            foreach (var prop in propertyLines.Values)
            {
                var match = _rParseVersionControlName.Match(prop.Name);
                if (match.Success)
                {
                    var nameWithoutIndex = match.Groups["NAME_WITHOUT_INDEX"].Value.Trim();
                    var index            = int.Parse(match.Groups["INDEX"].Value.Trim());
                    if (!propertyLinesByIndex.TryGetValue(index, out var list))
                    {
                        propertyLinesByIndex[index] = list = new List <PropertyLine>();
                    }
                    propertyLinesByIndex[index].Add(new PropertyLine(nameWithoutIndex, prop.Value));
                    propertyLines.Remove(prop.Name);
                }
                else
                {
                    // Skips SccNumberOfProjects since this is a computed value.
                    if (prop.Name == "SccNumberOfProjects")
                    {
                        propertyLines.Remove(prop.Name);
                    }
                }
            }

            // Handle the special case for the solution itself.
            if (!propertyLines.TryGetValue("SccLocalPath0", out var localPath) ||
                localPath.Value != ".")
            {
                propertyLines["SccLocalPath0"] = new PropertyLine("SccLocalPath0", ".");
            }

            foreach (var item in propertyLinesByIndex)
            {
                var index = item.Key;
                var propertiesForIndex = item.Value;

                var uniqueNameProperty = propertiesForIndex.Find(property => property.Name == "SccProjectUniqueName");

                // If there is no ProjectUniqueName, we assume that it's the entry related to the solution by itself. We
                // can ignore it because we added the special case above.
                if (uniqueNameProperty != null)
                {
                    var uniqueName = _rConvertEscapedValues.Replace(uniqueNameProperty.Value, match =>
                    {
                        var hexaValue = int.Parse(match.Groups["HEXACODE"].Value, NumberStyles.AllowHexSpecifier);
                        return(char.ConvertFromUtf32(hexaValue));
                    });
                    uniqueName = uniqueName.Replace(@"\\", @"\");

                    Project relatedProject = null;
                    foreach (var project in s.Projects)
                    {
                        if (string.Compare(project.SolutionRelativePath, uniqueName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            relatedProject = project;
                        }
                    }
                    if (relatedProject == null)
                    {
                        r.Monitor.Fatal($"Invalid value for the property 'SccProjectUniqueName{index}' of the global section '{name}'. Found: {uniqueName}. Expected: A value equal to the field 'RelativePath' of one of the projects in the solution (that is not a Solution folder).");
                        return(null);
                    }
                    foreach (var p in propertiesForIndex)
                    {
                        relatedProject.AddVersionControl(p);
                    }
                }
            }

            return(new Section(s, name, step, propertyLines));
        }