Dear community members,
The question I will ask may sound stupid but I am a bit lost in the File Type Support API and a small hint would be really valuable for me.
I would like to develop a plugin which parse the SDLXLIFF file and execute some functions on the source segments. I just want to read the segments and not modify the SDLXLIFF file. I have the following code:
public void openSDLXLIFF()
{
IFileTypeManager mgr = Sdl.FileTypeSupport.Framework.Core.Utilities.IntegrationApi.DefaultFileTypeManager.CreateInstance(true);
string bilingualFilePath = @"C:\Test\149999b_EN_O.docx.sdlxliff";
string outputfile = @"C:\Test\149999b_EN_Odo.docx.sdlxliff";
Sdl.FileTypeSupport.Framework.IntegrationApi.IMultiFileConverter conv = mgr.GetConverterToDefaultBilingual(bilingualFilePath, outputfile, ConverterMessage);
conv.AddBilingualProcessor(new AnalyseSDLXLIFF());
conv.Parse();
}
And the following class implementing the AbstractBilingualContentProcessor
class AnalyseSDLXLIFF : AbstractBilingualContentProcessor
{
public override void Initialize(IDocumentProperties documentInfo)
{
MessageBox.Show("initialize");
base.Initialize(documentInfo);
}
public override void Complete()
{
MessageBox.Show("complete");
base.Complete();
}
public override void SetFileProperties(IFileProperties fileInfo)
{
MessageBox.Show("props");
base.SetFileProperties(fileInfo);
}
public override void FileComplete()
{
MessageBox.Show("filecomplete");
base.FileComplete();
}
public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
{
MessageBox.Show("paragraphUnit");
if (paragraphUnit.IsStructure == false)
{
foreach (ISegmentPair segmentPair in paragraphUnit.SegmentPairs)
{
MessageBox.Show(segmentPair.Source.ToString());
}
}
}
}
When I execute my code, I know that my class is executed since the message box for the methods Initialize, SetfileProperties, FileComplete and Complete pop up. However, the ProcessParagraphUnit method is not executed at all.
I am not really familiar with the concept of derived classes and interfaces and I am sure that the solution to my problem is probably not complicated. But as I said, I am a bit lost in this API and help would be much appreciated.
Thanks in advance,
Regards,
Laurent