private static SolutionProperties[] ParseSolutionProperties(string content) { var properties = new List <SolutionProperties>(); var mc = PropertiesDeclaration.Matches(content); foreach (Match match in mc) { var sp = new SolutionProperties { Entries = new List <KeyValuePair <string, string> >(), Name = match.Groups["name"].Value, Type = match.Groups["type"].Value }; var entries = match.Groups["entries"].Value; var mec = PropertiesEntryDeclaration.Matches(entries); foreach (Match entry in mec) { var key = entry.Groups["key"].Value.Trim(); var value = entry.Groups["value"].Value.Trim(); sp.Entries.Add(new KeyValuePair <string, string>(key, value)); } properties.Add(sp); } return(properties.ToArray()); }
private string GetPropertiesText(SolutionProperties[] array) { if (array == null || array.Length == 0) { // HideSolution by default array = new SolutionProperties[] { new SolutionProperties() { Name = "SolutionProperties", Type = "preSolution", Entries = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string> ("HideSolutionNode", "FALSE") } } }; } var result = new StringBuilder(); for (var i = 0; i < array.Length; i++) { if (i > 0) { result.Append(k_WindowsNewline); } var properties = array[i]; result.Append($"\tGlobalSection({properties.Name}) = {properties.Type}"); result.Append(k_WindowsNewline); foreach (var entry in properties.Entries) { result.Append($"\t\t{entry.Key} = {entry.Value}"); result.Append(k_WindowsNewline); } result.Append("\tEndGlobalSection"); } return(result.ToString()); }