static Dictionary <string, ClassInfo> GetClassInfo(string[] fileList) { var ret = new Dictionary <string, ClassInfo>(); var classRegex = new Regex("public +(?<partial>partial)? *(?<abstract>abstract)? *class +(?<className>[\\w]+)"); var namespaceRegex = new Regex("namespace +(?<namespace>[\\w.]+)"); var setValueRegex1 = new Regex("SetValue\\(\"([a-zA-Z_][a-zA-Z0-9_]*)\"\\)"); var setValueRegex2 = new Regex("SetValue\\(nameof\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)\\)"); foreach (string filePath in fileList) { using (StreamReader sr = new StreamReader(filePath, Encoding.UTF8)) { var content = sr.ReadToEnd(); Match classMatch = classRegex.Match(content), namespaceMatch = namespaceRegex.Match(content); if (classMatch.Success && namespaceMatch.Success) { var names = new HashSet <string>(); foreach (Match match in setValueRegex1.Matches(content)) { names.Add(match.Groups[1].Value); } foreach (Match match in setValueRegex2.Matches(content)) { names.Add(match.Groups[1].Value); } var classInfo = new ClassInfo { FilePath = filePath, ClassName = classMatch.Groups["className"].Value, HasPartial = !String.IsNullOrEmpty(classMatch.Groups["partial"].Value), IsAbstract = !String.IsNullOrEmpty(classMatch.Groups["abstract"].Value) }; foreach (var name in names) { classInfo.AddSetValue(name); } ret.Add(String.Format("{0}.{1}", namespaceMatch.Groups["namespace"], classMatch.Groups["className"].Value), classInfo); } } } return(ret); }