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

HtmlCellFormatter

using System; using System.Collections; using System.Text; using System.Web; namespace kCura.WinEDDS.Exporters { [Obsolete] public class HtmlCellFormatter : ILoadFileCellFormatter { private ExportFile _settings; private const string ROW_PREFIX = "<tr>"; private const string ROW_SUFFIX = "</tr>"; private const string HyperlinkTagTemplate = "<a style='display:block' href='{0}'>{1}</a>"; private const string CellTagTemplate = "<td>{0}</td>"; public string RowPrefix => "<tr>"; public string RowSuffix => "</tr>"; public HtmlCellFormatter(ExportFile settings) { _settings = settings; } public string TransformToCell(string contents) { contents = HttpUtility.HtmlEncode(contents); return string.Format("{0}{1}{2}", "<td>", contents, "</td>"); } string ILoadFileCellFormatter.TransformToCell(string contents) { return this.TransformToCell(contents); } private string GetNativeHtmlString(ObjectExportInfo artifact, string location) { if (_settings.ArtifactTypeID == 10 && artifact.NativeCount == 0) return string.Empty; if (_settings.ArtifactTypeID != 10 && artifact.FileID <= 0) return string.Empty; return $"""{location}""{artifact.NativeFileName(_settings.AppendOriginalFileName)}"""; } private string GetPdfHtmlString(ObjectExportInfo artifact, string location) { if (_settings.ArtifactTypeID == 10 && artifact.HasPdf) return $"""{location}""{artifact.PdfFileName(artifact.IdentifierValue, _settings.AppendOriginalFileName)}"""; return string.Empty; } private string GetImagesHtmlString(ObjectExportInfo artifact) { if (artifact.Images.Count != 0) { StringBuilder stringBuilder = new StringBuilder(); IEnumerator enumerator = default(IEnumerator); try { enumerator = artifact.Images.GetEnumerator(); while (enumerator.MoveNext()) { ImageExportInfo imageExportInfo = (ImageExportInfo)enumerator.Current; string arg = imageExportInfo.TempLocation; if (!_settings.VolumeInfo.CopyImageFilesFromRepository) arg = imageExportInfo.SourceLocation; stringBuilder.AppendFormat("<a style='display:block' href='{0}'>{1}</a>", arg, imageExportInfo.FileName); int? nullable = (int?)_settings.TypeOfImage; if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 1) : null).GetValueOrDefault()) break; nullable = (int?)_settings.TypeOfImage; if ((nullable.HasValue ? new bool?(nullable.GetValueOrDefault() == 2) : null).GetValueOrDefault()) break; } } finally { if (enumerator is IDisposable) (enumerator as IDisposable).Dispose(); } return stringBuilder.ToString(); } return ""; } public string CreateImageCell(ObjectExportInfo artifact) { if (_settings.ExportImages && _settings.ArtifactTypeID == 10) return $"""{GetImagesHtmlString(artifact)}"""; return string.Empty; } string ILoadFileCellFormatter.CreateImageCell(ObjectExportInfo artifact) { return this.CreateImageCell(artifact); } public string CreateNativeCell(string location, ObjectExportInfo artifact) { return $"""{GetNativeHtmlString(artifact, location)}"""; } string ILoadFileCellFormatter.CreateNativeCell(string location, ObjectExportInfo artifact) { return this.CreateNativeCell(location, artifact); } public string CreatePdfCell(string location, ObjectExportInfo artifact) { return $"""{GetPdfHtmlString(artifact, location)}"""; } string ILoadFileCellFormatter.CreatePdfCell(string location, ObjectExportInfo artifact) { return this.CreatePdfCell(location, artifact); } } }