Exemple #1
0
 public Factory(
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     Help.IPresenter help,
     ILogProviderFactoryRegistry registry,
     IFormatDefinitionsRepository repo,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     ITempFilesManager tempFilesManager,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     LogViewer.IPresenterFactory logViewerPresenterFactory,
     IViewsFactory viewFactories,
     ISynchronizationContext synchronizationContext,
     FieldsProcessor.IFactory fieldsProcessorFactory
     )
 {
     this.viewFactories             = viewFactories;
     this.alerts                    = alerts;
     this.registry                  = registry;
     this.fileDialogs               = fileDialogs;
     this.userDefinedFormatsManager = userDefinedFormatsManager;
     this.help                      = help;
     this.repo                      = repo;
     this.tempFilesManager          = tempFilesManager;
     this.logViewerPresenterFactory = logViewerPresenterFactory;
     this.traceSourceFactory        = traceSourceFactory;
     this.regexFactory              = regexFactory;
     this.synchronizationContext    = synchronizationContext;
     this.fieldsProcessorFactory    = fieldsProcessorFactory;
 }
        public MessagesReader(
            MediaBasedReaderParams readerParams,
            FormatInfo fmt,
            FieldsProcessor.IFactory fieldsProcessorFactory,
            IRegexFactory regexFactory,
            ITraceSourceFactory traceSourceFactory
            ) :
            base(readerParams.Media, fmt.BeginFinder, fmt.EndFinder, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor)
        {
            if (readerParams.Threads == null)
            {
                throw new ArgumentNullException(nameof(readerParams) + ".Threads");
            }
            this.threads                = readerParams.Threads;
            this.traceSourceFactory     = traceSourceFactory;
            this.regexFactory           = regexFactory;
            this.fmtInfo                = fmt;
            this.fieldsProcessorFactory = fieldsProcessorFactory;
            this.trace = traceSourceFactory.CreateTraceSource("LogSource", string.Format("{0}.r{1:x4}", readerParams.ParentLoggingPrefix, Hashing.GetShortHashCode(this.GetHashCode())));

            base.Extensions.AttachExtensions();

            this.isBodySingleFieldExpression = new Lazy <bool>(() =>
            {
                return(CreateNewFieldsProcessor().IsBodySingleFieldExpression());
            });
        }
 public Presenter(
     IView view,
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     FieldsProcessor.IFactory fieldsProcessorFactory,
     Help.IPresenter help
     )
 {
     this.dialog                 = view;
     this.alerts                 = alerts;
     this.fileDialogs            = fileDialogs;
     this.fieldsProcessorFactory = fieldsProcessorFactory;
     this.help = help;
     this.dialog.SetEventsHandler(this);
 }
 public TestParsing(
     IAlertPopup alerts,
     ITempFilesManager tempFilesManager,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     FieldsProcessor.IFactory fieldsProcessorFactory,
     IFactory objectsFactory
     )
 {
     this.alerts                 = alerts;
     this.tempFilesManager       = tempFilesManager;
     this.traceSourceFactory     = traceSourceFactory;
     this.regexFactory           = regexFactory;
     this.objectsFactory         = objectsFactory;
     this.fieldsProcessorFactory = fieldsProcessorFactory;
 }
        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");
        }
Exemple #6
0
 public UserDefinedFormatsManager(
     IFormatDefinitionsRepository repository,
     ILogProviderFactoryRegistry registry,
     ITempFilesManager tempFilesManager,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     FieldsProcessor.IFactory fieldsProcessorFactory
     )
 {
     this.repository             = repository ?? throw new ArgumentNullException(nameof(repository));
     this.registry               = registry ?? throw new ArgumentNullException(nameof(registry));
     this.tempFilesManager       = tempFilesManager;
     this.traceSourceFactory     = traceSourceFactory;
     this.regexFactory           = regexFactory;
     this.fieldsProcessorFactory = fieldsProcessorFactory;
     this.tracer = traceSourceFactory.CreateTraceSource("UserDefinedFormatsManager", "udfm");
 }