Closed gradinkov closed 6 years ago
An alternative option would be a command line argument to point to a different JSON file.
{
"ActiveProfile":2,
"Profiles":
[
{
"Worker":"desktop",
"Coin":"zec",
"Pool":"suprnova",
"Miner":"dstm"
},
{
"Worker":"desktop",
"Coin":"btcp",
"Pool":"suprnova",
"Miner":"excavator"
}
]
}
Quick solution:
{
"ActiveProfile":0,
"Profiles":[
{
"Pool":"zpool",
"Algo":"equihash",
"Coin":"",
"Miner":"dstm",
"Worker":"rudehash",
"Currency":"USD",
"ElectricityCost":0.1,
"Watchdog":true,
"Debug":false,
"MonitoringKey":"",
"MphApiKey":"",
"Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
"WalletIsAltcoin":false,
"User":"",
"Region":"",
"ExtraArgs":""
},
{
"Pool":"zergpool",
"Algo":"hsr",
"Coin":"",
"Miner":"hsrminer-hsr",
"Worker":"rudehash",
"Currency":"USD",
"ElectricityCost":0.1,
"Watchdog":false,
"Debug":true,
"MonitoringKey":"",
"MphApiKey":"",
"Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
"WalletIsAltcoin":false,
"User":"",
"Region":"",
"ExtraArgs":""
}
]
}
Final, preferred form:
{
"Debug":false,
"Worker":"rudehash",
"Currency":"USD",
"ElectricityCost":0.1,
"MonitoringKey":"",
"MphApiKey":"",
"ActiveProfile":0,
"Profiles":[
{
"Pool":"zpool",
"Algo":"equihash",
"Coin":"",
"Miner":"dstm",
"Watchdog":true,
"Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
"WalletIsAltcoin":false,
"User":"",
"Region":"",
"ExtraArgs":""
},
{
"Pool":"zergpool",
"Algo":"hsr",
"Coin":"",
"Miner":"hsrminer-hsr",
"Watchdog":false,
"Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
"WalletIsAltcoin":false,
"User":"",
"Region":"",
"ExtraArgs":""
}
]
}
Config generator + validator is ready. Now "all" that's left is actually using it that way. It seems there's a totally 1:1 match between JSON arrays/hashtables and PS arrays/hashtables so it should be pretty doable.
Certain keys will be on different levels, that's a change.
Gotta decide if I want to request user input on the active profile, or just use the JSON option. Hmm...
Or maybe, just maybe, it could be another config option lol. AskForProfile
or something. If having such an option, gotta make sure that there's a timeout, otherwise mining will stop after a restart. Make sure to update ActiveProfile after each startup. Also do some pretty-print / format-table for the profiles.
FRW/compatcheck will not cover adding new profiles on top of the current one. done, only checks selected profile
Also gotta figure out indexing, config generator starts at 1! done, indexes are shifted
Will have to test if PowerShell reorders profiles, coz then we're in trouble. Then we gotta add an ID field and do some stupid lookups instead of direct indexing. But this will make validation way more difficult. Would prefer some sort of manual enforced sorting. Arraylists are not reordered apparently.
Select all when clicking in the json textarea done
Generate uuid from js done
Add to website for easy access? Or do installer, then we can have nice shortcuts.
Website is yes and no, it's neat to have, but it'll always validate against the latest schema, while the user may not have that. Prolly go the installer route, it has a lot of benefits.
I'll leave AskForProfile
for now.
Here's the example structure of a current JSON (there's more settings in real life, but this is just for demonstration):
This could be changed to something like this:
And then a "multi-profile" config would look like:
If there's only one, RH would just start mining as it does now. But if RH detects that there's more than 1 profile, it'd ask the user to select one.
Now the only question that remains is, how well does PowerShell's ConvertTo/From-Json handle this.