|
@@ -12,10 +12,16 @@ public class ClientProvider(IClientCaller clientCaller, IClientBaseProvider base
|
|
//Receive Files from Server
|
|
//Receive Files from Server
|
|
public Task<bool> PushFile(Guid guid, FileType fileType, byte[] buffer, int current, int total)
|
|
public Task<bool> PushFile(Guid guid, FileType fileType, byte[] buffer, int current, int total)
|
|
{
|
|
{
|
|
|
|
+ if (baseProvider is null)
|
|
|
|
+ return Task.FromResult(false);
|
|
|
|
+
|
|
if (!_streamBuffer.TryGetValue(fileType, out MemoryStream? stream) || stream is null)
|
|
if (!_streamBuffer.TryGetValue(fileType, out MemoryStream? stream) || stream is null)
|
|
{
|
|
{
|
|
if (current != 1)
|
|
if (current != 1)
|
|
return Task.FromResult(false);
|
|
return Task.FromResult(false);
|
|
|
|
+ if (!baseProvider.AllowReceiveFile())
|
|
|
|
+ return Task.FromResult(false);
|
|
|
|
+
|
|
baseProvider?.StartFileReceiveNotify(fileType);
|
|
baseProvider?.StartFileReceiveNotify(fileType);
|
|
stream = new();
|
|
stream = new();
|
|
_streamBuffer[fileType] = stream;
|
|
_streamBuffer[fileType] = stream;
|
|
@@ -104,6 +110,7 @@ public interface IClientBaseProvider
|
|
string? RecipePath { get; set; }
|
|
string? RecipePath { get; set; }
|
|
string? ConfigPath { get; set; }
|
|
string? ConfigPath { get; set; }
|
|
|
|
|
|
|
|
+ bool AllowReceiveFile();
|
|
void FileReceivedNotify(FileType fileType);
|
|
void FileReceivedNotify(FileType fileType);
|
|
void StartFileReceiveNotify(FileType fileType);
|
|
void StartFileReceiveNotify(FileType fileType);
|
|
}
|
|
}
|