Exemple #1
0
        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));
        }
Exemple #3
0
 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);
 }
Exemple #4
0
        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");
Exemple #8
0
 bool IReBenchmarkChecker.ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) =>
 GetValueOrErrorSettings.GetValueOrError("ShouldReBenchmarkAlgorithmOnDevice", false);
Exemple #9
0
 void IInitInternals.InitInternals() => GetValueOrErrorSettings.SetError("InitInternals");
Exemple #10
0
 TimeSpan IGetApiMaxTimeout.GetApiMaxTimeout() => GetValueOrErrorSettings.GetValueOrError("GetApiMaxTimeout", new TimeSpan(1, 10, 5));
Exemple #11
0
 IMiner IMinerPlugin.CreateMiner() => GetValueOrErrorSettings.GetValueOrError("CreateMiner", new BrokenMiner());
Exemple #12
0
 IEnumerable <string> IBinaryPackageMissingFilesChecker.CheckBinaryPackageMissingFiles() =>
 GetValueOrErrorSettings.GetValueOrError("CheckBinaryPackageMissingFiles", new List <string> {
     "text_file_acting_as_exe.txt"
 });
Exemple #13
0
 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"
     }));
 }
Exemple #16
0
 IEnumerable <string> IBinaryPackageMissingFilesChecker.CheckBinaryPackageMissingFiles() =>
 GetValueOrErrorSettings.GetValueOrError("CheckBinaryPackageMissingFiles", new List <string> {
     "bminer.exe"
 });