public UserDefinedFormatFactory(UserDefinedFactoryParams createParams) : base(createParams) { var formatSpecificNode = createParams.FormatSpecificNode; ReadPatterns(formatSpecificNode, patterns); var boundsNodes = formatSpecificNode.Elements("bounds").Take(1); var beginFinder = BoundFinder.CreateBoundFinder(boundsNodes.Select(n => n.Element("begin")).FirstOrDefault()); var endFinder = BoundFinder.CreateBoundFinder(boundsNodes.Select(n => n.Element("end")).FirstOrDefault()); tempFilesManager = createParams.TempFilesManager; fieldsProcessorFactory = createParams.FieldsProcessorFactory; regexFactory = createParams.RegexFactory; traceSourceFactory = createParams.TraceSourceFactory; fmtInfo = new Lazy <FormatInfo>(() => { FieldsProcessor.IInitializationParams fieldsInitParams = fieldsProcessorFactory.CreateInitializationParams( formatSpecificNode.Element("fields-config"), performChecks: true); MessagesReaderExtensions.XmlInitializationParams extensionsInitData = new MessagesReaderExtensions.XmlInitializationParams( formatSpecificNode.Element("extensions")); DejitteringParams?dejitteringParams = DejitteringParams.FromConfigNode( formatSpecificNode.Element("dejitter")); TextStreamPositioningParams textStreamPositioningParams = TextStreamPositioningParams.FromConfigNode( formatSpecificNode); RotationParams rotationParams = RotationParams.FromConfigNode( formatSpecificNode.Element("rotation")); FormatInfo.FormatFlags flags = FormatInfo.FormatFlags.None; if (formatSpecificNode.Element("plain-text-search-optimization").AttributeValue("allowed") == "yes") { flags |= FormatInfo.FormatFlags.AllowPlainTextSearchOptimization; } return(new FormatInfo( ReadRe(formatSpecificNode, "head-re", ReOptions.Multiline), ReadRe(formatSpecificNode, "body-re", ReOptions.Singleline), ReadParameter(formatSpecificNode, "encoding"), fieldsInitParams, extensionsInitData, dejitteringParams, textStreamPositioningParams, flags, rotationParams, beginFinder, endFinder )); }); uiKey = ReadParameter(formatSpecificNode, "ui-key"); }
public UserDefinedFormatFactory(UserDefinedFactoryParams createParams) : base(createParams) { var formatSpecificNode = createParams.FormatSpecificNode; ReadPatterns(formatSpecificNode, patterns); tempFilesManager = createParams.TempFilesManager; fmtInfo = new Lazy <FormatInfo>(() => { Type precompiledUserCode = ReadPrecompiledUserCode(createParams.RootNode); FieldsProcessor.InitializationParams fieldsInitParams = new FieldsProcessor.InitializationParams( formatSpecificNode.Element("fields-config"), true, precompiledUserCode); MessagesReaderExtensions.XmlInitializationParams extensionsInitData = new MessagesReaderExtensions.XmlInitializationParams( formatSpecificNode.Element("extensions")); DejitteringParams?dejitteringParams = DejitteringParams.FromConfigNode( formatSpecificNode.Element("dejitter")); TextStreamPositioningParams textStreamPositioningParams = TextStreamPositioningParams.FromConfigNode( formatSpecificNode); RotationParams rotationParams = RotationParams.FromConfigNode( formatSpecificNode.Element("rotation")); FormatInfo.FormatFlags flags = FormatInfo.FormatFlags.None; if (formatSpecificNode.Element("plain-text-search-optimization").AttributeValue("allowed") == "yes") { flags |= FormatInfo.FormatFlags.AllowPlainTextSearchOptimization; } return(new FormatInfo( ReadRe(formatSpecificNode, "head-re", ReOptions.Multiline), ReadRe(formatSpecificNode, "body-re", ReOptions.Singleline), ReadParameter(formatSpecificNode, "encoding"), fieldsInitParams, extensionsInitData, dejitteringParams, textStreamPositioningParams, flags, rotationParams )); }); uiKey = ReadParameter(formatSpecificNode, "ui-key"); }