예제 #1
0
                public static CoinProfile Create(INTMinerRoot root, MineWorkData mineWorkData, Guid coinId)
                {
                    if (root.CoinSet.TryGetCoin(coinId, out ICoin coin))
                    {
                        var data = GetCoinProfileData(mineWorkData, coin.GetId());
                        if (data == null)
                        {
                            Guid  poolId = Guid.Empty;
                            IPool pool   = root.PoolSet.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.CoinId == coinId);
                            if (pool != null)
                            {
                                poolId = pool.GetId();
                            }
                            string      wallet       = coin.TestWallet;
                            Guid        coinKernelId = Guid.Empty;
                            ICoinKernel coinKernel   = root.CoinKernelSet.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.CoinId == coinId);
                            if (coinKernel != null)
                            {
                                coinKernelId = coinKernel.GetId();
                            }
                            data = CoinProfileData.CreateDefaultData(coinId, poolId, wallet, coinKernelId);
                        }
                        CoinProfile coinProfile = new CoinProfile(mineWorkData, data);

                        return(coinProfile);
                    }
                    else
                    {
                        return(Empty);
                    }
                }
예제 #2
0
                public static CoinProfile Create(INTMinerRoot root, Guid coinId)
                {
                    if (root.ServerContext.CoinSet.TryGetCoin(coinId, out ICoin coin))
                    {
                        var data = GetCoinProfileData(coin.GetId());
                        if (data == null)
                        {
                            Guid  poolId = Guid.Empty;
                            IPool pool   = root.ServerContext.PoolSet.AsEnumerable().OrderBy(a => a.SortNumber).FirstOrDefault(a => a.CoinId == coinId);
                            if (pool != null)
                            {
                                poolId = pool.GetId();
                            }
                            string wallet       = coin.TestWallet;
                            Guid   coinKernelId = GetDefaultCoinKernelId(coin);
                            data = CoinProfileData.CreateDefaultData(coinId, poolId, wallet, coinKernelId);
                        }
                        else
                        {
                            if (!root.ServerContext.CoinKernelSet.TryGetCoinKernel(data.CoinKernelId, out ICoinKernel coinKernel))
                            {
                                data.CoinKernelId = GetDefaultCoinKernelId(coin);
                            }
                        }
                        CoinProfile coinProfile = new CoinProfile(data);

                        return(coinProfile);
                    }
                    else
                    {
                        return(Empty);
                    }
                }
예제 #3
0
 public static PoolProfileData CreateDefaultData(IPool pool)
 {
     return(new PoolProfileData()
     {
         PoolId = pool.GetId(),
         UserName = pool.UserName,
         Password = pool.Password
     });
 }
예제 #4
0
 private PoolProfile(INTMinerRoot root, IPool pool)
 {
     _root = root;
     _data = GetPoolProfileData(pool.GetId());
     if (_data == null)
     {
         throw new ValidationException("未获取到PoolProfileData数据,请重试");
     }
 }
예제 #5
0
 public PoolViewModel(IPool data) : this(data.GetId())
 {
     _dataLevel    = data.DataLevel;
     _name         = data.Name;
     _coinId       = data.CoinId;
     _server       = data.Server;
     _url          = data.Url;
     _sortNumber   = data.SortNumber;
     _description  = data.Description;
     _publishState = data.PublishState;
 }
예제 #6
0
 public PoolViewModel(IPool data) : this(data.GetId())
 {
     _dataLevel  = data.DataLevel;
     _name       = data.Name;
     _coinId     = data.CoinId;
     _server     = data.Server;
     _url        = data.Url;
     _website    = data.Website;
     _sortNumber = data.SortNumber;
     _notice     = data.Notice;
     _userName   = data.UserName;
     _passWord   = data.Password;
     _isUserMode = data.IsUserMode;
 }
예제 #7
0
 public PoolViewModel(IPool data) : this(data.GetId())
 {
     this._dataLevel   = data.GetDataLevel();
     _brandId          = data.BrandId;
     _name             = data.Name;
     _coinId           = data.CoinId;
     _server           = data.Server;
     _url              = data.Url;
     _website          = data.Website;
     _sortNumber       = data.SortNumber;
     _notice           = data.Notice;
     _userName         = data.UserName;
     _passWord         = data.Password;
     _isUserMode       = data.IsUserMode;
     _tutorialUrl      = data.TutorialUrl;
     _noPool1          = data.NoPool1;
     _notPool1         = data.NotPool1;
     _minerNamePrefix  = data.MinerNamePrefix;
     _minerNamePostfix = data.MinerNamePostfix;
 }