fixes cache calculation and wrong filetransfer cast

This commit is contained in:
Stanley Dimant
2022-07-05 19:54:57 +02:00
parent f2c59bf5ad
commit 7a509fb608
3 changed files with 14 additions and 8 deletions

View File

@@ -17,8 +17,13 @@ public abstract class FileTransfer
public string Hash => TransferDto.Hash;
public bool IsInTransfer => Transferred != Total && Transferred > 0;
public bool IsTransferred => Transferred == Total;
public virtual bool CanBeTransferred => !TransferDto.IsForbidden && (((DownloadFileDto)TransferDto)?.FileExists ?? true);
public virtual bool CanBeTransferred => !TransferDto.IsForbidden && (TransferDto is not DownloadFileDto dto || dto.FileExists);
public bool IsForbidden => TransferDto.IsForbidden;
public override string ToString()
{
return Hash;
}
}
public class UploadFileTransfer : FileTransfer