示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }