private void ExecuteSearchDuplicates(CodeAnalyzerParameters parameters) { if (!Directory.Exists(_workingFolder)) { Directory.CreateDirectory(_workingFolder); } int svnRevision = GetCurrentSvnRevision(parameters.Directory); var language = new CSharpLanguage(); var fileContents = GetFolderContents(parameters.Directory, parameters.SearchFilter, language.PreliminaryProcess); var duplicateFindParameters = new DuplicateFindParameters(6, new CSharpLanguage()); var filesCombiner = new DuplicateFinder(fileContents, duplicateFindParameters); var result = filesCombiner.FindDuplicates(); var folder = Path.Combine(_workingFolder, svnRevision.ToString()); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } if (!CommitsList.Contains(svnRevision.ToString())) { File.AppendAllText(CommitsFileName, svnRevision + "\n"); CommitsList.Add(svnRevision.ToString()); } var reportFileName = Path.Combine(folder, "duplicate.xml"); File.WriteAllText(reportFileName, result.ToXml()); var previousReport = Path.Combine(_workingFolder, GetPreviousSvnRevision().ToString(), "duplicate.xml"); Console.WriteLine("Lines: " + result.Count); CreateHtmlReport(result); }
public void ExecuteOther(CodeAnalyzerParameters parameters) { var textSearcher = new TextSearcher(parameters.GetExtractFunction()); textSearcher.ProcessFolder(parameters.Directory, parameters.SearchFilter); foreach (var report in parameters.Reports) { var result = textSearcher.GetFormattedReport(report); File.WriteAllLines(report.OutputFileName, result); } }