示例#1
0
        private void Init(INTMinerContext root)
        {
            var minerProfileRepository = root.ServerContext.CreateLocalRepository <MinerProfileData>();

            _data = minerProfileRepository.GetAll().FirstOrDefault();
            var mineWorkRepository = root.ServerContext.CreateLocalRepository <MineWorkData>();

            MineWork = mineWorkRepository.GetAll().FirstOrDefault();
            if (_data == null)
            {
                Guid  coinId = Guid.Empty;
                ICoin coin   = root.ServerContext.CoinSet.AsEnumerable().OrderBy(a => a.Code).FirstOrDefault();
                if (coin != null)
                {
                    coinId = coin.GetId();
                }
                _data = MinerProfileData.CreateDefaultData(coinId);
            }
            else
            {
                // 交换到注册表以供守护进程访问
                if (ClientAppType.IsMinerClient && !NTMinerContext.IsJsonLocal)
                {
                    SetIsOuterUserEnabled(_data.IsOuterUserEnabled);
                    SetOuterUserId(_data.OuterUserId);
                }
            }
            if (_coinProfileSet == null)
            {
                _coinProfileSet = new CoinProfileSet(root);
            }
            else
            {
                _coinProfileSet.Refresh();
            }
            if (_coinKernelProfileSet == null)
            {
                _coinKernelProfileSet = new CoinKernelProfileSet(root);
            }
            else
            {
                _coinKernelProfileSet.Refresh();
            }
            if (_poolProfileSet == null)
            {
                _poolProfileSet = new PoolProfileSet(root);
            }
            else
            {
                _poolProfileSet.Refresh();
            }
            if (_walletSet == null)
            {
                _walletSet = new WalletSet(root);
            }
            else
            {
                _walletSet.Refresh();
            }
        }
示例#2
0
 private void Init(INTMinerRoot root, MineWorkData mineWorkData)
 {
     MineWork  = mineWorkData;
     isUseJson = mineWorkData != null;
     if (isUseJson)
     {
         _data = NTMinerRoot.LocalJson.MinerProfile;
     }
     else
     {
         IRepository <MinerProfileData> repository = NTMinerRoot.CreateLocalRepository <MinerProfileData>(false);
         _data = repository.GetAll().FirstOrDefault();
     }
     if (_data == null)
     {
         Guid  coinId = Guid.Empty;
         ICoin coin   = root.CoinSet.OrderBy(a => a.SortNumber).FirstOrDefault();
         if (coin != null)
         {
             coinId = coin.GetId();
         }
         _data = MinerProfileData.CreateDefaultData(coinId);
     }
     if (_coinProfileSet == null)
     {
         _coinProfileSet = new CoinProfileSet(root, mineWorkData);
     }
     else
     {
         _coinProfileSet.Refresh(mineWorkData);
     }
     if (_coinKernelProfileSet == null)
     {
         _coinKernelProfileSet = new CoinKernelProfileSet(root, mineWorkData);
     }
     else
     {
         _coinKernelProfileSet.Refresh(mineWorkData);
     }
     if (_poolProfileSet == null)
     {
         _poolProfileSet = new PoolProfileSet(root, mineWorkData);
     }
     else
     {
         _poolProfileSet.Refresh(mineWorkData);
     }
     if (_walletSet == null)
     {
         _walletSet = new WalletSet(root);
     }
     else
     {
         _walletSet.Refresh();
     }
 }
示例#3
0
        private void Init(INTMinerRoot root)
        {
            IRepository <MinerProfileData> minerProfileRepository = NTMinerRoot.CreateLocalRepository <MinerProfileData>();

            _data = minerProfileRepository.GetAll().FirstOrDefault();
            IRepository <MineWorkData> mineWorkRepository = NTMinerRoot.CreateLocalRepository <MineWorkData>();

            MineWork = mineWorkRepository.GetAll().FirstOrDefault();
            if (_data == null)
            {
                Guid  coinId = Guid.Empty;
                ICoin coin   = root.CoinSet.OrderBy(a => a.Code).FirstOrDefault();
                if (coin != null)
                {
                    coinId = coin.GetId();
                }
                _data = MinerProfileData.CreateDefaultData(coinId);
            }
            if (_coinProfileSet == null)
            {
                _coinProfileSet = new CoinProfileSet(root);
            }
            else
            {
                _coinProfileSet.Refresh();
            }
            if (_coinKernelProfileSet == null)
            {
                _coinKernelProfileSet = new CoinKernelProfileSet(root);
            }
            else
            {
                _coinKernelProfileSet.Refresh();
            }
            if (_poolProfileSet == null)
            {
                _poolProfileSet = new PoolProfileSet(root);
            }
            else
            {
                _poolProfileSet.Refresh();
            }
            if (_walletSet == null)
            {
                _walletSet = new WalletSet(root);
            }
            else
            {
                _walletSet.Refresh();
            }
        }