Beispiel #1
0
        protected void Init(IEnumerable <string> sourcePaths, string outputPath, string tempPath, string corruptedPath)
        {
            _fileManagerFactory = new FileManagerFactory(outputPath, tempPath, corruptedPath);
            _documentManager    = new DocumentManager();
            _barcodeManager     = new BarcodeManager();

            if (sourcePaths == null || !sourcePaths.Any(path => !IsUnc(path)))
            {
                var fileManager = _fileManagerFactory.Create(null);
                var pathWatcher = new PathWatcher(fileManager.InputPath)
                {
                    FileManager     = fileManager,
                    DocumentManager = _documentManager,
                    BarcodeManager  = _barcodeManager
                };

                _pathWatchers.Add(pathWatcher);

                return;
            }

            foreach (var sourcePath in sourcePaths.Where(path => !IsUnc(path)))
            {
                var fileManager = _fileManagerFactory.Create(sourcePath);
                var pathWatcher = new PathWatcher(sourcePath)
                {
                    FileManager     = fileManager,
                    DocumentManager = _documentManager,
                    BarcodeManager  = _barcodeManager
                };

                _pathWatchers.Add(pathWatcher);
            }
        }
        protected void Init(IEnumerable <FileManager> fileManagers, DocumentManager documentManager, BarcodeManager barcodeManager, IPublisher <IEnumerable <byte> > documentPublisher, IPublisher <StatusDTO> statusPublisher, IListener <SettingsDTO> settingsListener)
        {
            _settingsListener           = settingsListener;
            _settingsListener.Received += SettingsListener_Received;

            foreach (var fileManager in fileManagers)
            {
                var pathWatcher = new PathWatcher(fileManager.InputPath)
                {
                    FileManager       = fileManager,
                    DocumentManager   = documentManager,
                    BarcodeManager    = barcodeManager,
                    DocumentPublisher = documentPublisher,
                    StatusPublisher   = statusPublisher
                };

                _pathWatchers.Add(pathWatcher);
            }
        }