public static CoinKernelProfile Create(INTMinerRoot root, Guid coinKernelId) { if (root.CoinKernelSet.TryGetCoinKernel(coinKernelId, out ICoinKernel coinKernel)) { var data = GetCoinKernelProfileData(coinKernel.GetId()); if (data == null) { data = CoinKernelProfileData.CreateDefaultData(coinKernel.GetId()); } CoinKernelProfile coinProfile = new CoinKernelProfile(data); var defaultInputSegments = coinKernel.InputSegments.Where(a => a.IsDefault && a.TargetGpu.IsSupportedGpu(NTMinerRoot.Instance.GpuSet.GpuType)).ToArray(); string touchedArgs = coinProfile.TouchedArgs; if (coinProfile.CustomArgs == null) { coinProfile.CustomArgs = string.Empty; } if (string.IsNullOrEmpty(touchedArgs)) { foreach (var defaultInputSegment in defaultInputSegments) { if (!coinProfile.CustomArgs.Contains(defaultInputSegment.Segment)) { if (coinProfile.CustomArgs.Length == 0) { coinProfile.CustomArgs += defaultInputSegment.Segment; } else { coinProfile.CustomArgs += " " + defaultInputSegment.Segment; } } } } else { foreach (var defaultInputSegment in defaultInputSegments) { if (!touchedArgs.Contains(defaultInputSegment.Segment) && !coinProfile.CustomArgs.Contains(defaultInputSegment.Segment)) { if (coinProfile.CustomArgs.Length == 0) { coinProfile.CustomArgs += defaultInputSegment.Segment; } else { coinProfile.CustomArgs += " " + defaultInputSegment.Segment; } } } } return(coinProfile); } else { return(Empty); } }
public static CoinKernelProfile Create(INTMinerRoot root, Guid coinKernelId) { if (root.CoinKernelSet.TryGetKernel(coinKernelId, out ICoinKernel coinKernel)) { CoinKernelProfile coinProfile = new CoinKernelProfile(root, coinKernel); return(coinProfile); } else { return(Empty); } }
public ICoinKernelProfile GetCoinKernelProfile(Guid coinKernelId) { if (_dicById.ContainsKey(coinKernelId)) { return(_dicById[coinKernelId]); } lock (_locker) { if (_dicById.ContainsKey(coinKernelId)) { return(_dicById[coinKernelId]); } CoinKernelProfile coinKernelProfile = CoinKernelProfile.Create(_root, coinKernelId); _dicById.Add(coinKernelId, coinKernelProfile); return(coinKernelProfile); } }
public static CoinKernelProfile Create(INTMinerRoot root, MineWorkData mineWorkData, Guid coinKernelId) { if (root.CoinKernelSet.TryGetCoinKernel(coinKernelId, out ICoinKernel coinKernel)) { var data = GetCoinKernelProfileData(mineWorkData, coinKernel.GetId()); if (data == null) { data = CoinKernelProfileData.CreateDefaultData(coinKernel.GetId()); } CoinKernelProfile coinProfile = new CoinKernelProfile(mineWorkData, data); return(coinProfile); } else { return(Empty); } }
public static CoinKernelProfile Create(INTMinerRoot root, Guid coinKernelId) { if (root.ServerContext.CoinKernelSet.TryGetCoinKernel(coinKernelId, out ICoinKernel coinKernel)) { var repository = NTMinerRoot.CreateLocalRepository <CoinKernelProfileData>(); CoinKernelProfileData data = repository.GetByKey(coinKernelId); if (data == null) { double dualCoinWeight = GetDualCoinWeight(root, coinKernel.KernelId); data = CoinKernelProfileData.CreateDefaultData(coinKernel.GetId(), dualCoinWeight); } if (root.ServerContext.GroupSet.TryGetGroup(coinKernel.DualCoinGroupId, out IGroup group)) { var coinIds = root.ServerContext.CoinGroupSet.GetGroupCoinIds(coinKernel.DualCoinGroupId); if (!coinIds.Contains(data.DualCoinId)) { data.DualCoinId = coinIds.FirstOrDefault(); } } CoinKernelProfile coinProfile = new CoinKernelProfile(data); var defaultInputSegments = coinKernel.InputSegments.Where(a => a.IsDefault && a.TargetGpu.IsSupportedGpu(NTMinerRoot.Instance.GpuSet.GpuType)).ToArray(); string touchedArgs = coinProfile.TouchedArgs; if (coinProfile.CustomArgs == null) { coinProfile.CustomArgs = string.Empty; } if (string.IsNullOrEmpty(touchedArgs)) { foreach (var defaultInputSegment in defaultInputSegments) { if (!coinProfile.CustomArgs.Contains(defaultInputSegment.Segment)) { if (coinProfile.CustomArgs.Length == 0) { coinProfile.CustomArgs += defaultInputSegment.Segment; } else { coinProfile.CustomArgs += " " + defaultInputSegment.Segment; } } } } else { foreach (var defaultInputSegment in defaultInputSegments) { if (!touchedArgs.Contains(defaultInputSegment.Segment) && !coinProfile.CustomArgs.Contains(defaultInputSegment.Segment)) { if (coinProfile.CustomArgs.Length == 0) { coinProfile.CustomArgs += defaultInputSegment.Segment; } else { coinProfile.CustomArgs += " " + defaultInputSegment.Segment; } } } } return(coinProfile); } else { return(Empty); } }
public void SetCoinKernelProfileProperty(Guid coinKernelId, string propertyName, object value) { CoinKernelProfile coinKernelProfile = (CoinKernelProfile)GetCoinKernelProfile(coinKernelId); coinKernelProfile.SetValue(propertyName, value); }