/// <summary> /// 强制关闭aria2c服务器 /// </summary> /// <returns></returns> public static bool ForceCloseServer() { var task = AriaClient.ForceShutdownAsync(); if (task.Result != null && task.Result.Result != null && task.Result.Result == "OK") { return(true); } return(false); }
/// <summary> /// 强制关闭aria2c服务器,异步方法 /// </summary> /// <returns></returns> public static async Task <bool> ForceCloseServerAsync() { //await Task.Run(() => //{ // if (Server == null) { return; } // Server.Kill(); // Server = null; // 将Server指向null //}); //return true; await AriaClient.ForceShutdownAsync(); return(true); }