LongTextStreamResult
class LongTextStreamResult
Represents a class object with long text stream result details.
using System;
using System.IO;
namespace Relativity.DataExchange.Transfer
{
internal class LongTextStreamResult
{
public TimeSpan Duration { get; }
public string File { get; }
public string FileName {
get {
if (string.IsNullOrWhiteSpace(File))
return string.Empty;
return Path.GetFileName(File);
}
}
public Exception Issue { get; }
public long Length { get; }
public LongTextStreamRequest Request { get; }
public int RetryCount { get; }
public bool Successful => Issue == null;
private LongTextStreamResult(LongTextStreamRequest request, string file, long length, int retryCount, TimeSpan duration, Exception issue)
{
Request = request.ThrowIfNull("request");
File = file;
Length = length;
RetryCount = retryCount;
Duration = duration;
Issue = issue;
}
public static LongTextStreamResult CreateNonFatalIssueResult(LongTextStreamRequest request, int retryCount, Exception issue)
{
return new LongTextStreamResult(request, null, 0, retryCount, TimeSpan.Zero, issue);
}
public static LongTextStreamResult CreateSuccessfulResult(LongTextStreamRequest request, string file, long length, int retryCount, TimeSpan duration)
{
return new LongTextStreamResult(request, file, length, retryCount, duration, null);
}
}
}