private static List <SegmentData> WriteXmlFiles(XmlWriter xmlTxtWriter, KeyValuePair <Comparison.Comparer.FileUnitProperties, Dictionary <string, Dictionary <string, Comparison.Comparer.ComparisonParagraphUnit> > > fileComparisonFileParagraphUnit, bool isRef) { int index = 1; var segmentDatas = new List <SegmentData>(); foreach (var fileComparisonParagraphUnit in fileComparisonFileParagraphUnit.Value) { var innerFileName = Path.GetFileName(fileComparisonParagraphUnit.Key); xmlTxtWriter.WriteStartElement("doc"); xmlTxtWriter.WriteAttributeString("sysid", isRef ? "ref" : "hyp"); if (innerFileName != null) { xmlTxtWriter.WriteAttributeString("docid", innerFileName); xmlTxtWriter.WriteAttributeString("genre", "comparison"); xmlTxtWriter.WriteAttributeString("origlang", fileComparisonFileParagraphUnit.Key.SourceLanguageIdUpdated); foreach (var comparisonParagraphUnit in fileComparisonParagraphUnit.Value.Values) { xmlTxtWriter.WriteStartElement("p"); xmlTxtWriter.WriteAttributeString("id", comparisonParagraphUnit.ParagraphId); foreach (var comparisonSegmentUnit in comparisonParagraphUnit.ComparisonSegmentUnits) { var filtered = true; if (Processor.Settings.CalculateSummaryAnalysisBasedOnFilteredRows) { if ((comparisonSegmentUnit.SegmentTextUpdated || !Processor.Settings.ReportFilterSegmentsWithNoChanges) && (!Processor.Settings.ReportFilterChangedTargetContent || !comparisonSegmentUnit.SegmentTextUpdated) && (!Processor.Settings.ReportFilterSegmentStatusChanged || !comparisonSegmentUnit.SegmentSegmentStatusUpdated) && (!Processor.Settings.ReportFilterSegmentsContainingComments || !comparisonSegmentUnit.SegmentHasComments)) { filtered = false; } if (filtered) { if (((!comparisonSegmentUnit.SegmentIsLocked || !Processor.Settings.ReportFilterLockedSegments) && comparisonSegmentUnit.SegmentIsLocked) || !ReportUtils.IsFilterSegmentMatchPercentage(Processor.Settings.ReportFilterTranslationMatchValuesOriginal, Processor.Settings.ReportFilterTranslationMatchValuesUpdated, comparisonSegmentUnit.TranslationStatusOriginal, comparisonSegmentUnit.TranslationStatusUpdated) || ((comparisonSegmentUnit.SegmentTextUpdated || !Processor.Settings.ReportFilterSegmentsWithNoChanges) && (!Processor.Settings.ReportFilterChangedTargetContent || !comparisonSegmentUnit.SegmentTextUpdated) && (!Processor.Settings.ReportFilterSegmentStatusChanged || !comparisonSegmentUnit.SegmentSegmentStatusUpdated) && (!Processor.Settings.ReportFilterSegmentsContainingComments || !comparisonSegmentUnit.SegmentHasComments))) { filtered = false; } } } if (!filtered) { continue; } segmentDatas.Add(new SegmentData { FileName = innerFileName, ParagraphId = comparisonParagraphUnit.ParagraphId, SegmentId = comparisonSegmentUnit.SegmentId }); xmlTxtWriter.WriteStartElement("seg"); var mappingID = new TERpIdMapping { Id = index++, SegmentId = comparisonSegmentUnit.SegmentId }; if (!_idMappings.Any(a => a.SegmentId == mappingID.SegmentId)) { _idMappings.Add(mappingID); } xmlTxtWriter.WriteAttributeString("id", mappingID.Id.ToString()); xmlTxtWriter.WriteAttributeString("segmentId", mappingID.SegmentId); WriteTargetContent(xmlTxtWriter, isRef ? comparisonSegmentUnit.TargetOriginal : comparisonSegmentUnit.TargetUpdated); xmlTxtWriter.WriteEndElement(); //seg } xmlTxtWriter.WriteEndElement(); //p } } xmlTxtWriter.WriteEndElement(); //doc } return(segmentDatas); }