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)); }