<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

ImageLoadFileBatchValidator

using Castle.Core; using kCura.WinEDDS; using kCura.WinEDDS.Exporters; using Relativity.DataExchange.Export.VolumeManagerV2.Metadata.Paths; using Relativity.DataExchange.Io; using Relativity.DataExchange.Logger; using Relativity.Logging; using System.Linq; using System.Threading; namespace Relativity.DataExchange.Export.VolumeManagerV2.Batches { public class ImageLoadFileBatchValidator : IBatchValidator { private readonly IDestinationPath _destinationPath; private readonly IFile _fileWrapper; private readonly IStatus _status; private readonly ILog _logger; public ImageLoadFileBatchValidator(ImageLoadFileDestinationPath destinationPath, IFile fileWrapper, IStatus status, ILog logger) : this((IDestinationPath)destinationPath, fileWrapper, status, logger) { } [DoNotSelect] public ImageLoadFileBatchValidator(IDestinationPath destinationPath, IFile fileWrapper, IStatus status, ILog logger) { _destinationPath = destinationPath; _fileWrapper = fileWrapper; _status = status; _logger = logger; } public void ValidateExportedBatch(ObjectExportInfo[] artifacts, CancellationToken cancellationToken) { if (!_fileWrapper.Exists(_destinationPath.Path)) { _logger.LogError("Image load file {file} is missing.", new object[1] { _destinationPath.Path.Secure() }); _status.WriteError("Image load file " + _destinationPath.Path + " is missing."); } else if (_fileWrapper.GetFileSize(_destinationPath.Path) == 0 && artifacts.Any(delegate(ObjectExportInfo x) { if (x.Images != null) return x.Images.Count > 0; return false; })) { _logger.LogError("Image load file {file} is empty.", new object[1] { _destinationPath.Path.Secure() }); _status.WriteError("Image load file " + _destinationPath.Path + " is empty."); } } } }