/// <summary>
        /// 添加任务
        /// </summary>
        /// <param name="poltConfig"></param>
        /// <param name="chiaSetting"></param>
        /// <returns></returns>
        public static int SaveTask(string id, PoltConfig poltConfig, ChiaSetting chiaSetting)
        {
            ChinPoltTask _task = null;

            if (string.IsNullOrEmpty(id))
            {
                _task = new ChinPoltTask()
                {
                    completeNumber  = 0,
                    currentProgress = "--/--",
                    id          = Guid.NewGuid().ToString(),
                    poltConfig  = poltConfig,
                    chiaSetting = chiaSetting,
                    status      = TaskStatusEnum.Stop
                };
                //任务开始前检查硬盘空间状态
                _task.BeforeTaskStart += (sender =>
                {
                    return(CheckedTaskHardDiskFreeSpace(sender));
                });
                ChinPoltTasks.Add(_task);
            }
            else
            {
                _task = ChinPoltTasks.FirstOrDefault(f1 => f1.id == id);
                _task.Stop();
                _task.chiaSetting = chiaSetting;
                _task.poltConfig  = poltConfig;
            }
            Task.Factory.StartNew(() => _task.Start(new System.Threading.CancellationTokenSource()));
            return(0);
        }
        /// <summary>
        /// 检查任务开始在硬盘空间上是否合适
        /// </summary>
        /// <param name="poltPath"></param>
        /// <param name="ksize"></param>
        /// <returns></returns>
        public static bool CheckedTaskHardDiskFreeSpace(ChinPoltTask task)
        {
            var code = task.poltConfig.finalPath.Split(':').FirstOrDefault();
            //最终保存目录剩余空间
            var _freeSpace = GetHardDiskFreeSpace(code);
            //当前任务保存需要的空间
            var _needSize = kSizeDictionary.Where(w1 => w1.Item1 == task.poltConfig.stripeSize).FirstOrDefault().Item2;

            //当前在运行的P图需要的空间
            ChinPoltTasks
            .Where(w1 => w1.poltConfig.finalPath.Split(':').FirstOrDefault().Equals(code) && w1.status == TaskStatusEnum.Runing)
            .ToList()
            .ForEach(f1 =>
            {
                _needSize += kSizeDictionary.Where(w1 => w1.Item1 == f1.poltConfig.stripeSize).FirstOrDefault().Item2;
            });
            LogerHelper.logger.Info($"任务编号{task.id}当前系统存储空间{_freeSpace}GB,需要空间{_needSize}GB。");
            return(_freeSpace > _needSize);
        }