Skip to content

Commit

Permalink
Merge branch 'bug/error-downloading-miners'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoolls committed Mar 1, 2015
2 parents 3ddd4ac + 31aca8a commit 0245690
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions MultiMiner.Engine/MinerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ public MinerDescriptor GetMiner(DeviceKind deviceKind, CoinAlgorithm algorithm,

string algorithmName = algorithm.Name;

MinerDescriptor result = null;

if (miners.ContainsKey(algorithmName))
return Miners.Single(m => m.Name.Equals(miners[algorithmName], StringComparison.OrdinalIgnoreCase));
if (algorithm.DefaultMiner != null)
return Miners.Single(m => m.Name.Equals(algorithm.DefaultMiner, StringComparison.OrdinalIgnoreCase));
return null;
// SingleOrDefault - the user may have a config file with a backend
// miner registered that no longer exists in their Miners\ folder
result = Miners.SingleOrDefault(m => m.Name.Equals(miners[algorithmName], StringComparison.OrdinalIgnoreCase));
if ((result == null) && (algorithm.DefaultMiner != null))
result = Miners.Single(m => m.Name.Equals(algorithm.DefaultMiner, StringComparison.OrdinalIgnoreCase));

return result;
}

public MinerDescriptor GetMiner(DeviceKind deviceKind, string algorithmName, SerializableDictionary<string, string> miners)
Expand Down

0 comments on commit 0245690

Please sign in to comment.