async Task <BenchmarkResult> IMiner.StartBenchmark(CancellationToken stop, BenchmarkPerformanceType benchmarkType) { await Task.Delay(100); var bp = new BenchmarkResult { AlgorithmTypeSpeeds = new List <(AlgorithmType type, double speed)> { (AlgorithmType.ZHash, 12) }, Success = true }; return(GetValueOrErrorSettings.GetValueOrError("StartBenchmark", bp)); } Task <object> IMiner.StartMiningTask(CancellationToken stop) { GetValueOrErrorSettings.SetError("StartMiningTask"); return(Task.FromResult(new object())); } Task IMiner.StopMiningTask() { GetValueOrErrorSettings.SetError("StopMiningTask"); return(Task.CompletedTask); } }
async Task <BenchmarkResult> IMiner.StartBenchmark(CancellationToken stop, BenchmarkPerformanceType benchmarkType) { var bp = new BenchmarkResult { AlgorithmTypeSpeeds = new List <AlgorithmTypeSpeedPair> { new AlgorithmTypeSpeedPair(AlgorithmType.ZHash, 12) }, Success = true }; return(GetValueOrErrorSettings.GetValueOrError("StartBenchmark", bp)); }
async Task<ApiData> IMiner.GetMinerStatsDataAsync() { await Task.Delay(100); var api = new ApiData(); api.AlgorithmSpeedsTotal = new List<AlgorithmTypeSpeedPair> { new AlgorithmTypeSpeedPair(AlgorithmType.ZHash, 1) }; api.PowerUsageTotal = 1; var speedDev = new Dictionary<string, IReadOnlyList<AlgorithmTypeSpeedPair>>(); speedDev.Add("GPU-d97bdb7c-4155-9124-31b7-4743e16d3ac0", new List<AlgorithmTypeSpeedPair>() { new AlgorithmTypeSpeedPair(AlgorithmType.ZHash, 1) }); api.AlgorithmSpeedsPerDevice = speedDev; var powerDev = new Dictionary<string, int>(); powerDev.Add("GPU-d97bdb7c-4155-9124-31b7-4743e16d3ac0", 1); api.PowerUsagePerDevice = powerDev; return GetValueOrErrorSettings.GetValueOrError("GetMinerStatsDataAsync", api); }
Dictionary <BaseDevice, IReadOnlyList <Algorithm> > IMinerPlugin.GetSupportedAlgorithms(IEnumerable <BaseDevice> devices) { var supported = new Dictionary <BaseDevice, IReadOnlyList <Algorithm> >(); // TODO this will break the default loader ////// Fake device //var gpu = new BaseDevice(DeviceType.NVIDIA, "FAKE-d97bdb7c-4155-9124-31b7-4743e16d3ac0", "GTX 1070 Ti", 0); //supported.Add(gpu, new List<Algorithm>() { new Algorithm("BrokenMinerPluginUUID", AlgorithmType.ZHash), new Algorithm("BrokenMinerPluginUUID", AlgorithmType.DaggerHashimoto) }); // we support all devices foreach (var dev in devices) { supported.Add(dev, new List <Algorithm>() { new Algorithm("BrokenMinerPluginUUID", AlgorithmType.ZHash) }); } return(GetValueOrErrorSettings.GetValueOrError("GetSupportedAlgorithms", supported)); }
void IMiner.StopMining() => GetValueOrErrorSettings.SetError("StopMining");
void IMiner.InitMiningPairs(IEnumerable <MiningPair> miningPairs) => GetValueOrErrorSettings.SetError("InitMiningPairs");
void IMiner.InitMiningLocationAndUsername(string miningLocation, string username, string password) => GetValueOrErrorSettings.SetError("InitMiningLocationAndUsername");
bool IReBenchmarkChecker.ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) => GetValueOrErrorSettings.GetValueOrError("ShouldReBenchmarkAlgorithmOnDevice", false);
void IInitInternals.InitInternals() => GetValueOrErrorSettings.SetError("InitInternals");
TimeSpan IGetApiMaxTimeout.GetApiMaxTimeout() => GetValueOrErrorSettings.GetValueOrError("GetApiMaxTimeout", new TimeSpan(1, 10, 5));
IMiner IMinerPlugin.CreateMiner() => GetValueOrErrorSettings.GetValueOrError("CreateMiner", new BrokenMiner());
IEnumerable <string> IBinaryPackageMissingFilesChecker.CheckBinaryPackageMissingFiles() => GetValueOrErrorSettings.GetValueOrError("CheckBinaryPackageMissingFiles", new List <string> { "text_file_acting_as_exe.txt" });
bool IMinerPlugin.CanGroup(MiningPair a, MiningPair b) => GetValueOrErrorSettings.GetValueOrError("CanGroup", false);
TimeSpan IGetApiMaxTimeoutV2.GetApiMaxTimeout(IEnumerable <MiningPair> miningPairs) => GetValueOrErrorSettings.GetValueOrError("GetApiMaxTimeout", new TimeSpan(1, 10, 5));
IEnumerable <string> IMinerBinsSource.GetMinerBinsUrlsForPlugin() { return(GetValueOrErrorSettings.GetValueOrError("GetMinerBinsUrlsForPlugin", new List <string> { "https://github.com/nicehash/MinerDownloads/releases/download/v1.0/BrokenMinerPlugin.zip" })); }
IEnumerable <string> IBinaryPackageMissingFilesChecker.CheckBinaryPackageMissingFiles() => GetValueOrErrorSettings.GetValueOrError("CheckBinaryPackageMissingFiles", new List <string> { "bminer.exe" });