private Dictionary <LanguageDirectionInfo, List <Model.ProjectFile> > GetLanguageDirectionFiles(string projectsFile, WizardContext wizardContext) { var languageDirections = new Dictionary <LanguageDirectionInfo, List <Model.ProjectFile> >(); foreach (var language in _projectSettingsService.GetLanguageDirections(projectsFile)) { foreach (var projectFile in wizardContext.ProjectFiles) { if (!projectFile.Selected) { continue; } if (string.Compare(projectFile.TargetLanguage, language.TargetLanguageCode, StringComparison.CurrentCultureIgnoreCase) != 0) { continue; } if (languageDirections.ContainsKey(language)) { languageDirections[language].Add(projectFile); } else { languageDirections.Add(language, new List <Model.ProjectFile> { projectFile }); } } } return(languageDirections); }
private void CreateHtmlReport(WizardContext wizardContext, FileBasedProject selectedProject, AutomaticTask automaticTask) { var project = _xliffProjects.FirstOrDefault(a => a.Id == wizardContext.Project.Id); var languageDirections = _projectSettingsService.GetLanguageDirections(selectedProject.FilePath); foreach (var taskReport in automaticTask.Reports) { var languageDirection = languageDirections.FirstOrDefault(a => string.Compare(taskReport.LanguageDirectionGuid, a.Guid, StringComparison.CurrentCultureIgnoreCase) == 0); var reportName = Path.GetFileName(taskReport.PhysicalPath); var reportFilePath = Path.Combine(wizardContext.WorkingFolder, reportName); var htmlReportFilePath = CreateHtmlReportFile(reportFilePath); foreach (var wcProjectFile in wizardContext.ProjectFiles) { if (!wcProjectFile.Selected || string.Compare(wcProjectFile.TargetLanguage, languageDirection?.TargetLanguageCode, StringComparison.CurrentCultureIgnoreCase) != 0) { continue; } var projectFile = project?.ProjectFiles.FirstOrDefault(a => a.FileId == wcProjectFile.FileId); if (projectFile != null) { projectFile.Report = GetRelativePath(project.Path, htmlReportFilePath); var activityfile = projectFile.ProjectFileActivities.OrderByDescending(a => a.Date).FirstOrDefault(); if (activityfile != null) { activityfile.Report = projectFile.Report; } } } } }