示例#1
0
        /// <summary>
        /// Send an email if any of the miners were loaded.
        /// </summary>
        /// <param name="miners"></param>
        public async Task <Response> EmailLoadedMinersAsync()
        {
            var minersLoaded = string.Empty;
            var myMiner      = Miners[MY_INDEX];
            // Create a text list of miners that were loaded.

            var loadedMiners = Miners.Where(miner => miner.CloneCausedReload && miner.IsNewData && miner.Name != myMiner.Name).ToList();

            if (loadedMiners.Any())
            {
                loadedMiners.ForEach(miner => minersLoaded += $"{miner.Name}\r\n");

                return(await _mailUtility.SendAsync(null, null
                                                    , $"MVP: {loadedMiners.Count} Miner(s) Loaded", $"Hey,\r\n\r\nThe following miners were loaded:\r\n\r\n{minersLoaded}\r\nTHANKS!,\r\n{Constants.APPLICATION_NAME}."));
            }

            return(null);
        }
示例#2
0
        public LotusMinerSetting GetMinerByFileSize(long size, bool online)
        {
            if (Miners == null || Miners.Length == 0)
            {
                return(null);
            }
            var sectorSize  = string.Empty;
            var filterMiner = Miners.Where(m => m.Online == online).ToArray();

            if (filterMiner.Length == 0)
            {
                return(null);
            }
            var orderedMiners = filterMiner.Where(a => a.SectorSizeInBytes >= size).OrderBy(m => m.SectorSizeInBytes).ToArray();

            if (orderedMiners.Length > 0)
            {
                return(orderedMiners[RandomService.Next(0, orderedMiners.Length)]);
            }
            else
            {
                return(filterMiner[RandomService.Next(0, filterMiner.Length)]);
            }
        }