using Cysharp.Threading.Tasks; using FileSend; internal class Program { public const string rootCPath = "E:\\zRoot\\C"; private static void Main(string[] args) { Console.WriteLine("Hello, World!"); ZClient zClient = new ZClient(); zClient.StartAsync().Forget(); ConsoleKey key; while (true) { key = Console.ReadKey().Key; if (key == ConsoleKey.Q) { DirectoryInfo directoryInfo = new DirectoryInfo(rootCPath); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { zClient.C2S_ResposeFile(fileInfo); } } if (key == ConsoleKey.Escape) { zClient.CloseAsync().Forget(); break; } if (zClient.client != null && !zClient.client.Online) { break; } Thread.Sleep(100); } Console.WriteLine("断开链接"); Console.ReadLine(); } }