Пример #1
0
            private void WatchThread()
            {
                for (; ;)
                {
                    long lockSize = 0;

                    foreach (var hash in new HashSet <Hash>(_infos.ToArray().Select(n => n.Hashes).Extract()))
                    {
                        lockSize += _cacheManager.GetLength(hash);
                    }

                    if (_cacheManager.Size * ((double)this.ProtectedPercentage / 100) > lockSize)
                    {
                        break;
                    }

                    var sortedList = _infos.ToArray().ToList();
                    sortedList.Sort((x, y) => x.CreationTime.CompareTo(y.CreationTime));

                    var info = sortedList.FirstOrDefault();
                    if (info == null)
                    {
                        break;
                    }

                    foreach (var hash in info.Hashes)
                    {
                        _cacheManager.Unlock(hash);
                    }

                    _infos.Remove(info);
                }
            }
Пример #2
0
 public void Cancel()
 {
     foreach (var process in _processes.ToArray())
     {
         try
         {
             process.Kill();
         }
         catch (Exception)
         {
         }
     }
 }
Пример #3
0
 public IEnumerable <SearchListViewItemInfo> GetSearchListViewItemInfos()
 {
     return(_cacheSearchListViewItemInfos.ToArray());
 }