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

ErrorFileService

public class ErrorFileService
using kCura.WinEDDS.Service; using kCura.WinEDDS.Service.Replacement; using Relativity.DataExchange; using Relativity.DataExchange.Io; using Relativity.DataExchange.Legacy.Service.RelativityDistributed; using Relativity.DataExchange.Service; using Relativity.DataExchange.Service.RelativityDistributed; using Relativity.Logging; using System; using System.Net; using System.Runtime.CompilerServices; using System.Threading; namespace kCura.WinEDDS { public class ErrorFileService { public delegate void UploadStatusEventEventHandler (string message); [Serializable] [CompilerGenerated] internal sealed class _Closure$__ { public static readonly _Closure$__ $I; public static Func<string> $I12-0; static _Closure$__() { $I = new _Closure$__(); } internal string _Lambda$__12-0() { return Settings.AuthenticationToken; } } private readonly IFileIO _fileIoService; private readonly IRelativityDistributedFacade _relativityDistributedFacade; [CompilerGenerated] private UploadStatusEventEventHandler UploadStatusEventEvent; public event UploadStatusEventEventHandler UploadStatusEvent { [CompilerGenerated] add { UploadStatusEventEventHandler uploadStatusEventEventHandler = UploadStatusEventEvent; UploadStatusEventEventHandler uploadStatusEventEventHandler2; do { uploadStatusEventEventHandler2 = uploadStatusEventEventHandler; UploadStatusEventEventHandler value2 = (UploadStatusEventEventHandler)Delegate.Combine(uploadStatusEventEventHandler2, value); uploadStatusEventEventHandler = Interlocked.CompareExchange(ref UploadStatusEventEvent, value2, uploadStatusEventEventHandler2); } while ((object)uploadStatusEventEventHandler != uploadStatusEventEventHandler2); } [CompilerGenerated] remove { UploadStatusEventEventHandler uploadStatusEventEventHandler = UploadStatusEventEvent; UploadStatusEventEventHandler uploadStatusEventEventHandler2; do { uploadStatusEventEventHandler2 = uploadStatusEventEventHandler; UploadStatusEventEventHandler value2 = (UploadStatusEventEventHandler)Delegate.Remove(uploadStatusEventEventHandler2, value); uploadStatusEventEventHandler = Interlocked.CompareExchange(ref UploadStatusEventEvent, value2, uploadStatusEventEventHandler2); } while ((object)uploadStatusEventEventHandler != uploadStatusEventEventHandler2); } } public ErrorFileService(NetworkCredential credentials, string downloadHandlerUrl, CookieContainer cookieContainer, Func<string> correlationIdFunc) { _fileIoService = ManagerFactory.CreateFileIO(credentials, cookieContainer, 2147483647, correlationIdFunc); _relativityDistributedFacade = CreateRelativityDistributedFacade(credentials, downloadHandlerUrl, cookieContainer, correlationIdFunc); } public bool DownloadErrorFile(string localFilePath, string remoteFileGuid, CaseInfo caseInfo) { return DownloadErrorFile(localFilePath, remoteFileGuid, caseInfo, true); } public bool DownloadErrorFile(string localFilePath, string remoteFileGuid, CaseInfo caseInfo, bool removeErrorFileOnServer) { FileDownloadRequest request = new FileDownloadRequest(localFilePath, caseInfo.ArtifactID.ToString(), remoteFileGuid); FileDownloadResponse fileDownloadResponse = _relativityDistributedFacade.DownloadFile(request); if (!fileDownloadResponse.IsSuccess) HandleFileDownloadFailureAndThrowException(fileDownloadResponse); if (removeErrorFileOnServer) _fileIoService.RemoveTempFile(caseInfo.ArtifactID, remoteFileGuid); return true; } public void RemoveErrorFile(string remoteFileGuid, CaseInfo caseInfo) { _fileIoService.RemoveTempFile(caseInfo.ArtifactID, remoteFileGuid); } private void HandleFileDownloadFailureAndThrowException(FileDownloadResponse fileDownloadResponse) { string str = "Error Downloading File"; if (fileDownloadResponse.ErrorType == RelativityDistributedErrorType.Authentication) str = "Error Downloading File: unable to authenticate against Distributed server"; else if (fileDownloadResponse.ErrorType == RelativityDistributedErrorType.DataCorrupted) { str = "Error Downloading File: received different number of bytes than expected"; } else if (fileDownloadResponse.ErrorType == RelativityDistributedErrorType.NotFound) { str = "Error Downloading File: the file cannot be found"; } UploadStatusEventEvent?.Invoke("Error Downloading File"); throw new ApplicationException(str + "\r\n", fileDownloadResponse.Exception); } private static IRelativityDistributedFacade CreateRelativityDistributedFacade(NetworkCredential credentials, string downloadHandlerUrl, CookieContainer cookieContainer, Func<string> correlationIdFunc) { IReLoginService reLoginService = ManagerFactory.CreateUserManager(credentials, cookieContainer, correlationIdFunc); return new RelativityDistributedFacadeFactory(Log.get_Logger(), AppSettings.Instance, reLoginService, FileSystem.Instance.File, (_Closure$__.$I12-0 != null) ? _Closure$__.$I12-0 : (_Closure$__.$I12-0 = (() => Settings.AuthenticationToken))).Create(downloadHandlerUrl, credentials, cookieContainer, correlationIdFunc); } } }