Initial version
This commit is contained in:
commit
e5b6226a85
68 changed files with 7338 additions and 0 deletions
36
DataTransfer.Client/Services/ChatEntry.cs
Normal file
36
DataTransfer.Client/Services/ChatEntry.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue