36 lines
No EOL
994 B
C#
36 lines
No EOL
994 B
C#
namespace DataTransfer.Client.Services;
|
|
|
|
public enum ChatEntryKind
|
|
{
|
|
Incoming,
|
|
Outgoing,
|
|
System
|
|
}
|
|
|
|
public sealed class ChatEntry
|
|
{
|
|
public DateTimeOffset Time { get; } = DateTimeOffset.Now;
|
|
|
|
public bool IsFile => FileName is not null;
|
|
|
|
public bool IsTransferring => IsFile && Error is null && TransferredBytes < FileSize;
|
|
|
|
public int ProgressPercent => FileSize == 0 ? 100 : (int)(TransferredBytes * 100 / FileSize);
|
|
public required ChatEntryKind Kind { get; init; }
|
|
|
|
public string? Text { get; init; }
|
|
|
|
public string? FileName { get; init; }
|
|
|
|
public long FileSize { get; init; }
|
|
|
|
public long TransferredBytes { get; set; }
|
|
|
|
/// <summary>Object URL of a completely received and decrypted file.</summary>
|
|
public string? DownloadUrl { get; set; }
|
|
|
|
/// <summary>A received file whose type can run code or is often used for malware or phishing.</summary>
|
|
public bool IsRiskyFile { get; init; }
|
|
|
|
public string? Error { get; set; }
|
|
} |