Ejemplo n.º 1
0
        public static void Initialize()
        {
            _currentSma       = new Dictionary <AlgorithmType, NiceHashSma>();
            _stableAlgorithms = new HashSet <AlgorithmType>();

            // _recentPaying = new Dictionary<AlgorithmType, List<double>>();
            foreach (AlgorithmType algo in Enum.GetValues(typeof(AlgorithmType)))
            {
                if (algo >= 0)
                {
                    _currentSma[algo] = new NiceHashSma
                    {
                        port   = (int)algo + 3333,
                        name   = algo.ToString().ToLower(),
                        algo   = (int)algo,
                        paying = 0
                    };
                    //_recentPaying[algo] = new List<double>
                    //{
                    //    0
                    //};
                }
            }

            Initialized = true;
        }
Ejemplo n.º 2
0
        // Public for tests only
        public static void Initialize()
        {
            _currentSma       = new Dictionary <AlgorithmType, NiceHashSma>();
            _stableAlgorithms = new HashSet <AlgorithmType>();

            Dictionary <AlgorithmType, double> cacheDict = null;

            try
            {
                var cache = File.ReadAllText(CachedFile);
                cacheDict = JsonConvert.DeserializeObject <Dictionary <AlgorithmType, double> >(cache);
            }
            catch (FileNotFoundException)
            {
            }
            catch (Exception e)
            {
                Helpers.ConsolePrint(Tag, e.ToString());
            }

            // _recentPaying = new Dictionary<AlgorithmType, List<double>>();
            foreach (AlgorithmType algo in Enum.GetValues(typeof(AlgorithmType)))
            {
                if (algo >= 0)
                {
                    var paying = 0d;

                    if (cacheDict?.TryGetValue(algo, out paying) ?? false)
                    {
                        HasData = true;
                    }

#if FILLSMA
                    paying = 1;
#endif

                    _currentSma[algo] = new NiceHashSma
                    {
                        Port   = (int)algo + 3333,
                        Name   = algo.ToString().ToLower(),
                        Algo   = (int)algo,
                        Paying = paying
                    };
                    //_recentPaying[algo] = new List<double>
                    //{
                    //    0
                    //};
                }
            }

            Initialized = true;
        }