MultiPoolMiner / MultiPoolMiner

Monitors crypto mining pools in real-time in order to find the most profitable for your machine. Controls any miner that is available via command line.
GNU General Public License v3.0
898 stars 343 forks source link

Case sensitive .TrimStart() method in display active miners list #364

Closed UselessGuru closed 6 years ago

UselessGuru commented 7 years ago

Miner path is not properly trimmed in

    #Display active miners list
    $ActiveMiners | Where-Object Activated -GT 0 | Sort-Object -Descending Status, {if ($_.Process -eq $null) {[DateTime]0}else {$_.Process.StartTime}} | Select-Object -First (1 + 6 + 6) | Format-Table -Wrap -GroupBy Status (
        @{Label = "Speed"; Expression = {$_.Speed_Live | ForEach-Object {"$($_ | ConvertTo-Hash)/s"}}; Align = 'right'}, 
        @{Label = "Active"; Expression = {"{0:dd} Days {0:hh} Hours {0:mm} Minutes" -f $(if ($_.Process -eq $null) {$_.Active}else {if ($_.Process.ExitTime -gt $_.Process.StartTime) {($_.Active + ($_.Process.ExitTime - $_.Process.StartTime))}else {($_.Active + ((Get-Date) - $_.Process.StartTime))}})}}, 
        @{Label = "Launched"; Expression = {Switch ($_.Activated) {0 {"Never"} 1 {"Once"} Default {"$_ Times"}}}}, 
        @{Label = "Command"; Expression = {"$($_.Path.TrimStart((Convert-Path ".\"))) $($_.Arguments)"}}
    ) | Out-Host

because method '.TrimStart()' is case sensitive. In my system Convert-Path ".\" returns 'C:\Program Files\CryptoMining\MultiPoolMinerV2.6' where as $_.Path is 'c:\Program Files\CryptoMining\MultiPoolMinerV2.6\Bin\Lyra2z-NVIDIA\ccminer.exe'

I suggest to use the following code to successfully shorten the displayed path: @{Label = "Command"; Expression = { ($_.Path -ireplace [regex]::Escape($(Convert-Path ".\")), "") + " " + $_.Arguments }}

fonyo commented 6 years ago

Hey @UselessGuru, can you please submit a pull request for this one? Thanks.