예제 #1
0
파일: MainForm.cs 프로젝트: kos811/FileUtil
 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;
 }
예제 #2
0
파일: MainForm.cs 프로젝트: kos811/FileUtil
 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;
 }
예제 #3
0
파일: SRCTypes.cs 프로젝트: kos811/FileUtil
 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);
     }
 }
예제 #4
0
파일: MainForm.cs 프로젝트: kos811/FileUtil
 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();
     }
 }
예제 #5
0
파일: MainForm.cs 프로젝트: kos811/FileUtil
 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);
 }