LineNativeFilePath
using kCura.WinEDDS;
using kCura.WinEDDS.Exporters;
using kCura.WinEDDS.LoadFileEntry;
using Relativity.DataExchange.Export.VolumeManagerV2.Directories;
using Relativity.DataExchange.Logger;
using Relativity.Logging;
using System;
namespace Relativity.DataExchange.Export.VolumeManagerV2.Metadata.Natives
{
public class LineNativeFilePath : ILineNativeFilePath
{
private readonly ILoadFileCellFormatter _loadFileCellFormatter;
private readonly ExportFile _exportSettings;
private readonly IFilePathTransformer _filePathTransformer;
private readonly ILog _logger;
public LineNativeFilePath(ILoadFileCellFormatter loadFileCellFormatter, ExportFile exportSettings, IFilePathTransformer filePathTransformer, ILog logger)
{
_loadFileCellFormatter = loadFileCellFormatter;
_exportSettings = exportSettings;
_filePathTransformer = filePathTransformer;
_logger = logger;
}
public void AddNativeFilePath(DeferredEntry loadFileEntry, ObjectExportInfo artifact)
{
if (_exportSettings.ExportNative) {
_logger.LogVerbose("Exporting natives, so adding path to load file entry.", Array.Empty<object>());
string partialEntry;
if (_exportSettings.VolumeInfo.CopyNativeFilesFromRepository) {
string text = string.IsNullOrWhiteSpace(artifact.NativeTempLocation) ? artifact.NativeTempLocation : _filePathTransformer.TransformPath(artifact.NativeTempLocation);
partialEntry = _loadFileCellFormatter.CreateNativeCell(text, artifact);
_logger.LogVerbose("Copying natives, so path is local {path}.", new object[1] {
text.Secure()
});
} else {
_logger.LogVerbose("Not copying natives, so path is remote {path}.", new object[1] {
artifact.NativeSourceLocation.Secure()
});
partialEntry = _loadFileCellFormatter.CreateNativeCell(artifact.NativeSourceLocation, artifact);
}
loadFileEntry.AddStringEntry(partialEntry);
}
}
}
}