/// <summary>
        /// Handler to create multiple mining sessions if needed
        /// </summary>
        private void SetupLocalMiners()
        {
            // This logic will be moved to a class to setup the local miners and add them to the mining session
            // This will be done via config file and API calls necessary based on the coins being mined, etc.
            MiningSession.RemoveAllMiners();

            // Call API and retrieve a list of miner configurations used to start mining
            List <MinerConfigResponse> minerConfigResponseList = GetMinerConfigurations();

            // Build the Request to call the API and retrieve the miner config strings
            List <AccountWallet> accountWalletList = new List <AccountWallet>();

            // Get configurations needed for building API request from Application settings
            accountWalletList = (List <AccountWallet>)Application.Current.Properties["AccountWalletList"];

            // Iterate through returned responses from API and initialize miners
            foreach (MinerConfigResponse minerConfigResponse in minerConfigResponseList)
            {
                // Create miner session
                Miner miner = MinerFactory.CreateMiner(minerConfigResponse.MinerBaseType, minerConfigResponse.HardwareType);
                miner.CoinType       = minerConfigResponse.CoinSelectedForMining;
                miner.MinerArguments = minerConfigResponse.MinerConfigString;
                miner.Address        = accountWalletList.Find(x => x.CoinType == miner.CoinType.ToString()).WalletAddress;
                MiningSession.AddMiner(miner);
                ShowInformation(string.Format("Mining started {0} {1}", minerConfigResponse.MinerBaseType, minerConfigResponse.MinerConfigString));
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            System.Console.WriteLine(BANNER);

            Console.WriteLine($@"BPM home directory: {Core.GetBPMBaseUserDirectory()}");
            Console.WriteLine($@"BPM miners directory: {Core.GetBaseMinersDir()}");
            var minerAccount  = MinerAccount.Init();
            var miningSession = new MiningSession();

            miningSession.RemoveAllMiners();
            System.Console.WriteLine($@"Account Id: {minerAccount.AccountId}");
            System.Console.WriteLine($@"Region: {minerAccount.Region}");
            System.Console.WriteLine($@"Worker: {minerAccount.WorkerSettings.WorkerName}");
            System.Console.WriteLine(@"Configured Wallets:");
            minerAccount.AccountWalletList.Select(w => $@"  {w.CoinName}: {w.WalletAddress}")
            .ToList().ForEach(System.Console.WriteLine);

            // Call API and retrieve a list of miner configurations used to start mining
            List <MinerConfigResponse> minerConfigResponseList = GetMinerConfigurations(minerAccount);
            var hardwareMonitor = new LinuxHardwareMonitor();
            var minerFactory    = new MinerFactory(hardwareMonitor);

            // Iterate through returned responses from API and initialize miners
            foreach (MinerConfigResponse minerConfigResponse in minerConfigResponseList)
            {
                // Create miner session
                var miner = minerFactory.CreateMiner(minerConfigResponse.MinerBaseType, minerConfigResponse.HardwareType);
                miner.CoinType       = minerConfigResponse.CoinSelectedForMining;
                miner.MinerArguments = minerConfigResponse.MinerConfigString;
                miningSession.AddMiner(miner);
                System.Console.WriteLine(string.Format("Mining started {0} {1}", minerConfigResponse.MinerBaseType, minerConfigResponse.MinerConfigString));
            }

            System.Console.ReadLine();
        }
예제 #3
0
        /// <summary>
        /// Handler to create multiple mining sessions if needed
        /// </summary>
        private void SetupLocalMiners()
        {
            // This logic will be moved to a class to setup the local miners and add them to the mining session
            // This will be done via config file and API calls necessary based on the coins being mined, etc.
            MiningSession.RemoveAllMiners();

            // Call API and retrieve a list of miner configurations used to start mining
            List <MinerConfigResponse> minerConfigResponseList = GetMinerConfigurations();

            // Iterate through returned responses from API and initialize miners
            var minerFactory = new MinerFactory(new WindowsHardwareMonitor());

            foreach (MinerConfigResponse minerConfigResponse in minerConfigResponseList)
            {
                // Create miner session
                var miner = minerFactory.CreateMiner(minerConfigResponse.MinerBaseType, minerConfigResponse.HardwareType);
                miner.CoinType       = minerConfigResponse.CoinSelectedForMining;
                miner.MinerArguments = minerConfigResponse.MinerConfigString;
                MiningSession.AddMiner(miner);
                ShowInformation(string.Format("Mining started {0} {1}", minerConfigResponse.MinerBaseType, minerConfigResponse.MinerConfigString));
            }
        }