Exporter
using Castle.Windsor;
using FileNaming.CustomFileNaming;
using kCura.EDDS.WebAPI.AuditManagerBase;
using kCura.EDDS.WebAPI.ExportManagerBase;
using kCura.EDDS.WebAPI.FieldManagerBase;
using kCura.EDDS.WebAPI.ProductionManagerBase;
using kCura.WinEDDS.Container;
using kCura.WinEDDS.Exporters;
using kCura.WinEDDS.Exporters.Validator;
using kCura.WinEDDS.FileNaming.CustomFileNaming;
using kCura.WinEDDS.Service.Export;
using kCura.WinEDDS.Service.Kepler;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using Relativity.DataExchange;
using Relativity.DataExchange.Io;
using Relativity.DataExchange.Logger;
using Relativity.DataExchange.Logging;
using Relativity.DataExchange.Process;
using Relativity.DataExchange.Service;
using Relativity.DataExchange.Service.WebApiVsKeplerSwitch;
using Relativity.DataExchange.Transfer;
using Relativity.Logging;
using Relativity.Transfer;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Services.Protocols;
namespace kCura.WinEDDS
{
public class Exporter : IExporter, IStatus, IServiceNotification
{
public delegate void ShutdownEventEventHandler ();
internal class BatesEntry
{
[CompilerGenerated]
private int _ProductionArtifactID;
[CompilerGenerated]
private string _BegBates;
internal int ProductionArtifactID { get; set; }
internal string BegBates { get; set; }
}
[Serializable]
[CompilerGenerated]
internal sealed class _Closure$__
{
public static readonly _Closure$__ $I;
public static Func<Pair, bool> $I110-0;
public static Func<Pair, int> $I110-1;
public static Func<ViewFieldInfo, int> $I112-5;
public static Action<string> $I114-0;
public static Func<Pair, int> $I119-0;
public static Func<int, bool> $I128-0;
public static Func<ViewFieldInfo, bool> $I137-0;
static _Closure$__()
{
$I = new _Closure$__();
}
internal bool _Lambda$__110-0(Pair p)
{
return !string.IsNullOrEmpty(p.Value);
}
internal int _Lambda$__110-1(Pair p)
{
return Conversions.ToInteger(p.Value);
}
internal int _Lambda$__112-5(ViewFieldInfo f)
{
return f.AvfId;
}
internal void _Lambda$__114-0(string y)
{
}
internal int _Lambda$__119-0(Pair pair)
{
return Conversions.ToInteger(pair.Value);
}
internal bool _Lambda$__128-0(int prodID)
{
return prodID > 0;
}
internal bool _Lambda$__137-0(ViewFieldInfo f)
{
if (f.FieldType != global::Relativity.DataExchange.Service.FieldType.Text)
return f.FieldType == global::Relativity.DataExchange.Service.FieldType.OffTableText;
return true;
}
}
[CompilerGenerated]
internal sealed class _Closure$__112-0
{
public List<int> $VB$Local_allAvfIds;
public InitializationResults $VB$Local_exportInitializationArgs;
public Exporter $VB$Me;
public _Closure$__112-0(_Closure$__112-0 arg0)
{
if (arg0 != null) {
$VB$Local_allAvfIds = arg0.$VB$Local_allAvfIds;
$VB$Local_exportInitializationArgs = arg0.$VB$Local_exportInitializationArgs;
}
}
internal InitializationResults _Lambda$__1()
{
return $VB$Me.ExportManager.InitializeSearchExport($VB$Me._exportFile.CaseInfo.ArtifactID, $VB$Me.Settings.ArtifactID, $VB$Local_allAvfIds.ToArray(), checked($VB$Me.Settings.StartAtDocumentNumber + 1));
}
internal InitializationResults _Lambda$__2()
{
return $VB$Me.ExportManager.InitializeFolderExport($VB$Me.Settings.CaseArtifactID, $VB$Me.Settings.ViewID, $VB$Me.Settings.ArtifactID, false, $VB$Local_allAvfIds.ToArray(), checked($VB$Me.Settings.StartAtDocumentNumber + 1), $VB$Me.Settings.ArtifactTypeID);
}
internal InitializationResults _Lambda$__3()
{
return $VB$Me.ExportManager.InitializeFolderExport($VB$Me.Settings.CaseArtifactID, $VB$Me.Settings.ViewID, $VB$Me.Settings.ArtifactID, true, $VB$Local_allAvfIds.ToArray(), checked($VB$Me.Settings.StartAtDocumentNumber + 1), $VB$Me.Settings.ArtifactTypeID);
}
internal InitializationResults _Lambda$__4()
{
return $VB$Me.ExportManager.InitializeProductionExport($VB$Me._exportFile.CaseInfo.ArtifactID, $VB$Me.Settings.ArtifactID, $VB$Local_allAvfIds.ToArray(), checked($VB$Me.Settings.StartAtDocumentNumber + 1));
}
}
[CompilerGenerated]
internal sealed class _Closure$__112-1
{
public int[] $VB$Local_textPrecedenceAvfIds;
public _Closure$__112-2 $VB$NonLocal_$VB$Closure_3;
public _Closure$__112-1(_Closure$__112-1 arg0)
{
if (arg0 != null)
$VB$Local_textPrecedenceAvfIds = arg0.$VB$Local_textPrecedenceAvfIds;
}
internal object[] _Lambda$__6()
{
return $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.ExportManager.RetrieveResultsBlockForProductionStartingFromIndex($VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.CaseInfo.ArtifactID, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_exportInitializationArgs.RunId, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.ArtifactTypeID, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_allAvfIds.ToArray(), $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me._exportConfig.ExportBatchSize, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.MulticodesAsNested, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.MultiRecordDelimiter, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.NestedValueDelimiter, $VB$Local_textPrecedenceAvfIds, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.ArtifactID, $VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex);
}
internal object[] _Lambda$__7()
{
return $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.ExportManager.RetrieveResultsBlockStartingFromIndex($VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.CaseInfo.ArtifactID, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_exportInitializationArgs.RunId, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.ArtifactTypeID, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_allAvfIds.ToArray(), $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me._exportConfig.ExportBatchSize, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.MulticodesAsNested, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.MultiRecordDelimiter, $VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Me.Settings.NestedValueDelimiter, $VB$Local_textPrecedenceAvfIds, $VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex);
}
}
[CompilerGenerated]
internal sealed class _Closure$__112-2
{
public int $VB$Local_nextRecordIndex;
public _Closure$__112-0 $VB$NonLocal_$VB$Closure_2;
public _Closure$__112-2(_Closure$__112-2 arg0)
{
if (arg0 != null)
$VB$Local_nextRecordIndex = arg0.$VB$Local_nextRecordIndex;
}
}
[CompilerGenerated]
internal sealed class _Closure$__119-0
{
public int[] $VB$Local_productionPrecedenceArtifactIds;
public int[] $VB$Local_documentArtifactIDs;
public Exporter $VB$Me;
public _Closure$__119-0(_Closure$__119-0 arg0)
{
if (arg0 != null) {
$VB$Local_productionPrecedenceArtifactIds = arg0.$VB$Local_productionPrecedenceArtifactIds;
$VB$Local_documentArtifactIDs = arg0.$VB$Local_documentArtifactIDs;
}
}
internal Dictionary<int, List<BatesEntry>> _Lambda$__1()
{
return $VB$Me.GenerateBatesLookup($VB$Me._productionManager.RetrieveBatesByProductionAndDocument($VB$Me.Settings.CaseArtifactID, $VB$Local_productionPrecedenceArtifactIds, $VB$Local_documentArtifactIDs));
}
}
[CompilerGenerated]
internal sealed class _Closure$__120-0
{
public DataView $VB$Local_natives;
public int $VB$Local_productionArtifactID;
public int[] $VB$Local_documentArtifactIDs;
public int $VB$Local_maxTries;
public Exporter $VB$Me;
public Func<DataTable> $I1;
public Func<DataTable> $I2;
public Func<DataTable> $I3;
internal DataView _Lambda$__0()
{
if ($VB$Me.Settings.ExportNative) {
$VB$Me._timekeeper.MarkStart("Exporter_GetNativesForDocumentBlock");
DateTime now = DateTime.Now;
long ticks = now.Ticks;
if ($VB$Me.Settings.TypeOfExport == ExportFile.ExportType.Production)
$VB$Local_natives.Table = $VB$Me.CallServerWithRetry(($I1 == null) ? ($I1 = (() => $VB$Me._searchManager.RetrieveNativesForProduction($VB$Me.Settings.CaseArtifactID, $VB$Local_productionArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0])) : $I1, $VB$Local_maxTries);
else if ($VB$Me.Settings.ArtifactTypeID == 10) {
$VB$Local_natives.Table = $VB$Me.CallServerWithRetry(($I2 == null) ? ($I2 = (() => $VB$Me._searchManager.RetrieveNativesForSearch($VB$Me.Settings.CaseArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0])) : $I2, $VB$Local_maxTries);
} else {
DataTable dataTable = $VB$Me.CallServerWithRetry(($I3 == null) ? ($I3 = (() => $VB$Me._searchManager.RetrieveFilesForDynamicObjects($VB$Me.Settings.CaseArtifactID, $VB$Me.Settings.FileField.FieldID, $VB$Local_documentArtifactIDs).Tables[0])) : $I3, $VB$Local_maxTries);
if (dataTable == null)
$VB$Local_natives = null;
else
$VB$Local_natives.Table = dataTable;
}
ExportStatistics statistics;
ExportStatistics exportStatistics = statistics = $VB$Me.Statistics;
TimeSpan metadataTransferDuration = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics.MetadataTransferDuration = metadataTransferDuration + new TimeSpan(Math.Max(checked(now.Ticks - ticks), 1));
$VB$Me._timekeeper.MarkEnd("Exporter_GetNativesForDocumentBlock");
}
return $VB$Local_natives;
}
internal DataTable _Lambda$__1()
{
return $VB$Me._searchManager.RetrieveNativesForProduction($VB$Me.Settings.CaseArtifactID, $VB$Local_productionArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0];
}
internal DataTable _Lambda$__2()
{
return $VB$Me._searchManager.RetrieveNativesForSearch($VB$Me.Settings.CaseArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0];
}
internal DataTable _Lambda$__3()
{
return $VB$Me._searchManager.RetrieveFilesForDynamicObjects($VB$Me.Settings.CaseArtifactID, $VB$Me.Settings.FileField.FieldID, $VB$Local_documentArtifactIDs).Tables[0];
}
}
[CompilerGenerated]
internal sealed class _Closure$__121-0
{
public DataView $VB$Local_images;
public int[] $VB$Local_documentArtifactIDs;
public int $VB$Local_maxTries;
public Exporter $VB$Me;
public Func<DataTable> $I1;
internal DataView _Lambda$__0()
{
if ($VB$Me.Settings.ExportImages) {
$VB$Me._timekeeper.MarkStart("Exporter_GetImagesForDocumentBlock");
DateTime now = DateTime.Now;
long ticks = now.Ticks;
$VB$Local_images.Table = $VB$Me.CallServerWithRetry(($I1 == null) ? ($I1 = (() => $VB$Me.RetrieveImagesForDocuments($VB$Local_documentArtifactIDs))) : $I1, $VB$Local_maxTries);
ExportStatistics statistics;
ExportStatistics exportStatistics = statistics = $VB$Me.Statistics;
TimeSpan metadataTransferDuration = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics.MetadataTransferDuration = metadataTransferDuration + new TimeSpan(Math.Max(checked(now.Ticks - ticks), 1));
$VB$Me._timekeeper.MarkEnd("Exporter_GetImagesForDocumentBlock");
}
return $VB$Local_images;
}
internal DataTable _Lambda$__1()
{
return $VB$Me.RetrieveImagesForDocuments($VB$Local_documentArtifactIDs);
}
}
[CompilerGenerated]
internal sealed class _Closure$__122-0
{
public DataView $VB$Local_productionImages;
public int[] $VB$Local_documentArtifactIDs;
public int $VB$Local_maxTries;
public Exporter $VB$Me;
public Func<DataTable> $I1;
internal DataView _Lambda$__0()
{
if ($VB$Me.Settings.ExportImages) {
$VB$Me._timekeeper.MarkStart("Exporter_GetProductionsForDocumentBlock");
DateTime now = DateTime.Now;
long ticks = now.Ticks;
$VB$Local_productionImages.Table = $VB$Me.CallServerWithRetry(($I1 == null) ? ($I1 = (() => $VB$Me.RetrieveProductionImagesForDocuments($VB$Local_documentArtifactIDs, $VB$Me.Settings.ImagePrecedence))) : $I1, $VB$Local_maxTries);
ExportStatistics statistics;
ExportStatistics exportStatistics = statistics = $VB$Me.Statistics;
TimeSpan metadataTransferDuration = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics.MetadataTransferDuration = metadataTransferDuration + new TimeSpan(Math.Max(checked(now.Ticks - ticks), 1));
$VB$Me._timekeeper.MarkEnd("Exporter_GetProductionsForDocumentBlock");
}
return $VB$Local_productionImages;
}
internal DataTable _Lambda$__1()
{
return $VB$Me.RetrieveProductionImagesForDocuments($VB$Local_documentArtifactIDs, $VB$Me.Settings.ImagePrecedence);
}
}
[CompilerGenerated]
internal sealed class _Closure$__123-0
{
public DataView $VB$Local_pdfs;
public int[] $VB$Local_documentArtifactIDs;
public int $VB$Local_maxTries;
public Exporter $VB$Me;
public Func<DataTable> $I1;
internal DataView _Lambda$__0()
{
if ($VB$Me.Settings.ExportPdf) {
$VB$Me._timekeeper.MarkStart("Exporter_GetPDFsForDocumentBlock");
DateTime now = DateTime.Now;
long ticks = now.Ticks;
$VB$Local_pdfs.Table = $VB$Me.CallServerWithRetry(($I1 == null) ? ($I1 = (() => $VB$Me._searchManager.RetrievePdfForSearch($VB$Me.Settings.CaseArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0])) : $I1, $VB$Local_maxTries);
ExportStatistics statistics;
ExportStatistics exportStatistics = statistics = $VB$Me.Statistics;
TimeSpan metadataTransferDuration = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics.MetadataTransferDuration = metadataTransferDuration + new TimeSpan(Math.Max(checked(now.Ticks - ticks), 1));
$VB$Me._timekeeper.MarkEnd("Exporter_GetPDFsForDocumentBlock");
}
return $VB$Local_pdfs;
}
internal DataTable _Lambda$__1()
{
return $VB$Me._searchManager.RetrievePdfForSearch($VB$Me.Settings.CaseArtifactID, $VB$Local_documentArtifactIDs.ToCsv()).Tables[0];
}
}
[CompilerGenerated]
internal sealed class _Closure$__129-0
{
public ObjectExportInfo $VB$Local_artifact;
public _Closure$__129-0(_Closure$__129-0 arg0)
{
if (arg0 != null)
$VB$Local_artifact = arg0.$VB$Local_artifact;
}
internal bool _Lambda$__0(BatesEntry r)
{
return r.ProductionArtifactID == $VB$Local_artifact.CoalescedProductionID.Value;
}
}
private readonly ILog _logger;
private readonly ILoadFileHeaderFormatterFactory _loadFileFormatterFactory;
private readonly IExportConfig _exportConfig;
private readonly IFieldProviderCache _fieldProviderCache;
private readonly ISearchManager _searchManager;
private readonly IProductionManager _productionManager;
private readonly IAuditManager _auditManager;
private readonly IFieldManager _fieldManager;
private readonly IWebApiVsKepler _webApiVsKepler;
[CompilerGenerated]
private IExportManager _ExportManager;
private ExportFile _exportFile;
private ArrayList _columns;
public int TotalExportArtifactCount;
[CompilerGenerated]
[AccessedThroughProperty("_processContext")]
private ProcessContext __processContext;
[CompilerGenerated]
[AccessedThroughProperty("_downloadModeStatus")]
private IExportFileDownloaderStatus __downloadModeStatus;
private ExportNativeWithFilenameFrom _exportNativesToFileNamedFrom;
private string _beginBatesColumn;
private Timekeeper2 _timekeeper;
private int[] _productionArtifactIDs;
private long _lastStatusMessageTs;
private int _lastDocumentsExportedCountReported;
[CompilerGenerated]
private ExportStatistics _Statistics;
private IDictionary _lastStatisticsSnapshot;
private Stopwatch _stopwatch;
private int _warningCount;
private int _errorCount;
private long _fileCount;
private ProductionInfo _productionExportProduction;
private Dictionary<int, ProductionInfo> _productionLookup;
private int[] _productionPrecedenceIds;
private bool _tryToNameNativesAndTextFilesAfterPrecedenceBegBates;
protected IFieldLookupService FieldLookupService;
private IErrorFile _errorFile;
private readonly CancellationTokenSource _cancellationTokenSource;
private object _syncLock;
private OriginalFileNameProvider _originalFileNameProvider;
private bool _cancelledByUser;
private Func<string> _correlationIdFunc;
[CompilerGenerated]
private bool _NameTextAndNativesAfterBegBates;
[CompilerGenerated]
private IFile _FileHelper;
[CompilerGenerated]
private IDirectory _DirectoryHelper;
private IFileNameProvider _fileNameProvider;
[CompilerGenerated]
private ShutdownEventEventHandler ShutdownEventEvent;
private IUserNotification _interactionManager;
private DateTime _statisticsLastUpdated;
[CompilerGenerated]
private IExporterStatusNotification.FatalErrorEventEventHandler FatalErrorEventEvent;
[CompilerGenerated]
private IExporterStatusNotification.StatusMessageEventHandler StatusMessageEvent;
[CompilerGenerated]
private IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler FileTransferMultiClientModeChangeEventEvent;
public IExportManager ExportManager { get; set; }
private virtual ProcessContext _processContext {
[CompilerGenerated]
get {
return __processContext;
}
[MethodImpl(MethodImplOptions.Synchronized)]
[CompilerGenerated]
set {
EventHandler<CancellationRequestEventArgs> value2 = _processContext_OnCancellationRequest;
EventHandler<ExportErrorEventArgs> value3 = _processContext_OnExportServerErrors;
ProcessContext _processContext = __processContext;
if (_processContext != null) {
_processContext.CancellationRequest -= value2;
_processContext.ExportServerErrors -= value3;
}
__processContext = value;
_processContext = __processContext;
if (_processContext != null) {
_processContext.CancellationRequest += value2;
_processContext.ExportServerErrors += value3;
}
}
}
private virtual IExportFileDownloaderStatus _downloadModeStatus {
[CompilerGenerated]
get {
return __downloadModeStatus;
}
[MethodImpl(MethodImplOptions.Synchronized)]
[CompilerGenerated]
set {
IExportFileDownloaderStatus.TransferModesChangeEventEventHandler obj = _downloadModeStatus_UploadModeChangeEvent;
IExportFileDownloaderStatus _downloadModeStatus = __downloadModeStatus;
if (_downloadModeStatus != null)
_downloadModeStatus.TransferModesChangeEvent -= obj;
__downloadModeStatus = value;
_downloadModeStatus = __downloadModeStatus;
if (_downloadModeStatus != null)
_downloadModeStatus.TransferModesChangeEvent += obj;
}
}
public ExportStatistics Statistics { get; set; }
public bool NameTextAndNativesAfterBegBates { get; set; }
public ExportFile Settings {
get {
return _exportFile;
}
set {
_exportFile = value;
}
}
public IExportConfig ExportConfig => _exportConfig;
public ArrayList Columns {
get {
return _columns;
}
set {
_columns = value;
}
}
public ExportNativeWithFilenameFrom ExportNativesToFileNamedFrom {
get {
return _exportNativesToFileNamedFrom;
}
set {
_exportNativesToFileNamedFrom = value;
}
}
public string ErrorLogFileName {
get {
if (!(_errorFile?.IsErrorFileCreated() ?? false))
return null;
return _errorFile.Path();
}
}
internal bool IsCancelledByUser => _cancelledByUser;
protected virtual int NumberOfRetries => _exportConfig.ExportErrorNumberOfRetries;
protected virtual int WaitTimeBetweenRetryAttempts => _exportConfig.ExportErrorWaitTime;
public IFile FileHelper { get; set; }
public IDirectory DirectoryHelper { get; set; }
public IFileNameProvider FileNameProvider {
get {
if (_fileNameProvider == null)
_fileNameProvider = BuildFileNameProvider();
return _fileNameProvider;
}
set {
_fileNameProvider = value;
}
}
public int DocumentsExported {
get {
object syncLock = _syncLock;
ObjectFlowControl.CheckForSyncLockOnValueType(syncLock);
bool lockTaken = false;
try {
Monitor.Enter(syncLock, ref lockTaken);
return Statistics.DocumentsCount;
} finally {
if (lockTaken)
Monitor.Exit(syncLock);
}
}
set {
object syncLock = _syncLock;
ObjectFlowControl.CheckForSyncLockOnValueType(syncLock);
bool lockTaken = false;
try {
Monitor.Enter(syncLock, ref lockTaken);
Statistics.DocumentsCount = value;
} finally {
if (lockTaken)
Monitor.Exit(syncLock);
}
}
}
public IUserNotification InteractionManager {
get {
return _interactionManager ?? new NullUserNotification();
}
set {
_interactionManager = value;
}
}
public event ShutdownEventEventHandler ShutdownEvent {
[CompilerGenerated]
add {
ShutdownEventEventHandler shutdownEventEventHandler = ShutdownEventEvent;
ShutdownEventEventHandler shutdownEventEventHandler2;
do {
shutdownEventEventHandler2 = shutdownEventEventHandler;
ShutdownEventEventHandler value2 = (ShutdownEventEventHandler)Delegate.Combine(shutdownEventEventHandler2, value);
shutdownEventEventHandler = Interlocked.CompareExchange(ref ShutdownEventEvent, value2, shutdownEventEventHandler2);
} while ((object)shutdownEventEventHandler != shutdownEventEventHandler2);
}
[CompilerGenerated]
remove {
ShutdownEventEventHandler shutdownEventEventHandler = ShutdownEventEvent;
ShutdownEventEventHandler shutdownEventEventHandler2;
do {
shutdownEventEventHandler2 = shutdownEventEventHandler;
ShutdownEventEventHandler value2 = (ShutdownEventEventHandler)Delegate.Remove(shutdownEventEventHandler2, value);
shutdownEventEventHandler = Interlocked.CompareExchange(ref ShutdownEventEvent, value2, shutdownEventEventHandler2);
} while ((object)shutdownEventEventHandler != shutdownEventEventHandler2);
}
}
public event IExporterStatusNotification.FatalErrorEventEventHandler FatalErrorEvent {
[CompilerGenerated]
add {
IExporterStatusNotification.FatalErrorEventEventHandler fatalErrorEventEventHandler = FatalErrorEventEvent;
IExporterStatusNotification.FatalErrorEventEventHandler fatalErrorEventEventHandler2;
do {
fatalErrorEventEventHandler2 = fatalErrorEventEventHandler;
IExporterStatusNotification.FatalErrorEventEventHandler value2 = (IExporterStatusNotification.FatalErrorEventEventHandler)Delegate.Combine(fatalErrorEventEventHandler2, value);
fatalErrorEventEventHandler = Interlocked.CompareExchange(ref FatalErrorEventEvent, value2, fatalErrorEventEventHandler2);
} while ((object)fatalErrorEventEventHandler != fatalErrorEventEventHandler2);
}
[CompilerGenerated]
remove {
IExporterStatusNotification.FatalErrorEventEventHandler fatalErrorEventEventHandler = FatalErrorEventEvent;
IExporterStatusNotification.FatalErrorEventEventHandler fatalErrorEventEventHandler2;
do {
fatalErrorEventEventHandler2 = fatalErrorEventEventHandler;
IExporterStatusNotification.FatalErrorEventEventHandler value2 = (IExporterStatusNotification.FatalErrorEventEventHandler)Delegate.Remove(fatalErrorEventEventHandler2, value);
fatalErrorEventEventHandler = Interlocked.CompareExchange(ref FatalErrorEventEvent, value2, fatalErrorEventEventHandler2);
} while ((object)fatalErrorEventEventHandler != fatalErrorEventEventHandler2);
}
}
public event IExporterStatusNotification.StatusMessageEventHandler StatusMessage {
[CompilerGenerated]
add {
IExporterStatusNotification.StatusMessageEventHandler statusMessageEventHandler = StatusMessageEvent;
IExporterStatusNotification.StatusMessageEventHandler statusMessageEventHandler2;
do {
statusMessageEventHandler2 = statusMessageEventHandler;
IExporterStatusNotification.StatusMessageEventHandler value2 = (IExporterStatusNotification.StatusMessageEventHandler)Delegate.Combine(statusMessageEventHandler2, value);
statusMessageEventHandler = Interlocked.CompareExchange(ref StatusMessageEvent, value2, statusMessageEventHandler2);
} while ((object)statusMessageEventHandler != statusMessageEventHandler2);
}
[CompilerGenerated]
remove {
IExporterStatusNotification.StatusMessageEventHandler statusMessageEventHandler = StatusMessageEvent;
IExporterStatusNotification.StatusMessageEventHandler statusMessageEventHandler2;
do {
statusMessageEventHandler2 = statusMessageEventHandler;
IExporterStatusNotification.StatusMessageEventHandler value2 = (IExporterStatusNotification.StatusMessageEventHandler)Delegate.Remove(statusMessageEventHandler2, value);
statusMessageEventHandler = Interlocked.CompareExchange(ref StatusMessageEvent, value2, statusMessageEventHandler2);
} while ((object)statusMessageEventHandler != statusMessageEventHandler2);
}
}
public event IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler FileTransferMultiClientModeChangeEvent {
[CompilerGenerated]
add {
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler fileTransferMultiClientModeChangeEventEventHandler = FileTransferMultiClientModeChangeEventEvent;
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler fileTransferMultiClientModeChangeEventEventHandler2;
do {
fileTransferMultiClientModeChangeEventEventHandler2 = fileTransferMultiClientModeChangeEventEventHandler;
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler value2 = (IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler)Delegate.Combine(fileTransferMultiClientModeChangeEventEventHandler2, value);
fileTransferMultiClientModeChangeEventEventHandler = Interlocked.CompareExchange(ref FileTransferMultiClientModeChangeEventEvent, value2, fileTransferMultiClientModeChangeEventEventHandler2);
} while ((object)fileTransferMultiClientModeChangeEventEventHandler != fileTransferMultiClientModeChangeEventEventHandler2);
}
[CompilerGenerated]
remove {
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler fileTransferMultiClientModeChangeEventEventHandler = FileTransferMultiClientModeChangeEventEvent;
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler fileTransferMultiClientModeChangeEventEventHandler2;
do {
fileTransferMultiClientModeChangeEventEventHandler2 = fileTransferMultiClientModeChangeEventEventHandler;
IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler value2 = (IExporterStatusNotification.FileTransferMultiClientModeChangeEventEventHandler)Delegate.Remove(fileTransferMultiClientModeChangeEventEventHandler2, value);
fileTransferMultiClientModeChangeEventEventHandler = Interlocked.CompareExchange(ref FileTransferMultiClientModeChangeEventEvent, value2, fileTransferMultiClientModeChangeEventEventHandler2);
} while ((object)fileTransferMultiClientModeChangeEventEventHandler != fileTransferMultiClientModeChangeEventEventHandler2);
}
}
public void Shutdown()
{
_logger.LogError("Prematurely shutting down export due to a serious configuration or validation issue.", new object[0]);
ShutdownEventEvent?.Invoke();
}
[Obsolete("This constructor is marked for deprecation. Please use the constructor that requires a logger instance.")]
public Exporter(ExportFile exportFile, ProcessContext context, ILoadFileHeaderFormatterFactory loadFileFormatterFactory, Func<string> correlationIdFunc)
: this(exportFile, context, new WebApiServiceFactory(exportFile), loadFileFormatterFactory, new ExportConfig(), RelativityLogger.Instance, CancellationToken.None, correlationIdFunc)
{
}
[Obsolete("This constructor is marked for deprecation. Please use the constructor that requires a logger instance.")]
public Exporter(ExportFile exportFile, ProcessContext context, IServiceFactory serviceFactory, ILoadFileHeaderFormatterFactory loadFileFormatterFactory, IExportConfig exportConfig, Func<string> correlationIdFunc)
: this(exportFile, context, serviceFactory, loadFileFormatterFactory, exportConfig, RelativityLogger.Instance, CancellationToken.None, correlationIdFunc)
{
}
public Exporter(ExportFile exportFile, ProcessContext context, IServiceFactory serviceFactory, ILoadFileHeaderFormatterFactory loadFileFormatterFactory, IExportConfig exportConfig, ILog logger, CancellationToken cancellationToken, Func<string> correlationIdFunc)
{
_beginBatesColumn = "";
_timekeeper = new Timekeeper2();
_lastStatusMessageTs = DateTime.Now.Ticks;
_lastDocumentsExportedCountReported = 0;
Statistics = new ExportStatistics();
_stopwatch = new Stopwatch();
_warningCount = 0;
_errorCount = 0;
_fileCount = 0;
_productionLookup = new Dictionary<int, ProductionInfo>();
_tryToNameNativesAndTextFilesAfterPrecedenceBegBates = false;
_syncLock = RuntimeHelpers.GetObjectValue(new object());
NameTextAndNativesAfterBegBates = false;
FileHelper = global::Relativity.DataExchange.Io.FileSystem.Instance.File;
DirectoryHelper = global::Relativity.DataExchange.Io.FileSystem.Instance.Directory;
_interactionManager = new NullUserNotification();
_searchManager = serviceFactory.CreateSearchManager(correlationIdFunc);
_productionManager = serviceFactory.CreateProductionManager(correlationIdFunc);
_auditManager = serviceFactory.CreateAuditManager(correlationIdFunc);
_fieldManager = serviceFactory.CreateFieldManager(correlationIdFunc);
ExportManager = serviceFactory.CreateExportManager(correlationIdFunc);
WebApiVsKeplerFactory webApiVsKeplerFactory = new WebApiVsKeplerFactory(logger);
_webApiVsKepler = webApiVsKeplerFactory.Create(new Uri(exportConfig.WebApiServiceUrl), exportFile.Credential, correlationIdFunc);
_fieldProviderCache = new FieldProviderCache(exportFile.Credential, exportFile.CookieContainer, correlationIdFunc);
_cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new CancellationToken[1] {
cancellationToken
});
_processContext = context;
DocumentsExported = 0;
TotalExportArtifactCount = 1;
Settings = exportFile;
Settings.FolderPath += "\\";
ExportNativesToFileNamedFrom = exportFile.ExportNativesToFileNamedFrom;
_loadFileFormatterFactory = loadFileFormatterFactory;
_logger = (((object)logger) ?? ((object)new NullLogger()));
_exportConfig = exportConfig;
_correlationIdFunc = correlationIdFunc;
}
public bool ExportSearch()
{
try {
_stopwatch.Restart();
_logger.LogInformation("Preparing to execute the export search.", new object[0]);
Search();
_logger.LogInformation("Successfully executed the export search.", new object[0]);
} catch (Exception ex) {
ProjectData.SetProjectError(ex);
Exception ex2 = ex;
WriteFatalError($"""{DocumentsExported}", ex2);
ProjectData.ClearProjectError();
} finally {
_stopwatch.Stop();
StatusMessageEvent?.Invoke(new ExportEventArgs(DocumentsExported, TotalExportArtifactCount, "", EventType2.End, _lastStatisticsSnapshot, Statistics));
}
LogStatistics();
bool flag = string.IsNullOrWhiteSpace(ErrorLogFileName);
LogExportSearchResults(flag);
return flag;
}
bool IExporter.ExportSearch()
{
return this.ExportSearch();
}
private bool IsExtractedTextSelected()
{
ViewFieldInfo[] selectedViewFields = Settings.SelectedViewFields;
for (int i = 0; i < selectedViewFields.Length; i = checked(i + 1)) {
if (selectedViewFields[i].Category == global::Relativity.DataExchange.Service.FieldCategory.FullText)
return true;
}
return false;
}
private ViewFieldInfo ExtractedTextField()
{
ViewFieldInfo[] allExportableFields = Settings.AllExportableFields;
foreach (ViewFieldInfo viewFieldInfo in allExportableFields) {
if (viewFieldInfo.Category == global::Relativity.DataExchange.Service.FieldCategory.FullText)
return viewFieldInfo;
}
throw new Exception("Full text field somehow not in all fields");
}
private void LogApiVersionInfo()
{
Dictionary<string, object> dictionary = new Dictionary<string, object> {
{
"SDK",
typeof(IAppSettings).Assembly.GetName().Version
},
{
"TAPI",
typeof(ITransferClient).Assembly.GetName().Version
}
};
_logger.LogInformation("API Versions = @{ApiVersions}", new object[1] {
dictionary
});
}
private void LogExportSettings()
{
_logger.LogObjectAsDictionary("Export Settings = {@ExportConfiguration}", _exportConfig, LogObjectAsDictionaryFilter);
_logger.LogObjectAsDictionary("Export File Settings = {@ExportFile}", _exportFile, LogObjectAsDictionaryFilter);
_logger.LogObjectAsDictionary("Volume Info Settings = {@ExportFileVolumeInfo}", _exportFile.VolumeInfo, LogObjectAsDictionaryFilter);
}
private bool LogObjectAsDictionaryFilter(PropertyInfo info)
{
if (info.GetIndexParameters().Length == 0 && !string.Equals(info.Name, "FolderPath")) {
if (!info.PropertyType.IsValueType && (object)Nullable.GetUnderlyingType(info.PropertyType) == null && !(info.PropertyType == typeof(string)))
return info.PropertyType == typeof(Encoding);
return true;
}
return false;
}
private void LogWebApiServiceException(Exception exception)
{
_logger.LogError(exception, "A serious error occurred calling a WebAPI service.", new object[0]);
}
private void LogStatistics()
{
IDictionary<string, object> dictionary = Statistics.ToDictionaryForLogs();
_logger.LogInformation("Export statistics: {@Statistics}", new object[1] {
dictionary
});
}
private void LogExportSearchResults(bool jobSuccessful)
{
Dictionary<string, object> dictionary = new Dictionary<string, object> {
{
"ElapsedTime",
_stopwatch.Elapsed
},
{
"Errors",
_errorCount
},
{
"JobSuccessful",
jobSuccessful
},
{
"JobCancelled",
_cancellationTokenSource.IsCancellationRequested
},
{
"Warnings",
_warningCount
}
};
_logger.LogInformation("Exporter search results: {@ExporterSearchResults}", new object[1] {
dictionary
});
}
private void InitializeExportProcess()
{
_productionPrecedenceIds = (Settings.ImagePrecedence ?? new Pair[0]).Where((_Closure$__.$I110-0 != null) ? _Closure$__.$I110-0 : (_Closure$__.$I110-0 = ((Pair p) => !string.IsNullOrEmpty(p.Value)))).Select((_Closure$__.$I110-1 != null) ? _Closure$__.$I110-1 : (_Closure$__.$I110-1 = ((Pair p) => Conversions.ToInteger(p.Value)))).ToArray();
_tryToNameNativesAndTextFilesAfterPrecedenceBegBates = ShouldTextAndNativesBeNamedAfterPrecedenceBegBates();
InitializeFieldIndentifier();
}
protected virtual List<int> GetAvfIds()
{
List<int> list = new List<int>();
checked {
int num = _columns.Count - 1;
for (int i = 0; i <= num; i++) {
if (!(_columns[i] is CoalescedTextViewField))
list.Add(Settings.SelectedViewFields[i].AvfId);
}
if (Settings.TypeOfExport == ExportFile.ExportType.Production) {
Field field = _fieldManager.Read(Settings.CaseArtifactID, _productionExportProduction.BeginBatesReflectedFieldId);
_beginBatesColumn = SqlNameHelper.GetSqlFriendlyName(field.DisplayName);
if (!list.Contains(field.ArtifactViewFieldID))
list.Add(field.ArtifactViewFieldID);
field = null;
}
}
if (Settings.ExportImages) {
int? nullable = (int?)Settings.LogFileFormat;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 2) : null).GetValueOrDefault() && !IsExtractedTextSelected())
list.Add(ExtractedTextField().AvfId);
}
return list;
}
private unsafe void Search()
{
LogApiVersionInfo();
LogExportSettings();
InitializeExportProcess();
checked {
int maxTries = NumberOfRetries + 1;
string arg = "";
string path = _exportFile.FolderPath + "\\" + _exportFile.LoadFilesPrefix + "_img_errors.txt";
if (FileHelper.Exists(path) && _exportFile.Overwrite)
FileHelper.Delete(path);
WriteUpdate("Retrieving export data from the server...", true);
DateTime now = DateTime.Now;
long ticks = now.Ticks;
_Closure$__112-0 closure$__112-;
closure$__112-.$VB$Local_exportInitializationArgs = null;
LoadColumns();
ProductionInfo productionInfo = null;
if (Settings.TypeOfExport == ExportFile.ExportType.Production) {
_logger.LogVerbose("Preparing to retrieve the {ArtifactId} production from the {WorkspaceId} workspace.", new object[2] {
Settings.ArtifactID,
Settings.CaseArtifactID
});
productionInfo = CallServerWithRetry(() => _productionManager.Read(Settings.CaseArtifactID, Settings.ArtifactID), maxTries);
_logger.LogVerbose("Successfully retrieved the {ArtifactId} production from the {WorkspaceId} workspace.", new object[2] {
Settings.ArtifactID,
Settings.CaseArtifactID
});
_productionExportProduction = productionInfo;
}
closure$__112-.$VB$Local_allAvfIds = GetAvfIds();
bool flag = OriginalFileNameProvider.ExtendFieldRequestByFileNameIfNecessary(Settings.AllExportableFields, closure$__112-.$VB$Local_allAvfIds);
_logger.LogInformation("Preparing to initialize the {TypeOfExport} export search.", new object[1] {
Settings.TypeOfExport
});
switch (Settings.TypeOfExport) {
case ExportFile.ExportType.ArtifactSearch:
arg = "search";
closure$__112-.$VB$Local_exportInitializationArgs = CallServerWithRetry(() => ExportManager.InitializeSearchExport(_exportFile.CaseInfo.ArtifactID, Settings.ArtifactID, closure$__112-.$VB$Local_allAvfIds.ToArray(), Settings.StartAtDocumentNumber + 1), maxTries);
break;
case ExportFile.ExportType.ParentSearch:
arg = "folder";
closure$__112-.$VB$Local_exportInitializationArgs = CallServerWithRetry(() => ExportManager.InitializeFolderExport(Settings.CaseArtifactID, Settings.ViewID, Settings.ArtifactID, false, closure$__112-.$VB$Local_allAvfIds.ToArray(), Settings.StartAtDocumentNumber + 1, Settings.ArtifactTypeID), maxTries);
break;
case ExportFile.ExportType.AncestorSearch:
arg = "folder and subfolder";
closure$__112-.$VB$Local_exportInitializationArgs = CallServerWithRetry(() => ExportManager.InitializeFolderExport(Settings.CaseArtifactID, Settings.ViewID, Settings.ArtifactID, true, closure$__112-.$VB$Local_allAvfIds.ToArray(), Settings.StartAtDocumentNumber + 1, Settings.ArtifactTypeID), maxTries);
break;
case ExportFile.ExportType.Production:
arg = "production";
closure$__112-.$VB$Local_exportInitializationArgs = CallServerWithRetry(() => ExportManager.InitializeProductionExport(_exportFile.CaseInfo.ArtifactID, Settings.ArtifactID, closure$__112-.$VB$Local_allAvfIds.ToArray(), Settings.StartAtDocumentNumber + 1), maxTries);
break;
}
_logger.LogInformation("Successfully initialized the {TypeOfExport} export search and returned {TotalArtifactCount} total artifacts and {RunId} run identifier.", new object[3] {
Settings.TypeOfExport,
closure$__112-.$VB$Local_exportInitializationArgs.RowCount,
closure$__112-.$VB$Local_exportInitializationArgs.RunId
});
TotalExportArtifactCount = (int)closure$__112-.$VB$Local_exportInitializationArgs.RowCount;
if (TotalExportArtifactCount - 1 < Settings.StartAtDocumentNumber) {
string text = string.Format("The chosen start item number ({0}) exceeds the number of {2} items in the export ({1}). Export halted.", Settings.StartAtDocumentNumber + 1, TotalExportArtifactCount, "\r\n");
_logger.LogWarning(text, new object[0]);
InteractionManager.AlertCriticalError(text);
Shutdown();
} else {
ref int totalExportArtifactCount;
*(ref totalExportArtifactCount = ref TotalExportArtifactCount) = totalExportArtifactCount - Settings.StartAtDocumentNumber;
ExportStatistics statistics;
ExportStatistics exportStatistics = statistics = Statistics;
TimeSpan metadataTransferDuration = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics.MetadataTransferDuration = metadataTransferDuration + new TimeSpan(Math.Max(now.Ticks - ticks, 1));
IWindsorContainer val = ContainerFactoryProvider.ContainerFactory.Create(this, closure$__112-.$VB$Local_exportInitializationArgs.ColumnNames, _loadFileFormatterFactory, _correlationIdFunc);
try {
_Closure$__112-2 arg2 = new _Closure$__112-2(arg2);
arg2.$VB$NonLocal_$VB$Closure_2 = closure$__112-;
IBatch batch = null;
IObjectExportableSize objectExportableSize = null;
if (!val.Resolve<IExportValidation>().ValidateExport(Settings, TotalExportArtifactCount)) {
_logger.LogWarning("The export failed due to a validation failure.", new object[0]);
Shutdown();
} else {
objectExportableSize = val.Resolve<IObjectExportableSize>();
FieldLookupService = val.Resolve<IFieldLookupService>();
_errorFile = val.Resolve<IErrorFile>();
batch = val.Resolve<IBatch>();
_downloadModeStatus = val.Resolve<IExportFileDownloaderStatus>();
CreateOriginalFileNameProviderInstance(flag);
if (_exportFile.AppendOriginalFileName && !flag)
WriteWarningWithoutShowingExportedDocumentsCount("Filename column does not exist for this workspace and the filename from the file table will be used");
WriteStatusLine(EventType2.Status, "Created search log file.", true);
WriteUpdate($"""{arg}""", true);
StatusMessageEvent?.Invoke(new ExportEventArgs(DocumentsExported, TotalExportArtifactCount, "", EventType2.ResetStartTime, _lastStatisticsSnapshot, Statistics));
FileTransferMultiClientModeChangeEventEvent?.Invoke(this, new TapiMultiClientEventArgs(_downloadModeStatus.TransferModes));
object[] array = null;
arg2.$VB$Local_nextRecordIndex = 0;
int num = -1;
Statistics.BatchCount = 0;
while (num != 0) {
_Closure$__112-1 closure$__112-2 = default(_Closure$__112-1);
closure$__112-2.$VB$NonLocal_$VB$Closure_3 = arg2;
_timekeeper.MarkStart("Exporter_GetDocumentBlock");
(statistics = Statistics).BatchCount = statistics.BatchCount + 1;
now = DateTime.Now;
ticks = now.Ticks;
closure$__112-2.$VB$Local_textPrecedenceAvfIds = null;
if (Settings.SelectedTextFields != null && Settings.SelectedTextFields.Count() > 0)
closure$__112-2.$VB$Local_textPrecedenceAvfIds = Settings.SelectedTextFields.Select((_Closure$__.$I112-5 != null) ? _Closure$__.$I112-5 : (_Closure$__.$I112-5 = ((ViewFieldInfo f) => f.AvfId))).ToArray();
_logger.LogVerbose("Preparing to retrieve the next batch of artifacts for starting record index {NextRecordIndex} and batch {BatchNumber}.", new object[2] {
closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex,
Statistics.BatchCount
});
array = ((Settings.TypeOfExport != 0) ? CallServerWithRetry(() => ExportManager.RetrieveResultsBlockStartingFromIndex(Settings.CaseInfo.ArtifactID, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_exportInitializationArgs.RunId, Settings.ArtifactTypeID, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_allAvfIds.ToArray(), _exportConfig.ExportBatchSize, Settings.MulticodesAsNested, Settings.MultiRecordDelimiter, Settings.NestedValueDelimiter, closure$__112-2.$VB$Local_textPrecedenceAvfIds, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex), maxTries) : CallServerWithRetry(() => ExportManager.RetrieveResultsBlockForProductionStartingFromIndex(Settings.CaseInfo.ArtifactID, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_exportInitializationArgs.RunId, Settings.ArtifactTypeID, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$NonLocal_$VB$Closure_2.$VB$Local_allAvfIds.ToArray(), _exportConfig.ExportBatchSize, Settings.MulticodesAsNested, Settings.MultiRecordDelimiter, Settings.NestedValueDelimiter, closure$__112-2.$VB$Local_textPrecedenceAvfIds, Settings.ArtifactID, closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex), maxTries));
if (array == null) {
_logger.LogVerbose("Exiting the export batch loop because the export results block returned null for batch {BatchNumber}.", new object[1] {
Statistics.BatchCount
});
break;
}
_logger.LogVerbose("Successfully retrieved {TotalArtifactCount} artifacts for batch {BatchNumber}.", new object[2] {
array.Length,
Statistics.BatchCount
});
if (Settings.TypeOfExport == ExportFile.ExportType.Production && productionInfo != null && productionInfo.DocumentsHaveRedactions)
WriteStatusLineWithoutDocCount(EventType2.Warning, "Please Note - Documents in this production were produced with redactions applied. Ensure that you have exported text that was generated via OCR of the redacted documents.", true);
num = array.Length;
ExportStatistics exportStatistics2 = statistics = Statistics;
TimeSpan metadataTransferDuration2 = statistics.MetadataTransferDuration;
now = DateTime.Now;
exportStatistics2.MetadataTransferDuration = metadataTransferDuration2 + new TimeSpan(Math.Max(now.Ticks - ticks, 1));
_timekeeper.MarkEnd("Exporter_GetDocumentBlock");
List<int> list = new List<int>();
int ordinalIndex = FieldLookupService.GetOrdinalIndex("ArtifactID");
if (array.Length > 0) {
object[] array2 = array;
for (int i = 0; i < array2.Length; i++) {
object[] array3 = unchecked((object[])array2[i]);
list.Add(Conversions.ToInteger(array3[ordinalIndex]));
}
DateTime now2 = DateTime.Now;
_logger.LogInformation("Preparing to export {TotalArtifactCount} chunked artifacts for batch {BatchNumber}.", new object[2] {
array.Length,
Statistics.BatchCount
});
ExportChunk(list.ToArray(), array, objectExportableSize, batch);
now = DateTime.Now;
long value = Math.Max(now.Ticks - now2.Ticks, 1);
_logger.LogInformation("Successfully exported {TotalArtifactCount} chunked artifacts for batch {BatchNumber} in {BatchTimeSpan}.", new object[3] {
array.Length,
Statistics.BatchCount,
TimeSpan.FromTicks(value)
});
closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex = closure$__112-2.$VB$NonLocal_$VB$Closure_3.$VB$Local_nextRecordIndex + array.Length;
list.Clear();
array = null;
}
if (num == 0)
_logger.LogVerbose("Exiting the export batch loop because the next batch contains zero artifacts.", new object[0]);
if (_cancellationTokenSource.IsCancellationRequested) {
_logger.LogVerbose("Exiting the export batch loop because cancellation is requested.", new object[0]);
break;
}
}
ValidateExportedRecordCount(arg2.$VB$Local_nextRecordIndex, TotalExportArtifactCount);
_timekeeper.GenerateCsvReportItemsAsRows();
AuditRun(true);
}
} finally {
unchecked((IDisposable)val)?.Dispose();
}
}
}
}
private void ValidateExportedRecordCount(int actualExportedRecordsCount, long expectedExportedRecordsCount)
{
if (actualExportedRecordsCount != expectedExportedRecordsCount && !_cancellationTokenSource.IsCancellationRequested)
WriteError($"""{actualExportedRecordsCount}""{expectedExportedRecordsCount}""");
}
private void CreateOriginalFileNameProviderInstance(bool isFileNamePresent)
{
Action<string> action = (_Closure$__.$I114-0 != null) ? _Closure$__.$I114-0 : (_Closure$__.$I114-0 = delegate {
});
Action<string> warningWriter = Settings.AppendOriginalFileName ? new Action<string>(WriteWarningWithoutShowingExportedDocumentsCount) : action;
_originalFileNameProvider = new OriginalFileNameProvider(isFileNamePresent, FieldLookupService, warningWriter);
}
private T CallServerWithRetry<T>(Func<T> f, int maxTries)
{
checked {
if (!_webApiVsKepler.UseKepler()) {
int num = 0;
T result = default(T);
while (true) {
if (num < maxTries) {
num++;
try {
result = f();
} catch (Exception ex) {
ProjectData.SetProjectError(ex);
Exception ex2 = ex;
LogWebApiServiceException(ex2);
if (ex2 is InvalidOperationException && ex2.Message.Contains("empty response"))
throw new Exception("Communication with the WebAPI server has failed, possibly because values for MaximumLongTextSizeForExportInCell and/or MaximumTextVolumeForExportChunk are too large. Please lower them and try again.", ex2);
if (num >= maxTries || (ex2 is SoapException && ex2.ToString().IndexOf("Need To Re Login") != -1))
throw;
WriteStatusLine(EventType2.Status, "Error occurred, attempting retry number " + Conversions.ToString(num) + ", in " + Conversions.ToString(WaitTimeBetweenRetryAttempts) + " seconds...", true);
Thread.CurrentThread.Join(WaitTimeBetweenRetryAttempts * 1000);
ProjectData.ClearProjectError();
continue;
}
}
break;
}
return result;
}
return f();
}
}
private Dictionary<int, List<BatesEntry>> GenerateBatesLookup(object[][] source)
{
Dictionary<int, List<BatesEntry>> dictionary = new Dictionary<int, List<BatesEntry>>();
foreach (object[] array in source) {
int key = Conversions.ToInteger(array[0]);
List<BatesEntry> list;
if (!dictionary.ContainsKey(key)) {
list = new List<BatesEntry>();
dictionary.Add(key, list);
} else
list = dictionary[key];
list.Add(new BatesEntry {
BegBates = array[1].ToString(),
ProductionArtifactID = Conversions.ToInteger(array[2])
});
}
return dictionary;
}
private void InitializeFieldIndentifier()
{
if (string.IsNullOrEmpty(Settings.IdentifierColumnName)) {
string[] array = _fieldProviderCache.get_CurrentFields(Settings.ArtifactTypeID, Settings.CaseArtifactID, true).IdentifierFieldNames();
if (array.IsNullOrEmpty()) {
string line = $"""{Settings.CaseInfo.Name}""";
WriteError(line);
}
Settings.IdentifierColumnName = array[0];
}
}
private void ExportChunk(int[] documentArtifactIDs, object[] records, IObjectExportableSize objectExportableSize, IBatch batch)
{
checked {
int maxTries = NumberOfRetries + 1;
DataView natives = new DataView();
DataView images = new DataView();
DataView productionImages = new DataView();
DataView pdfs = new DataView();
int num = 0;
int productionArtifactID = 0;
if (Settings.TypeOfExport == ExportFile.ExportType.Production)
productionArtifactID = Settings.ArtifactID;
Task<DataView>[] obj = new Task<DataView>[4] {
RetrieveNatives(natives, productionArtifactID, documentArtifactIDs, maxTries),
RetrieveImages(images, documentArtifactIDs, maxTries),
RetrieveProductions(productionImages, documentArtifactIDs, maxTries),
RetrievePdfs(pdfs, documentArtifactIDs, maxTries)
};
Task.WaitAll(obj);
natives = obj[0].Result;
images = obj[1].Result;
productionImages = obj[2].Result;
pdfs = obj[3].Result;
int beginBatesColumnIndex = -1;
if (FieldLookupService.ContainsFieldName(_beginBatesColumn))
beginBatesColumnIndex = FieldLookupService.GetOrdinalIndex(_beginBatesColumn);
string sqlFriendlyName = SqlNameHelper.GetSqlFriendlyName(Settings.IdentifierColumnName);
int ordinalIndex = FieldLookupService.GetOrdinalIndex(sqlFriendlyName);
_Closure$__119-0 closure$__119-;
closure$__119-.$VB$Local_productionPrecedenceArtifactIds = Settings.ImagePrecedence.Select((_Closure$__.$I119-0 != null) ? _Closure$__.$I119-0 : (_Closure$__.$I119-0 = ((Pair pair) => Conversions.ToInteger(pair.Value)))).ToArray();
Lazy<Dictionary<int, List<BatesEntry>>> lookup = new Lazy<Dictionary<int, List<BatesEntry>>>(() => GenerateBatesLookup(_productionManager.RetrieveBatesByProductionAndDocument(Settings.CaseArtifactID, closure$__119-.$VB$Local_productionPrecedenceArtifactIds, documentArtifactIDs)));
ObjectExportInfo[] array = new ObjectExportInfo[documentArtifactIDs.Length - 1 + 1];
VolumePredictions[] array2 = new VolumePredictions[documentArtifactIDs.Length - 1 + 1];
int num2 = documentArtifactIDs.Length - 1;
for (num = 0; num <= num2; num++) {
object[] record = unchecked((object[])records[num]);
DataRowView nativeRow = GetNativeRow(natives, documentArtifactIDs[num]);
DataRowView pdfRow = GetPdfRow(pdfs, documentArtifactIDs[num]);
VolumePredictions prediction = new VolumePredictions();
ObjectExportInfo objectExportInfo = CreateArtifact(record, documentArtifactIDs[num], nativeRow, pdfRow, images, productionImages, beginBatesColumnIndex, ordinalIndex, ref lookup, ref prediction);
objectExportableSize.FinalizeSizeCalculations(objectExportInfo, prediction);
array2[num] = prediction;
array[num] = objectExportInfo;
}
batch.ExportAsync(array, array2, _cancellationTokenSource.Token).ConfigureAwait(false).GetAwaiter()
.GetResult();
}
}
[AsyncStateMachine(typeof(VB$StateMachine_120_RetrieveNatives))]
private Task<DataView> RetrieveNatives(DataView natives, int productionArtifactID, int[] documentArtifactIDs, int maxTries)
{
VB$StateMachine_120_RetrieveNatives stateMachine = default(VB$StateMachine_120_RetrieveNatives);
stateMachine.$VB$Me = this;
stateMachine.$VB$Local_natives = natives;
stateMachine.$VB$Local_productionArtifactID = productionArtifactID;
stateMachine.$VB$Local_documentArtifactIDs = documentArtifactIDs;
stateMachine.$VB$Local_maxTries = maxTries;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<DataView>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
[AsyncStateMachine(typeof(VB$StateMachine_121_RetrieveImages))]
private Task<DataView> RetrieveImages(DataView images, int[] documentArtifactIDs, int maxTries)
{
VB$StateMachine_121_RetrieveImages stateMachine = default(VB$StateMachine_121_RetrieveImages);
stateMachine.$VB$Me = this;
stateMachine.$VB$Local_images = images;
stateMachine.$VB$Local_documentArtifactIDs = documentArtifactIDs;
stateMachine.$VB$Local_maxTries = maxTries;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<DataView>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
[AsyncStateMachine(typeof(VB$StateMachine_122_RetrieveProductions))]
private Task<DataView> RetrieveProductions(DataView productionImages, int[] documentArtifactIDs, int maxTries)
{
VB$StateMachine_122_RetrieveProductions stateMachine = default(VB$StateMachine_122_RetrieveProductions);
stateMachine.$VB$Me = this;
stateMachine.$VB$Local_productionImages = productionImages;
stateMachine.$VB$Local_documentArtifactIDs = documentArtifactIDs;
stateMachine.$VB$Local_maxTries = maxTries;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<DataView>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
[AsyncStateMachine(typeof(VB$StateMachine_123_RetrievePdfs))]
private Task<DataView> RetrievePdfs(DataView pdfs, int[] documentArtifactIDs, int maxTries)
{
VB$StateMachine_123_RetrievePdfs stateMachine = default(VB$StateMachine_123_RetrievePdfs);
stateMachine.$VB$Me = this;
stateMachine.$VB$Local_pdfs = pdfs;
stateMachine.$VB$Local_documentArtifactIDs = documentArtifactIDs;
stateMachine.$VB$Local_maxTries = maxTries;
stateMachine.$State = -1;
stateMachine.$Builder = AsyncTaskMethodBuilder<DataView>.Create();
stateMachine.$Builder.Start(ref stateMachine);
return stateMachine.$Builder.Task;
}
protected virtual ObjectExportInfo CreateObjectExportInfo()
{
return new ObjectExportInfo();
}
private ObjectExportInfo CreateArtifact(object[] record, int documentArtifactID, DataRowView nativeRow, DataRowView pdfRow, DataView images, DataView productionImages, int beginBatesColumnIndex, int identifierColumnIndex, ref Lazy<Dictionary<int, List<BatesEntry>>> lookup, ref VolumePredictions prediction)
{
ObjectExportInfo objectExportInfo = CreateObjectExportInfo();
if (beginBatesColumnIndex != -1)
objectExportInfo.ProductionBeginBates = record[beginBatesColumnIndex].ToString();
objectExportInfo.IdentifierValue = record[identifierColumnIndex].ToString();
objectExportInfo.Images = PrepareImages(images, productionImages, documentArtifactID, objectExportInfo, Settings.ImagePrecedence, ref prediction);
if (nativeRow != null) {
objectExportInfo.OriginalFileName = _originalFileNameProvider.GetOriginalFileName(record, nativeRow);
objectExportInfo.NativeSourceLocation = nativeRow["Location"].ToString();
if (Settings.ArtifactTypeID == 10)
objectExportInfo.NativeFileGuid = nativeRow["Guid"].ToString();
else
objectExportInfo.FileID = Conversions.ToInteger(nativeRow["FileID"]);
}
if (nativeRow != null) {
string fileExtension = GetFileExtension(nativeRow["Filename"].ToString(), documentArtifactID);
if (Operators.CompareString(fileExtension, string.Empty, false) != 0)
objectExportInfo.NativeExtension = fileExtension;
}
if (pdfRow != null) {
objectExportInfo.PdfSourceLocation = pdfRow["Location"].ToString();
objectExportInfo.PdfFileGuid = pdfRow["Guid"].ToString();
}
objectExportInfo.ArtifactID = documentArtifactID;
objectExportInfo.Metadata = record;
SetProductionBegBatesFileName(objectExportInfo, lookup);
prediction.NativeFileCount = objectExportInfo.NativeCount;
if (prediction.NativeFileCount > 0) {
int num;
if (nativeRow == null)
num = 0;
else {
DataRow row = nativeRow.Row;
if (row == null)
num = 0;
else {
DataTable table = row.Table;
num = ((table != null && (table.Columns?.Contains("Size") ?? false)) ? 1 : 0);
}
}
if (num != 0) {
prediction.NativeFilesSize = Conversions.ToLong(nativeRow["Size"]);
goto IL_01d7;
}
}
prediction.NativeFilesSize = 0;
goto IL_01d7;
IL_01d7:
prediction.PdfFileCount = Conversions.ToLong(Interaction.IIf(objectExportInfo.HasPdf, 1, 0));
if (prediction.PdfFileCount > 0) {
int num2;
if (pdfRow == null)
num2 = 0;
else {
DataRow row2 = pdfRow.Row;
if (row2 == null)
num2 = 0;
else {
DataTable table2 = row2.Table;
num2 = ((table2 != null && (table2.Columns?.Contains("Size") ?? false)) ? 1 : 0);
}
}
if (num2 != 0) {
prediction.PdfFileSize = Conversions.ToLong(pdfRow["Size"]);
goto IL_0286;
}
}
prediction.PdfFileSize = 0;
goto IL_0286;
IL_0286:
prediction.ImageFileCount = objectExportInfo.ImageCount;
return objectExportInfo;
}
private bool ShouldTextAndNativesBeNamedAfterPrecedenceBegBates()
{
if (Settings.ExportNativesToFileNamedFrom != ExportNativeWithFilenameFrom.Custom)
return ShouldTextAndNativesBeNamedAfterPrecedenceBegBatesForSimpleFileNaming();
return ShouldTextAndNativesBeNamedAfterPrecedenceBegBatesForCustomFileNaming();
}
private bool ShouldTextAndNativesBeNamedAfterPrecedenceBegBatesForCustomFileNaming()
{
return Settings.CustomFileNaming.FirstFieldDescriptorPart().IsProduction;
}
private bool ShouldTextAndNativesBeNamedAfterPrecedenceBegBatesForSimpleFileNaming()
{
if (NameTextAndNativesAfterBegBates && Settings.TypeOfExport != 0 && ExportNativesToFileNamedFrom == ExportNativeWithFilenameFrom.Production)
return _productionPrecedenceIds.Any((_Closure$__.$I128-0 != null) ? _Closure$__.$I128-0 : (_Closure$__.$I128-0 = ((int prodID) => prodID > 0)));
return false;
}
private void SetProductionBegBatesFileName(ObjectExportInfo artifact, Lazy<Dictionary<int, List<BatesEntry>>> bateslookup)
{
if (_tryToNameNativesAndTextFilesAfterPrecedenceBegBates) {
Dictionary<int, List<BatesEntry>> value = bateslookup.Value;
if (value.ContainsKey(artifact.ArtifactID)) {
List<BatesEntry> list = value[artifact.ArtifactID];
if (artifact.CoalescedProductionID.HasValue)
artifact.ProductionBeginBates = (from r in list
where r.ProductionArtifactID == artifact.CoalescedProductionID.Value
select r).First().BegBates;
else {
int[] productionPrecedenceIds = _productionPrecedenceIds;
foreach (int num in productionPrecedenceIds) {
foreach (BatesEntry item in list) {
if (item.ProductionArtifactID == num) {
artifact.ProductionBeginBates = item.BegBates;
return;
}
}
}
}
}
}
}
private ArrayList PrepareImagesForProduction(DataView imagesView, int documentArtifactID, ref VolumePredictions prediction)
{
ArrayList arrayList = new ArrayList();
checked {
if (Settings.ExportImages) {
DataRow[] array = imagesView.Table.Select("DocumentArtifactID = " + documentArtifactID.ToString());
int num = 0;
string value = null;
if (array.Count() > 0) {
DataRow[] array2 = array;
foreach (DataRow dataRow in array2) {
ImageExportInfo imageExportInfo = new ImageExportInfo();
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(dataRow["ImageFileName"].ToString());
imageExportInfo.FileGuid = dataRow["ImageGuid"].ToString();
imageExportInfo.ArtifactID = documentArtifactID;
imageExportInfo.PageOffset = NullableTypesHelper.DBNullConvertToNullable<int>(RuntimeHelpers.GetObjectValue(dataRow["ByteRange"]));
imageExportInfo.BatesNumber = dataRow["BatesNumber"].ToString();
imageExportInfo.SourceLocation = dataRow["Location"].ToString();
string fileExtensionWithDot = GetFileExtensionWithDot(imageExportInfo.FileName, documentArtifactID);
string text = imageExportInfo.BatesNumber;
if (num == 0)
value = text;
if (num > 0 && (IsDocNumberOnlyProduction(_productionExportProduction) || text.Equals(value, StringComparison.OrdinalIgnoreCase)))
text = text + "_" + (num + 1).ToString();
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(text + fileExtensionWithDot);
if (Operators.CompareString(imageExportInfo.FileGuid, "", false) != 0) {
arrayList.Add(imageExportInfo);
VolumePredictions volumePredictions;
(volumePredictions = prediction).ImageFilesSize = volumePredictions.ImageFilesSize + Conversions.ToLong(dataRow["ImageSize"]);
}
num++;
}
}
return arrayList;
}
return arrayList;
}
}
private ProductionInfo GetProduction(string productionArtifactId)
{
int num = Conversions.ToInteger(productionArtifactId);
if (!_productionLookup.ContainsKey(num))
_productionLookup.Add(num, _productionManager.Read(Settings.CaseArtifactID, num));
return _productionLookup[num];
}
private bool IsDocNumberOnlyProduction(ProductionInfo production)
{
if (production != null && !production.BatesNumbering && production.UseDocumentLevelNumbering)
return !production.IncludeImageLevelNumberingForDocumentLevelNumbering;
return false;
}
private ArrayList PrepareImages(DataView imagesView, DataView productionImagesView, int documentArtifactID, ObjectExportInfo artifact, Pair[] productionOrderList, ref VolumePredictions prediction)
{
ArrayList arrayList = new ArrayList();
if (Settings.ExportImages) {
if (Settings.TypeOfExport != 0) {
foreach (Pair pair in productionOrderList) {
if (Operators.CompareString(pair.Value, "-1", false) == 0)
return PrepareOriginalImages(imagesView, documentArtifactID, artifact, ref prediction);
productionImagesView.RowFilter = $"""{documentArtifactID}""{pair.Value}";
string value = null;
if (productionImagesView.Count > 0) {
int num = 0;
IEnumerator enumerator = default(IEnumerator);
try {
enumerator = productionImagesView.GetEnumerator();
while (enumerator.MoveNext()) {
DataRowView dataRowView = (DataRowView)enumerator.Current;
ImageExportInfo imageExportInfo = new ImageExportInfo();
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(dataRowView["ImageFileName"].ToString());
imageExportInfo.FileGuid = dataRowView["ImageGuid"].ToString();
checked {
if (Operators.CompareString(imageExportInfo.FileGuid, "", false) != 0) {
imageExportInfo.ArtifactID = documentArtifactID;
imageExportInfo.BatesNumber = dataRowView["BatesNumber"].ToString();
imageExportInfo.PageOffset = NullableTypesHelper.DBNullConvertToNullable<int>(RuntimeHelpers.GetObjectValue(dataRowView["ByteRange"]));
string fileExtensionWithDot = GetFileExtensionWithDot(imageExportInfo.FileName, documentArtifactID);
string text = imageExportInfo.BatesNumber;
if (num == 0)
value = text;
if ((IsDocNumberOnlyProduction(GetProduction(pair.Value)) || text.Equals(value, StringComparison.OrdinalIgnoreCase)) && num > 0)
text = text + "_" + (num + 1).ToString();
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(text + fileExtensionWithDot);
imageExportInfo.SourceLocation = dataRowView["Location"].ToString();
arrayList.Add(imageExportInfo);
VolumePredictions volumePredictions;
(volumePredictions = prediction).ImageFilesSize = volumePredictions.ImageFilesSize + Conversions.ToLong(dataRowView["ImageSize"]);
num++;
}
}
}
} finally {
if (enumerator is IDisposable)
(enumerator as IDisposable).Dispose();
}
artifact.CoalescedProductionID = Conversions.ToInteger(pair.Value);
return arrayList;
}
}
return arrayList;
}
productionImagesView.Sort = "DocumentArtifactID ASC, PageID ASC";
return PrepareImagesForProduction(productionImagesView, documentArtifactID, ref prediction);
}
return arrayList;
}
private ArrayList PrepareOriginalImages(DataView imagesView, int documentArtifactID, ObjectExportInfo artifact, ref VolumePredictions prediction)
{
ArrayList arrayList = new ArrayList();
if (Settings.ExportImages) {
imagesView.RowFilter = "DocumentArtifactID = " + documentArtifactID.ToString();
int num = 0;
if (imagesView.Count > 0) {
IEnumerator enumerator = default(IEnumerator);
try {
enumerator = imagesView.GetEnumerator();
while (enumerator.MoveNext()) {
DataRowView dataRowView = (DataRowView)enumerator.Current;
ImageExportInfo imageExportInfo = new ImageExportInfo();
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(dataRowView["Filename"].ToString());
imageExportInfo.FileGuid = dataRowView["Guid"].ToString();
imageExportInfo.ArtifactID = documentArtifactID;
imageExportInfo.PageOffset = NullableTypesHelper.DBNullConvertToNullable<int>(RuntimeHelpers.GetObjectValue(dataRowView["ByteRange"]));
checked {
if (num == 0)
imageExportInfo.BatesNumber = artifact.IdentifierValue;
else {
imageExportInfo.BatesNumber = dataRowView["Identifier"].ToString();
if (imageExportInfo.BatesNumber.IndexOf(imageExportInfo.FileGuid) != -1)
imageExportInfo.BatesNumber = artifact.IdentifierValue + "_" + num.ToString().PadLeft(imagesView.Count.ToString().Length + 1, '0');
}
string fileExtensionWithDot = GetFileExtensionWithDot(imageExportInfo.FileName, documentArtifactID);
imageExportInfo.FileName = global::Relativity.DataExchange.Io.FileSystem.Instance.Path.ConvertIllegalCharactersInFilename(imageExportInfo.BatesNumber.ToString() + fileExtensionWithDot);
imageExportInfo.SourceLocation = dataRowView["Location"].ToString();
arrayList.Add(imageExportInfo);
VolumePredictions volumePredictions;
(volumePredictions = prediction).ImageFilesSize = volumePredictions.ImageFilesSize + Conversions.ToLong(dataRowView["Size"]);
num++;
}
}
} finally {
if (enumerator is IDisposable)
(enumerator as IDisposable).Dispose();
}
}
return arrayList;
}
return arrayList;
}
private DataRowView GetNativeRow(DataView dv, int artifactID)
{
if (Settings.ExportNative) {
if (Settings.ArtifactTypeID == 10)
dv.RowFilter = "DocumentArtifactID = " + artifactID.ToString();
else
dv.RowFilter = "ObjectArtifactID = " + artifactID.ToString();
if (dv.Count <= 0)
return null;
return dv[0];
}
return null;
}
private DataRowView GetPdfRow(DataView dv, int artifactID)
{
if (Settings.ExportPdf) {
dv.RowFilter = "DocumentArtifactID = " + artifactID.ToString();
if (dv.Count <= 0)
return null;
return dv[0];
}
return null;
}
private string LoadColumns()
{
ViewFieldInfo[] selectedViewFields = Settings.SelectedViewFields;
foreach (ViewFieldInfo viewFieldInfo in selectedViewFields) {
Settings.ExportFullText = (Settings.ExportFullText || viewFieldInfo.Category == global::Relativity.DataExchange.Service.FieldCategory.FullText);
}
_columns = new ArrayList(Settings.SelectedViewFields);
if (Settings.SelectedTextFields != null && Settings.SelectedTextFields.Count() > 0) {
List<ViewFieldInfo> list = new List<ViewFieldInfo>();
list.AddRange(Settings.SelectedViewFields.Where((_Closure$__.$I137-0 != null) ? _Closure$__.$I137-0 : (_Closure$__.$I137-0 = delegate(ViewFieldInfo f) {
if (f.FieldType != global::Relativity.DataExchange.Service.FieldType.Text)
return f.FieldType == global::Relativity.DataExchange.Service.FieldType.OffTableText;
return true;
})));
if (Settings.SelectedTextFields.Count() == 1 && list.Exists((ViewFieldInfo f) => f.Equals(Settings.SelectedTextFields.First()))) {
ViewFieldInfo viewFieldInfo2 = list.Find((ViewFieldInfo f) => f.Equals(Settings.SelectedTextFields.First()));
if (viewFieldInfo2 != null) {
int index = _columns.IndexOf(viewFieldInfo2);
_columns.RemoveAt(index);
_columns.Insert(index, new CoalescedTextViewField(Settings.SelectedTextFields.First(), true));
} else
_columns.Add(new CoalescedTextViewField(Settings.SelectedTextFields.First(), false));
} else
_columns.Add(new CoalescedTextViewField(Settings.SelectedTextFields.First(), false));
}
return _loadFileFormatterFactory.Create(Settings).GetHeader(_columns.Cast<ViewFieldInfo>().ToList());
}
private DataTable RetrieveImagesForDocuments(int[] documentArtifactIDs)
{
if (Settings.TypeOfExport != 0)
return _searchManager.RetrieveImagesForDocuments(Settings.CaseArtifactID, documentArtifactIDs).Tables[0];
return null;
}
private DataTable RetrieveProductionImagesForDocuments(int[] documentArtifactIDs, Pair[] productionOrderList)
{
if (Settings.TypeOfExport != 0) {
int[] productionArtifactIDs = GetProductionArtifactIDs(productionOrderList);
if (productionArtifactIDs.Length <= 0)
return null;
return _searchManager.RetrieveImagesByProductionIDsAndDocumentIDsForExport(Settings.CaseArtifactID, productionArtifactIDs, documentArtifactIDs).Tables[0];
}
return _searchManager.RetrieveImagesForProductionDocuments(Settings.CaseArtifactID, documentArtifactIDs, int.Parse(productionOrderList[0].Value)).Tables[0];
}
private int[] GetProductionArtifactIDs(Pair[] productionOrderList)
{
if (_productionArtifactIDs == null) {
ArrayList arrayList = new ArrayList();
foreach (Pair pair in productionOrderList) {
if (Operators.CompareString(pair.Value, "-1", false) != 0)
arrayList.Add(int.Parse(pair.Value));
}
_productionArtifactIDs = (int[])arrayList.ToArray(typeof(int));
}
return _productionArtifactIDs;
}
private void AuditRun(bool success)
{
kCura.EDDS.WebAPI.AuditManagerBase.ExportStatistics exportStatistics = new kCura.EDDS.WebAPI.AuditManagerBase.ExportStatistics();
exportStatistics.AppendOriginalFilenames = Settings.AppendOriginalFileName;
exportStatistics.Bound = Settings.QuoteDelimiter;
exportStatistics.ArtifactTypeID = Settings.ArtifactTypeID;
switch (Settings.TypeOfExport) {
case ExportFile.ExportType.AncestorSearch:
exportStatistics.DataSourceArtifactID = Settings.ViewID;
break;
case ExportFile.ExportType.ArtifactSearch:
exportStatistics.DataSourceArtifactID = Settings.ArtifactID;
break;
case ExportFile.ExportType.ParentSearch:
exportStatistics.DataSourceArtifactID = Settings.ViewID;
break;
case ExportFile.ExportType.Production:
exportStatistics.DataSourceArtifactID = Settings.ArtifactID;
break;
}
exportStatistics.Delimiter = Settings.RecordDelimiter;
exportStatistics.DestinationFilesystemFolder = Settings.FolderPath;
exportStatistics.DocumentExportCount = DocumentsExported;
exportStatistics.ErrorCount = _errorCount;
if (Settings.SelectedTextFields != null && Settings.SelectedTextFields.Any())
exportStatistics.ExportedTextFieldID = Settings.SelectedTextFields.First().FieldArtifactId;
if (Settings.ExportFullTextAsFile) {
exportStatistics.ExportedTextFileEncodingCodePage = Settings.TextFileEncoding.CodePage;
exportStatistics.ExportTextFieldAsFiles = true;
} else
exportStatistics.ExportTextFieldAsFiles = false;
ArrayList arrayList = new ArrayList();
ViewFieldInfo[] selectedViewFields = Settings.SelectedViewFields;
foreach (ViewFieldInfo viewFieldInfo in selectedViewFields) {
if (!arrayList.Contains(viewFieldInfo.FieldArtifactId))
arrayList.Add(viewFieldInfo.FieldArtifactId);
}
exportStatistics.Fields = (int[])arrayList.ToArray(typeof(int));
exportStatistics.ExportNativeFiles = Settings.ExportNative;
if (exportStatistics.Fields.Length > 0 || Settings.ExportNative) {
exportStatistics.MetadataLoadFileEncodingCodePage = Settings.LoadFileEncoding.CodePage;
string left = Settings.LoadFileExtension.ToLower();
if (Operators.CompareString(left, "txt", false) != 0) {
if (Operators.CompareString(left, "csv", false) != 0) {
if (Operators.CompareString(left, "dat", false) != 0) {
if (Operators.CompareString(left, "html", false) == 0)
exportStatistics.MetadataLoadFileFormat = LoadFileFormat.Html;
} else
exportStatistics.MetadataLoadFileFormat = LoadFileFormat.Dat;
} else
exportStatistics.MetadataLoadFileFormat = LoadFileFormat.Csv;
} else
exportStatistics.MetadataLoadFileFormat = LoadFileFormat.Custom;
exportStatistics.MultiValueDelimiter = Settings.MultiRecordDelimiter;
exportStatistics.ExportMultipleChoiceFieldsAsNested = Settings.MulticodesAsNested;
exportStatistics.NestedValueDelimiter = Settings.NestedValueDelimiter;
exportStatistics.NewlineProxy = Settings.NewlineDelimiter;
}
try {
exportStatistics.FileExportCount = checked((int)_fileCount);
} catch (Exception ex) {
ProjectData.SetProjectError(ex);
Exception ex2 = ex;
_logger.LogWarning(ex2, "Failed to retrieve the file export count.", new object[0]);
ProjectData.ClearProjectError();
}
switch (Settings.TypeOfExportedFilePath) {
case ExportFile.ExportedFilePathType.Absolute:
exportStatistics.FilePathSettings = "Use Absolute Paths";
break;
case ExportFile.ExportedFilePathType.Prefix:
exportStatistics.FilePathSettings = "Use Prefix: " + Settings.FilePrefix;
break;
case ExportFile.ExportedFilePathType.Relative:
exportStatistics.FilePathSettings = "Use Relative Paths";
break;
}
if (Settings.ExportImages) {
exportStatistics.ExportImages = true;
ExportFile.ImageType? typeOfImage = Settings.TypeOfImage;
int? nullable = (int?)typeOfImage;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 1) : null).GetValueOrDefault())
exportStatistics.ImageFileType = ImageFileExportType.MultiPageTiff;
else {
nullable = (int?)typeOfImage;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 2) : null).GetValueOrDefault())
exportStatistics.ImageFileType = ImageFileExportType.PDF;
else {
nullable = (int?)typeOfImage;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 0) : null).GetValueOrDefault())
exportStatistics.ImageFileType = ImageFileExportType.SinglePage;
}
}
LoadFileType.FileFormat? logFileFormat = Settings.LogFileFormat;
nullable = (int?)logFileFormat;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 1) : null).GetValueOrDefault())
exportStatistics.ImageLoadFileFormat = ImageLoadFileFormatType.Ipro;
else {
nullable = (int?)logFileFormat;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 2) : null).GetValueOrDefault())
exportStatistics.ImageLoadFileFormat = ImageLoadFileFormatType.IproFullText;
else {
nullable = (int?)logFileFormat;
if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 0) : null).GetValueOrDefault())
exportStatistics.ImageLoadFileFormat = ImageLoadFileFormatType.Opticon;
}
}
bool flag = false;
bool flag2 = false;
Pair[] imagePrecedence = Settings.ImagePrecedence;
for (int j = 0; j < imagePrecedence.Length; j = checked(j + 1)) {
if (Operators.CompareString(imagePrecedence[j].Value, "-1", false) != 0)
flag2 = true;
else
flag = true;
}
if (flag2 && flag)
exportStatistics.ImagesToExport = ImagesToExportType.Both;
else if (flag2) {
exportStatistics.ImagesToExport = ImagesToExportType.Produced;
} else {
exportStatistics.ImagesToExport = ImagesToExportType.Original;
}
} else
exportStatistics.ExportImages = false;
exportStatistics.ExportSearchablePDFs = Settings.ExportPdf;
exportStatistics.OverwriteFiles = Settings.Overwrite;
ArrayList arrayList2 = new ArrayList();
Pair[] imagePrecedence2 = Settings.ImagePrecedence;
foreach (Pair pair in imagePrecedence2) {
arrayList2.Add(int.Parse(pair.Value));
}
exportStatistics.ProductionPrecedence = (int[])arrayList2.ToArray(typeof(int));
checked {
exportStatistics.RunTimeInMilliseconds = (int)Math.Min(_stopwatch.ElapsedMilliseconds, 2147483647);
if (Settings.TypeOfExport == ExportFile.ExportType.AncestorSearch || Settings.TypeOfExport == ExportFile.ExportType.ParentSearch)
exportStatistics.SourceRootFolderID = Settings.ArtifactID;
exportStatistics.SubdirectoryImagePrefix = Settings.VolumeInfo.get_SubdirectoryImagePrefix(false);
exportStatistics.SubdirectoryMaxFileCount = Settings.VolumeInfo.SubdirectoryMaxSize;
exportStatistics.SubdirectoryNativePrefix = Settings.VolumeInfo.get_SubdirectoryNativePrefix(false);
exportStatistics.SubdirectoryStartNumber = Settings.VolumeInfo.SubdirectoryStartNumber;
exportStatistics.SubdirectoryTextPrefix = Settings.VolumeInfo.get_SubdirectoryFullTextPrefix(false);
exportStatistics.SubdirectoryPDFPrefix = Settings.VolumeInfo.get_SubdirectoryPdfPrefix(false);
if (ExportNativesToFileNamedFrom == ExportNativeWithFilenameFrom.Identifier) {
ViewFieldInfo[] allExportableFields = Settings.AllExportableFields;
foreach (ViewFieldInfo viewFieldInfo2 in allExportableFields) {
if (viewFieldInfo2.Category == global::Relativity.DataExchange.Service.FieldCategory.Identifier) {
exportStatistics.TextAndNativeFilesNamedAfterFieldID = viewFieldInfo2.FieldArtifactId;
break;
}
}
} else {
ViewFieldInfo[] allExportableFields2 = Settings.AllExportableFields;
foreach (ViewFieldInfo viewFieldInfo3 in allExportableFields2) {
if (Operators.CompareString(viewFieldInfo3.AvfColumnName.ToLower(), _beginBatesColumn.ToLower(), false) == 0) {
exportStatistics.TextAndNativeFilesNamedAfterFieldID = viewFieldInfo3.FieldArtifactId;
break;
}
}
}
exportStatistics.TotalFileBytesExported = Statistics.FileTransferredBytes;
exportStatistics.TotalMetadataBytesExported = Statistics.MetadataTransferredBytes;
switch (Settings.TypeOfExport) {
case ExportFile.ExportType.AncestorSearch:
exportStatistics.Type = "Folder and Subfolders";
break;
case ExportFile.ExportType.ArtifactSearch:
exportStatistics.Type = "Saved Search";
break;
case ExportFile.ExportType.ParentSearch:
exportStatistics.Type = "Folder";
break;
case ExportFile.ExportType.Production:
exportStatistics.Type = "Production Set";
break;
}
exportStatistics.VolumeMaxSize = Settings.VolumeInfo.VolumeMaxSize;
exportStatistics.VolumePrefix = Settings.VolumeInfo.VolumePrefix;
exportStatistics.VolumeStartNumber = Settings.VolumeInfo.VolumeStartNumber;
exportStatistics.StartExportAtDocumentNumber = Settings.StartAtDocumentNumber + 1;
exportStatistics.CopyFilesFromRepository = (Settings.VolumeInfo.CopyNativeFilesFromRepository || Settings.VolumeInfo.CopyNativeFilesFromRepository);
exportStatistics.WarningCount = _warningCount;
try {
_auditManager.AuditExport(Settings.CaseInfo.ArtifactID, !success, exportStatistics);
} catch (Exception ex3) {
ProjectData.SetProjectError(ex3);
Exception exception = ex3;
LogWebApiServiceException(exception);
ProjectData.ClearProjectError();
}
}
}
internal void WriteFatalError(string line, Exception ex)
{
AuditRun(false);
_logger.LogFatal(ex, "Export experienced a fatal error. Line: {Line}", new object[1] {
line
});
FatalErrorEventEvent?.Invoke(line, ex);
}
private void LogStatusLine(EventType2 e, string line, bool isEssential)
{
switch (e) {
case EventType2.Warning:
_logger.LogWarning(line, new object[0]);
break;
case EventType2.Error:
_logger.LogError(line, new object[0]);
break;
case EventType2.Statistics:
_logger.LogInformation(line, new object[0]);
break;
default:
if (isEssential)
_logger.LogInformation(line, new object[0]);
else
_logger.LogVerbose(line, new object[0]);
break;
}
}
internal void WriteStatusLine(EventType2 e, string line, bool isEssential, bool showNumberOfExportedDocuments)
{
long ticks = DateTime.Now.Ticks;
object syncLock = _syncLock;
ObjectFlowControl.CheckForSyncLockOnValueType(syncLock);
bool lockTaken = false;
checked {
try {
Monitor.Enter(syncLock, ref lockTaken);
if (ticks - _lastStatusMessageTs > 10000000 || isEssential) {
_lastStatusMessageTs = ticks;
string str = "";
if (showNumberOfExportedDocuments) {
str = " ... " + Conversions.ToString(DocumentsExported - _lastDocumentsExportedCountReported) + " document(s) exported.";
_lastDocumentsExportedCountReported = DocumentsExported;
}
StatusMessageEvent?.Invoke(new ExportEventArgs(DocumentsExported, TotalExportArtifactCount, line + str, e, _lastStatisticsSnapshot, Statistics));
}
LogStatusLine(e, line, isEssential);
} finally {
if (lockTaken)
Monitor.Exit(syncLock);
}
}
}
internal void WriteStatusLine(EventType2 e, string line, bool isEssential)
{
WriteStatusLine(e, line, isEssential, true);
}
void IStatus.WriteStatusLine(EventType2 e, string line, bool isEssential)
{
this.WriteStatusLine(e, line, isEssential);
}
internal void WriteStatusLineWithoutDocCount(EventType2 e, string line, bool isEssential)
{
long ticks = DateTime.Now.Ticks;
object syncLock = _syncLock;
ObjectFlowControl.CheckForSyncLockOnValueType(syncLock);
bool lockTaken = false;
try {
Monitor.Enter(syncLock, ref lockTaken);
if (checked(ticks - _lastStatusMessageTs) > 10000000 || isEssential) {
_lastStatusMessageTs = ticks;
_lastDocumentsExportedCountReported = DocumentsExported;
StatusMessageEvent?.Invoke(new ExportEventArgs(DocumentsExported, TotalExportArtifactCount, line, e, _lastStatisticsSnapshot, Statistics));
}
LogStatusLine(e, line, isEssential);
} finally {
if (lockTaken)
Monitor.Exit(syncLock);
}
}
void IStatus.WriteStatusLineWithoutDocCount(EventType2 e, string line, bool isEssential)
{
this.WriteStatusLineWithoutDocCount(e, line, isEssential);
}
internal void WriteError(string line)
{
Interlocked.Increment(ref _errorCount);
WriteStatusLine(EventType2.Error, line, true);
}
void IStatus.WriteError(string line)
{
this.WriteError(line);
}
internal void WriteImgProgressError(ObjectExportInfo artifact, int imageIndex, Exception ex, string notes = "")
{
StreamWriter streamWriter = new StreamWriter(_exportFile.FolderPath + "\\" + _exportFile.LoadFilesPrefix + "_img_errors.txt", true, _exportFile.LoadFileEncoding);
streamWriter.WriteLine(DateTime.Now.ToString("s"));
streamWriter.WriteLine($"""{artifact.IdentifierValue}");
if (imageIndex > -1 && artifact.Images.Count > 0)
streamWriter.WriteLine($"""{RuntimeHelpers.GetObjectValue(artifact.Images[imageIndex])}""{checked(imageIndex + 1)}""{artifact.Images.Count}""");
if (Operators.CompareString(notes, "", false) != 0)
streamWriter.WriteLine("NOTES: " + notes);
streamWriter.WriteLine("ERROR: " + ex.ToString());
streamWriter.WriteLine("");
streamWriter.Flush();
streamWriter.Close();
string line = $"""{artifact.IdentifierValue}""{ex.Message.TrimEnd(new char[1] {
'.'
})}""{_exportFile.LoadFilesPrefix}""";
WriteError(line);
}
void IStatus.WriteImgProgressError(ObjectExportInfo artifact, int imageIndex, Exception ex, string notes = "")
{
this.WriteImgProgressError(artifact, imageIndex, ex, notes);
}
internal void WriteWarningWithoutShowingExportedDocumentsCount(string line)
{
Interlocked.Increment(ref _warningCount);
WriteStatusLine(EventType2.Warning, line, true, false);
}
internal void UpdateFilesExportedCount(int nativeCount, int pdfCount, int imageCount, int longTextCount)
{
Statistics.ExportedNativeCount = nativeCount;
Statistics.ExportedPdfCount = pdfCount;
Statistics.ExportedImageCount = imageCount;
Statistics.ExportedLongTextCount = longTextCount;
}
void IStatus.UpdateFilesExportedCount(int nativeCount, int pdfCount, int imageCount, int longTextCount)
{
this.UpdateFilesExportedCount(nativeCount, pdfCount, imageCount, longTextCount);
}
internal void WriteWarning(string line)
{
Interlocked.Increment(ref _warningCount);
WriteStatusLine(EventType2.Warning, line, true);
}
void IStatus.WriteWarning(string line)
{
this.WriteWarning(line);
}
internal void WriteWarningWithoutDocCount(string line)
{
Interlocked.Increment(ref _warningCount);
WriteStatusLineWithoutDocCount(EventType2.Warning, line, true);
}
void IStatus.WriteWarningWithoutDocCount(string line)
{
this.WriteWarningWithoutDocCount(line);
}
internal void WriteUpdate(string line, bool isEssential = true)
{
WriteStatusLine(EventType2.Progress, line, isEssential);
}
void IStatus.WriteUpdate(string line, bool isEssential = true)
{
this.WriteUpdate(line, isEssential);
}
protected void UpdateStatisticsSnapshot(DateTime time)
{
if (checked(time.Ticks - _statisticsLastUpdated.Ticks) > 10000000) {
_lastStatisticsSnapshot = Statistics.ToDictionaryForProgress();
_statisticsLastUpdated = time;
StatusMessageEvent?.Invoke(new ExportEventArgs(DocumentsExported, TotalExportArtifactCount, "", EventType2.Statistics, _lastStatisticsSnapshot, Statistics));
}
}
public void UpdateDocumentExportedCount(int count)
{
DocumentsExported = count;
UpdateStatisticsSnapshot(DateTime.Now);
}
void IStatus.UpdateDocumentExportedCount(int count)
{
this.UpdateDocumentExportedCount(count);
}
public void NotifyError(string message)
{
WriteError(message);
}
void IServiceNotification.NotifyError(string message)
{
this.NotifyError(message);
}
public void NotifyStatus(string message)
{
WriteStatusLineWithoutDocCount(EventType2.Status, message, true);
}
void IServiceNotification.NotifyStatus(string message)
{
this.NotifyStatus(message);
}
public void NotifyWarning(string message)
{
WriteWarningWithoutDocCount(message);
}
void IServiceNotification.NotifyWarning(string message)
{
this.NotifyWarning(message);
}
private void _processContext_OnCancellationRequest(object sender, CancellationRequestEventArgs e)
{
_cancellationTokenSource.Cancel();
_cancelledByUser = e.RequestByUser;
if (e.RequestByUser)
_logger.LogInformation("The export cancellation request event has been raised by the user.", new object[0]);
else
_logger.LogVerbose("The export cancellation request event has been raised by the search process to perform standard cleanup.", new object[0]);
}
private void _processContext_OnExportServerErrors(object sender, ExportErrorEventArgs e)
{
string sourceFileName = _errorFile.Path();
string destFileName = Path.Combine(e.Path, $"{Settings.LoadFilesPrefix}""");
FileHelper.Move(sourceFileName, destFileName);
}
private void _downloadModeStatus_UploadModeChangeEvent(object sender, TapiMultiClientEventArgs args)
{
FileTransferMultiClientModeChangeEventEvent?.Invoke(this, args);
}
private IFileNameProvider BuildFileNameProvider()
{
IFileNameProvider value = new IdentifierExportFileNameProvider(Settings);
IFileNameProvider value2 = new ProductionExportFileNameProvider(Settings, NameTextAndNativesAfterBegBates);
CustomFileNameDescriptorModel customFileNaming = Settings.CustomFileNaming;
IFileNameProvider value3 = new CustomFileNameProvider((customFileNaming != null) ? customFileNaming.DescriptorParts().ToList() : null, new FileNamePartProviderContainer(), _exportFile.AppendOriginalFileName);
Dictionary<ExportNativeWithFilenameFrom, IFileNameProvider> fileNameProviders = new Dictionary<ExportNativeWithFilenameFrom, IFileNameProvider> {
{
ExportNativeWithFilenameFrom.Identifier,
value
},
{
ExportNativeWithFilenameFrom.Production,
value2
},
{
ExportNativeWithFilenameFrom.Custom,
value3
}
};
return new FileNameProviderContainer(Settings, fileNameProviders);
}
private string GetFileExtension(string fileName, int documentArtifactId)
{
string result = string.Empty;
if (fileName.IndexOf(".") != -1) {
result = fileName.Substring(checked(fileName.LastIndexOf(".") + 1));
result = SanitizeFileExtension(result, documentArtifactId);
}
return result;
}
private string GetFileExtensionWithDot(string fileName, int documentArtifactId)
{
string text = GetFileExtension(fileName, documentArtifactId);
if (Operators.CompareString(text, string.Empty, false) != 0)
text = "." + text;
return text;
}
private string SanitizeFileExtension(string extension, int documentArtifactId)
{
string text = extension.TrimEnd(new char[0]);
if (Operators.CompareString(text, extension, false) != 0)
_logger.LogWarning("Filename column contains trailing whitespaces. Document: {documentArtifactID}", new object[1] {
documentArtifactId
});
return text;
}
[CompilerGenerated]
private ProductionInfo _Lambda$__112-0()
{
return _productionManager.Read(Settings.CaseArtifactID, Settings.ArtifactID);
}
[CompilerGenerated]
private bool _Lambda$__137-1(ViewFieldInfo f)
{
return f.Equals(Settings.SelectedTextFields.First());
}
[CompilerGenerated]
private bool _Lambda$__137-2(ViewFieldInfo f)
{
return f.Equals(Settings.SelectedTextFields.First());
}
}
}