Example #1
0
        public virtual void HandlePreviousStepResult(object sender, FileStoragePipelineEventArgs args)
        {
            if (args.BatchFilePaths == null)
            {
                throw new ArgumentNullException(nameof(args.BatchFilePaths));
            }

            if (!args.BatchFilePaths.Any())
            {
                throw new ArgumentException(nameof(args.BatchFilePaths), "The pathed batch contains no files.");
            }

            ServiceStateInfo.Instance.UpdateState(ServiceState.IsHandlingBatch);

            _safeExecuteManager.ExecuteWithExceptionLogging(() =>
            {
                foreach (var file in args.BatchFilePaths)
                {
                    _pdfGenerator.AddImageToDocument(file);
                }

                var outputFilePath = GetOutputPath(args.BatchFilePaths.First());
                _pdfGenerator.SavePdf(outputFilePath);

                args.FilePath = outputFilePath;

                OnStepExecuted(this, args);
            });
        }
Example #2
0
        public void HandlePreviousStepResult(object sender, FileStoragePipelineEventArgs args)
        {
            ServiceStateInfo.Instance.UpdateState(ServiceState.IsProvidingBatch);

            _safeExecuteManager.ExecuteWithExceptionLogging(() =>
            {
                if (IsFileFromNewPatch(args.FilePath))
                {
                    ProvideNewBatch();
                }
            });

            _documentParts.Add(args.FilePath);
        }
Example #3
0
        public void HandlePreviousStepResult(object sender, FileStoragePipelineEventArgs args)
        {
            ServiceStateInfo.Instance.UpdateState(ServiceState.IsPublishungBatch);

            _safeExecuteManager.ExecuteWithExceptionLogging(() =>
            {
                if (_fileSystemHelper.FileAccessMonitor.IsFileIsReadyForAccess(args.FilePath))
                {
                    foreach (var fileMessage in _filePatchMessageFactory.GetFilePatchMessages(args.FilePath))
                    {
                        _publisher.Publish(fileMessage);
                    }

                    _fileSystemHelper.FileHelper.DeleteFile(args.FilePath);
                }

                OnStepExecuted(this, args);
            });
        }
Example #4
0
        public void HandlePreviousStepResult(object sender, FileStoragePipelineEventArgs args)
        {
            if (args.BatchFilePaths == null)
            {
                throw new ArgumentNullException(nameof(args.BatchFilePaths));
            }

            if (!args.BatchFilePaths.Any())
            {
                throw new ArgumentException(nameof(args.BatchFilePaths), "The pathed batch contains no files.");
            }

            ServiceStateInfo.Instance.UpdateState(ServiceState.IsCleaningBatchFiles);

            _safeExecuteManager.ExecuteWithExceptionLogging(() =>
            {
                foreach (var file in args.BatchFilePaths)
                {
                    _fileSystemHelper.FileHelper.DeleteFile(file);
                }
            });
        }
Example #5
0
 private void OnStepExecuted(object sender, FileStoragePipelineEventArgs e)
 {
     StepExecuted?.Invoke(this, e);
 }