Add directory watcher functionality

This commit is contained in:
Stone_Red
2023-12-14 17:55:20 +01:00
parent 73de6c8b5e
commit e7c3d6ea44
9 changed files with 241 additions and 9 deletions
@@ -161,6 +161,8 @@ public class FileCommands
return;
}
ApiManager.SendNotificationMessageNewLine($"Requesting file list from {ipAddress}:{port}...");
Task<List<HyperFileDto>?> sendTask = NetworkClient.SendAsync<List<HyperFileDto>>(ipAddress, port, "GetFilesList", searchString);
_ = sendTask.Wait(1000);
@@ -183,6 +185,8 @@ public class FileCommands
return;
}
index = 0;
foreach (HyperFileDto fileInfo in fileInfos)
{
index++;
@@ -227,7 +231,7 @@ public class FileCommands
string fileName = Path.GetFileName(localHyperFileInfo!.FilePath);
string filePath = Path.Combine(directoryPath, $"{fileName}.hyper");
PublicHyperFileInfo publicHyperFileInfo = new PublicHyperFileInfo(args);
PublicHyperFileInfo publicHyperFileInfo = new PublicHyperFileInfo(localHyperFileInfo.Hash);
NetworkSocket? localHost = ApiManager.GetLocalSocket();
if (localHost is null)
@@ -280,7 +284,7 @@ public class FileCommands
string fileName = Path.GetFileName(localHyperFileInfo!.FilePath);
string filePath = Path.Combine(directoryPath, $"{fileName}.hyper");
PublicHyperFileInfo publicHyperFileInfo = new PublicHyperFileInfo(args);
PublicHyperFileInfo publicHyperFileInfo = new PublicHyperFileInfo(localHyperFileInfo.Hash);
NetworkSocket? localHost = ApiManager.GetLocalSocket();
if (localHost is null)
@@ -303,7 +307,7 @@ public class FileCommands
Console.CursorLeft = 0;
Task<bool> sendTask = NetworkClient.SendAsync<bool>(ipAddress!, host.Port, "HasFile", args);
Task<bool> sendTask = NetworkClient.SendAsync<bool>(ipAddress!, host.Port, "HasFile", localHyperFileInfo.Hash);
_ = sendTask.Wait(1000);