Analyzing the Files
In this chapter we will learn how to implement the functionality for performing the actual file analysis. Note that the analyze files task is applied to the SDLXliff files that were previously copied to the target folder. In a project that involves multiple target languages, an analyze files task needs to be applied separately to each set of target documents.
Implement another helper function called RunFileAnalysis, which takes a FileBasedProject object as parameter as well as the target language locale as string parameter:
/// <summary>
/// Runs the actual analyze files task on the SDLXliff target documents.
/// </summary>
private void RunFileAnalysis(FileBasedProject project, string trgLocale)
First, retrieve the target files by applying the GetTargetLanguageFiles method to the project, which takes the appropriate target Language
object as parameter:
ProjectFile[] targetFiles = project.GetTargetLanguageFiles(new Language(CultureInfo.GetCultureInfo(trgLocale)));
In the next step, we perform the actual analysis task by applying RunAutomaticTask to the project, which takes the file ids and the automatic task id (i.e. AnalyzeFiles) as parameters:
AutomaticTask analyzeTask = project.RunAutomaticTask(
targetFiles.GetIds(),
AutomaticTaskTemplateIds.AnalyzeFiles);