public IEnumerable<LOCInfo> CountLOC(IEnumerable<string> filenames, Action<LOCInfo> onOnFileCounted) { var loc = new LOC(); foreach (var filename in filenames) { var locInfo = loc.CountLOC(filename); onOnFileCounted(locInfo); yield return locInfo; } }
public void Count(string[] args) { var commandLineArguments = new CommandLineArguments(); var filenameProvider = new FilenameProvider(); var loc = new LOC(); var path = commandLineArguments.GetPath(args); var filenames = filenameProvider.GetFilenames(path); var locInfos = loc.CountLOC(filenames, OnFileCounted); var sum = loc.CalculateSum(locInfos); OnSum(sum); }