public static void BuildTreeView(TreeNode node, string dir, Project project, ContextMenuStrip synthDirAndFileMenu) { DirectoryInfo dInfo = new DirectoryInfo(dir); //Loop through the subdirs foreach (DirectoryInfo directory in dInfo.GetDirectories()) { TreeNode t = new TreeNode(directory.Name); Regex synDirRegEx = new Regex(@"\d+_{1}"); bool synDirMatch = synDirRegEx.IsMatch(directory.Name); if (synDirMatch) { Console.WriteLine("Building TreeView, found a syn dir match " + directory.Name); t.Tag = new SynthesisDirectory(directory.FullName, project); t.ContextMenuStrip = synthDirAndFileMenu; } t.Name = directory.FullName; BuildTreeView(t, directory.FullName, project, synthDirAndFileMenu); node.Nodes.Add(t); } foreach (FileInfo file in dInfo.GetFiles()) { TreeNode t = new TreeNode(file.Name); t.Name = file.FullName; t.ContextMenuStrip = synthDirAndFileMenu; t.Tag = project.FindSynthesis(Path.GetFileNameWithoutExtension(file.FullName)); node.Nodes.Add(t); } }
public SynthesisDirectory(string path, Project project) { DInfo = new DirectoryInfo(path); OwningProject = project; FileInfo[] synthFInfo = DInfo.GetFiles("*.syn", SearchOption.TopDirectoryOnly); string synthName = Path.GetFileNameWithoutExtension(synthFInfo[0].Name); Synth = OwningProject.FindSynthesis(synthName); }