/// <summary> 获取下好的文件 返回null则需要等待 </summary>
        public IBufferPlayEntity GetWaitCurrent(Predicate <IBufferPlayEntity> match, Action <bool, int, int> action)
        {
            var result = this._entitys.Find(match);

            int now = this._entitys.FindIndex(match);

            _current = result;

            if (result.IsLoaded == 2)
            {
                return(result);
            }
            else
            {
                //  Message:停止上一个获取任务
                flag = false;

                _semaphore.WaitOne();

                flag = true;

                var waitCache = _entitys.Skip(now).Take(this.Capacity).ToList();

                while (!waitCache.TrueForAll(l => l.IsLoaded == 2))
                {
                    if (!flag)
                    {
                        _semaphore.Release();
                        return(null);
                    }

                    Thread.Sleep(500);

                    action(false, waitCache.FindAll(l => l.IsLoaded == 2).Count, waitCache.Count);
                }

                action(true, waitCache.FindAll(l => l.IsLoaded == 2).Count, waitCache.Count);

                _semaphore.Release();
                return(result);
            }
        }
        public BufferPlayEngine(List <IBufferPlayEntity> entitys)
        {
            _entitys = entitys;

            _current = entitys.First();
        }