public List<SrcFile> GetDirFileList(SrcDir d) { List<SrcFile> result = new List<SrcFile>(); result.AddRange(d.Files); foreach(SrcDir dr in d.Directories) { List<SrcFile> tmp = GetDirFileList(dr); result.AddRange(tmp); } return result; }
public List<string> GetSRCReport(SrcDir d) { List<SrcFile> files = GetDirFileList(d); List<string> result = new List<string>(); Dictionary<SrcFile, int> dd=files.OrderByDescending(x => x.LinesCount).ToDictionary(x => x, x => x.LinesCount); foreach(SrcFile k in dd.Keys) { if(k.Type == SrcFileType.ftText) result.Add(string.Format("{1}\t{0}", k.Filepath,k.LinesCount)); } return result; }
private void ScanDir(string path) { LogMethood("Scaning dir: " + path); IEnumerable<string> fileNames = Directory.GetFiles(path); foreach (string fn in fileNames) { SrcFile f = new SrcFile(fn); this.Files.Add(f); } IEnumerable<string> dirNames = Directory.GetDirectories(path); foreach (string dn in dirNames) { SrcDir d = new SrcDir(dn, LogMethood); this.Directories.Add(d); } }
public void Scan(object FilePath) { ScanDir = new SrcDir(FilePath.ToString(), WriteStatus); if (ScanDir != null) { WriteStatus("Drawing nodes"); TreeNode tn = new TreeNode("/"); DrawDir(ScanDir, tn); if (InvokeRequired) { this.BeginInvoke(new TreeNodeDelegate(UpdateTreeView), tn); } else { UpdateTreeView(tn); } ShowReport(); } }
private void DrawDir(SrcDir dir, TreeNode parentNode) { TreeNode tn = new TreeNode(dir.Name); foreach (SrcDir d in dir.Directories) { DrawDir(d, tn); } foreach (SrcFile f in dir.Files) { DrawFile(f, tn); } parentNode.Nodes.Add(tn); }