void Parse(XElement element, string filterBase, string prepend) { foreach (var child in element.Elements()) { if (child.Name == "Filter") { string filter = (string.IsNullOrEmpty(filterBase) ? "" : filterBase + "\\") + (string)child.Attribute("Name"); Filters.Add(filter, ""); Parse(child, filter, prepend); } else { string path = Path.Combine(prepend, (string)child.Attribute("RelativePath")); string extension = Path.GetExtension(path); if (extension == ".h") { IncludeFiles.Add(path, filterBase); } else if (extension == ".cpp") { SourceFiles.Add(path, filterBase); } else if (extension == ".resx") { ResourceFiles.Add(path, filterBase); } else { OtherFiles.Add(path, filterBase); } } } }
private void ReadIncludeFile(string file) { string line; using (var reader = new StreamReader(file)) { while (!reader.EndOfStream) { line = reader.ReadLine(); if (string.IsNullOrEmpty(line)) { continue; } var parts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 0) { continue; } if (!File.Exists(parts[0])) { Console.WriteLine("File not found \"" + parts[0] + "\""); continue; } if (parts.Length > 1) { IncludeFiles.Add(new IncludeFile(parts[0], parts[1])); } else { IncludeFiles.Add(new IncludeFile(parts[0])); } } } }