public PropertySpecification(PropertySpecification other) { IsGlobal = other.IsGlobal; Name = other.Name; CPorA = other.CPorA; Range = other.Range; Importance = other.Importance; Default = other.Default; Description = other.Description; Type = other.Type; AliasFor = other.AliasFor; }
static List <PropertySpecification> extractAll(string configDoc) { var configLines = configDoc.Split('\n'); var props = new List <PropertySpecification>(); bool parsingGlobal = true; foreach (var line in configLines) { if (line.Contains("Topic configuration properties")) { parsingGlobal = false; continue; } var columns = SplitLine(line).ToArray(); if (columns.Length != 6) { continue; } if (columns[0].Contains("-----")) { continue; } if (columns[0].Contains("Property")) { continue; } var prop = new PropertySpecification(); prop.IsGlobal = parsingGlobal; prop.Name = columns[0]; prop.CPorA = columns[1]; prop.Range = columns[2]; prop.Default = columns[3].Replace("\\|", "|"); prop.Importance = columns[4]; var desc = columns[5].Replace("\\|", "|"); bool isAlias = desc.StartsWith("Alias"); if (isAlias) { var firstIdx = desc.IndexOf('`') + 1; prop.AliasFor = desc.Substring(firstIdx, desc.IndexOf('`', firstIdx) - desc.IndexOf('`') - 1); } else { string typePrefix = "<br>*Type: "; if (desc.IndexOf(typePrefix) == -1) { throw new Exception($"Unexpected config description: {desc}"); } prop.Description = desc.Substring(0, desc.IndexOf(typePrefix)).Trim(); var beginIdx = desc.IndexOf(typePrefix) + typePrefix.Length; prop.Type = parseType(desc.Substring(beginIdx, desc.LastIndexOf("*") - beginIdx)); } props.Add(prop); } return(props); }