LongTextObjectManagerDownloader
using kCura.WinEDDS;
using Relativity.DataExchange.Export.VolumeManagerV2.Download.TapiHelpers;
using Relativity.DataExchange.Export.VolumeManagerV2.Repository;
using Relativity.DataExchange.Export.VolumeManagerV2.Statistics;
using Relativity.DataExchange.Transfer;
using Relativity.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Relativity.DataExchange.Export.VolumeManagerV2.Download
{
internal class LongTextObjectManagerDownloader : ILongTextDownloader, IDisposable
{
private readonly SafeIncrement _safeIncrement;
private readonly IMetadataProcessingStatistics _metadataProcessingStatistics;
private readonly IAppSettings _appSettings;
private readonly ILog _logger;
private readonly IDownloadProgressManager _downloadProgressManager;
private readonly ILongTextRepository _longTextRepository;
private readonly ILongTextStreamService _longTextStreamService;
private readonly IStatus _status;
private readonly ExportFile _exportSettings;
private bool disposed;
public LongTextObjectManagerDownloader(IMetadataProcessingStatistics metadataProcessingStatistics, ExportFile exportSettings, SafeIncrement safeIncrement, ILongTextRepository longTextRepository, IDownloadProgressManager downloadProgressManager, IStatus status, ILog logger, IAppSettings appSettings, ILongTextStreamService longTextStreamService)
{
_safeIncrement = safeIncrement.ThrowIfNull("safeIncrement");
_metadataProcessingStatistics = metadataProcessingStatistics.ThrowIfNull("metadataProcessingStatistics");
_exportSettings = exportSettings.ThrowIfNull("exportSettings");
_longTextRepository = longTextRepository.ThrowIfNull("longTextRepository");
_downloadProgressManager = downloadProgressManager.ThrowIfNull("downloadProgressManager");
_status = status.ThrowIfNull("status");
_appSettings = appSettings.ThrowIfNull("appSettings");
_logger = logger.ThrowIfNull<ILog>("logger");
_longTextStreamService = longTextStreamService.ThrowIfNull("longTextStreamService");
}
public void Dispose()
{
Dispose(true);
}
[AsyncStateMachine(typeof(<DownloadAsync>d__12))]
public Task DownloadAsync(List<LongTextExportRequest> longTextExportRequests, CancellationToken cancellationToken)
{
<DownloadAsync>d__12 stateMachine = default(<DownloadAsync>d__12);
stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create();
stateMachine.<>4__this = this;
stateMachine.longTextExportRequests = longTextExportRequests;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
private void Dispose(bool disposing)
{
if (!disposed) {
if (disposing)
_longTextStreamService?.Dispose();
disposed = true;
}
}
[AsyncStateMachine(typeof(<DownloadLongTextFileAsync>d__14))]
private Task DownloadLongTextFileAsync(LongTextExportRequest request, Stopwatch stopwatch, long originalTicks, CancellationToken cancellationToken)
{
<DownloadLongTextFileAsync>d__14 stateMachine = default(<DownloadLongTextFileAsync>d__14);
stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create();
stateMachine.<>4__this = this;
stateMachine.request = request;
stateMachine.stopwatch = stopwatch;
stateMachine.originalTicks = originalTicks;
stateMachine.cancellationToken = cancellationToken;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}