Example #1
0
 public void ReleaseResources()
 {
     isReleased = true;
     if (OnCryptoSystemCatastrophicFailure != null)
     {
         foreach (Delegate sub in OnCryptoSystemCatastrophicFailure.GetInvocationList())
         {
             OnCryptoSystemCatastrophicFailure -= (EventHandler)sub;
         }
     }
     Trend?.Clear();
     Trend = null;
     Cache?.Clear();
     Cache = null;
     Wheel.ReleaseResources();
 }
Example #2
0
        /// <summary>
        /// remove all disabled keys, keys having an offset prior to the current search-range<para />
        /// all keys left behind by the moving search-range will never be used for anything
        /// </summary>
        /// <returns>the number of removed keys</returns>
        private int RemoveDisabledKeys()
        {
            Tuple <int, int> range        = SearchRange;
            List <int>       toBeRelieved = Cache.Keys.Where(k => k < range.Item1).ToList();

            if (toBeRelieved.Count > 0)
            {
                if (AttemptEffortUpgrade())
                {
                    return(0);
                }
                else
                {
                    OnCryptoSystemCatastrophicFailure?.Invoke(this, null);
                }
            }
            foreach (int offset in toBeRelieved)
            {
                Cache.Remove(offset);
            }
            return(toBeRelieved.Count);
        }