private void ParseFiles(ProjectFolder folder, int incrementValue) { double folderInc = (double)incrementValue / (folder.Folders.Count + 1); foreach (ProjectFolder subFolder in folder.Folders) { ParseFiles(subFolder, (int)folderInc); } double fileInc = folderInc / folder.Files.Count; foreach (ProjectFile file in folder.Files.ToArray()) { _parserService.ParseFile(0, file.FileFullPath); _statusBarService.IncrementProgressBarProgress((int)fileInc); } }