Pages:
Author

Topic: [ANN] NiceHash Control 1.1.1 - Auto profit switching control for NiceHash servic - page 6. (Read 29976 times)

member
Activity: 130
Merit: 10
Wow, that was fast! I'll give it a good test  Smiley to see how it works
sr. member
Activity: 401
Merit: 250
Based on a generous donation, I've gone ahead and added in a minimize to tray capability.

NiceHashControl-1.0.4.zip

Launch with a command line parameter of "-t" and then when you minimize the app it will drop into the tool tray.  Double click the tool tray icon to restore.  Also, if a miner is running, the window will be hidden while the control app is minimized.  The miner is restored once the control app is displayed.

There is one current side effect with hiding the miner.  If the mining algorithm switches while the application is minimized the control program is not able to bring it back on screen as it starts with no user interface.  I'll work on a fix for this but it is not too high of priority right now.  The easiest workaround I know for it would be to start the miner on screen and then hide it.  This would cause a flicker in the taskbar that a user might now like if they are running in stealth mode.  Fortunately, you can still stop the miner if it is hidden so if you need to see what is happening just hit the stop button and then the auto button again.

This version is now 32-bit and Windows XP friendly by default.

Happy, hidden mining.
sr. member
Activity: 401
Merit: 250
I've sent you some coins, for a beer or two Wink

Wow, thanks!  That will actually cover a couple of bottles of wine!  Grin
member
Activity: 130
Merit: 10
I've sent you some coins, for a beer or two Wink
sr. member
Activity: 401
Merit: 250
OMG, you're amazing! it's working on win xp with no issues. Do you have a ltc adress so I can donate for you're work?

Is it possible to roll the app to system tray? There should be a silent mode perhaps for those of us who can run miners on a campus Wink
This is sgminer 5.0 with auto algo switching for nvidia users Wink

LTC: LPwhwy6edinDh6gN4ZKaAVgNkArZp6qfeu
LTC: LSKw8y56gwKUpfcEtGwXph7eVyyUfFrSvt

Glad it worked for you. Guess I'll stick with .NET 4 for the builds.

Minimize to tray can go on the "to do" list.

EDIT: If anyone else wants to send LTC, please don't use the first address I provided (now struck out).  That one was to an exchange which had a far too high withdrawl fee.  Now pointed to someplace friendlier to the wallet.
member
Activity: 130
Merit: 10
OMG, you're amazing! it's working on win xp with no issues. Do you have a ltc adress so I can donate for you're work?

Is it possible to roll the app to system tray? There should be a silent mode perhaps for those of us who can run miners on a campus Wink
This is sgminer 5.0 with auto algo switching for nvidia users Wink
sr. member
Activity: 401
Merit: 250

Umm, no remake is necessary.  NiceHash Control can launch any miner (or a batch file which launches a miner).  It is just a matter of setting everything up in the NiceHashControl.conf file.
sr. member
Activity: 401
Merit: 250
Just what I was looking for. But lot's of my miners are still on Win XP 32 bit, can you make the app compatible without rewriting the whole code?

Thanks for all you're work!

Let's give this a try.

NiceHashControl-1.0.3-xp.zip

I lowered the .NET version to 4.0, which can be run on Windows XP.  As long as you have .NET Framework 4.0 installed this should work.  Nothing in the application was using 4.5 yet so it doesn't hurt.  Be warned, at some point if I get creative and start using .NET 4.5 features there may be a freeze of the application which supports .NET 4.0.

If this version works I'll do all application targeting towards .NET 4.0 for the main version releases.
member
Activity: 130
Merit: 10
Just what I was looking for. But lot's of my miners are still on Win XP 32 bit, can you make the app compatible without rewriting the whole code?

Thanks for all you're work!
legendary
Activity: 1694
Merit: 1024
Alright thanks for all the advice!

I can sort of follow your coding, but it's mostly way over my current coding level.

I'll also have to look into learning C#, I know it's a highly used language much more so than VB .NET.
sr. member
Activity: 401
Merit: 250
Do you plan to ever open-source this program?

If it was programmed in Basic .NET then I would like to take a look at how you set up the API/JSON in the program. I just started programming in Basic a few months ago so I know a little bit, but I'd like to figure out how to set up API and JSON to work in my programs.

Definitely plan to release the source.  That is, once I've cleaned it up enough to avoid dropping dead of embarrassment from the bad coding practices currently in there.

Regarding JSON, I did this using the .NET built in JSON serializer vs. any 3rd party libraries such as JSON.NET.  The built in serializer is pretty crippled, but can be made to work with a little help here and there.  For your reading enjoyment, here is the code I'm using to retrieve balances via the NiceHash API:

Code: (C#)
        private void CheckBalances()
        {
            try
            {
                byte[] pageData;
                using (var client = new WebClient())
                {
                    var url = string.Format("https://www.nicehash.com/api?method=stats.provider&addr={0}", _address);
                    pageData = client.DownloadData(url);
                }
                var pageString = System.Text.Encoding.Default.GetString(pageData);
                var serializer = new JavaScriptSerializer();
                var data = serializer.DeserializeObject(pageString) as Dictionary;
                var result = data["result"] as Dictionary;
                var stats = result["stats"] as object[];
                foreach (var stat in stats)
                {
                    var item = stat as Dictionary;
                    var algo = int.Parse(item["algo"].ToString());
                    var entry = _priceEntries.FirstOrDefault(o => (int)o.Id == algo);
                    if (entry == null) continue;

                    entry.Balance = ExtractDecimal(item["balance"]);
                    entry.AcceptSpeed = ExtractDecimal(item["accepted_speed"]) * 1000;
                    entry.RejectSpeed = ExtractDecimal(item["rejected_speed"]) * 1000;
                }
            }
            catch
            {
            }
        }

        private decimal ExtractDecimal(object raw)
        {
            var decimalValue = raw as decimal?;
            if (decimalValue.HasValue) return decimalValue.Value;

            var doubleValue = raw as double?;
            if (doubleValue.HasValue) return (decimal)doubleValue.Value;

            var floatValue = raw as float?;
            if (floatValue.HasValue) return (decimal)floatValue.Value;

            var longValue = raw as long?;
            if (longValue.HasValue) return (decimal)longValue.Value;

            var intValue = raw as int?;
            if (intValue.HasValue) return (decimal)intValue.Value;

            decimal parseValue;
            var style = NumberStyles.AllowDecimalPoint;
            var culture = CultureInfo.CreateSpecificCulture("en-US");

            if (decimal.TryParse(raw.ToString(), style, culture, out parseValue)) return parseValue;

            return 0;
        }

Note the empty catch statement, which is bad practice.  Also, I had to do the long winded decimal extraction method to work around issues with number representation in the parsed JSON.  Current version is overkill but at least you know it will get the job done.

If you plan on going into programming as a career, I highly recommend concentrating more on C# than Visual Basic.NET.  More opportunities out there.  Also, C# is closely related to other C derived languages (such as Java) so it will be easier to pickup some of these as you progress.  Good luck.
legendary
Activity: 1694
Merit: 1024
Do you plan to ever open-source this program?

If it was programmed in Basic .NET then I would like to take a look at how you set up the API/JSON in the program. I just started programming in Basic a few months ago so I know a little bit, but I'd like to figure out how to set up API and JSON to work in my programs.
sr. member
Activity: 401
Merit: 250
Hi, is there any chance to get Linux version of the program?

Sorry, but unless someone can point me to a good Linux implementation of .NET Framework Windows Forms it isn't going to happen.

The application is written in C# for Windows Forms.  The meat and potatoes part of the application is only about 450 lines right now, so it could probably be wrapped into some sort of console application.  Over half of that 450 lines is related to user interface for showing numbers and controlling the start/stop buttons.  Not sure how you would handle the UI under that scenario as currently a separate window pops up with the miner.

Unrelated, there was a nice mention of NiceHash control over at Crypto Mining Blog.  Have to admit, it gave me a bit of a rush when I saw my own work pop up on my Feedly list. Smiley

Also, a big thanks to whoever made the donation today.  Always very much appreciated.
newbie
Activity: 26
Merit: 0
Hi, is there any chance to get Linux version of the program?
sr. member
Activity: 401
Merit: 250
This is an answer to my prayers! Awesome, can't wait to see it progress further.

EDIT: x14 Support! Since apparently xX is the new fad for algos these days  Roll Eyes

If/when NiceHash adds X14 then I'll add it to the program.

Another wishlist item I have for the program is to make it handle the new algorithms without a code release.  That will probably be a version 2 feature as it will require gutting out the entire UI.
sr. member
Activity: 280
Merit: 250
TECHNOLOGY, BABY!
This is an answer to my prayers! Awesome, can't wait to see it progress further.

EDIT: x14 Support! Since apparently xX is the new fad for algos these days  Roll Eyes
sr. member
Activity: 401
Merit: 250
full member
Activity: 182
Merit: 100
full member
Activity: 146
Merit: 100
I now have hopes of this app, combined with Bombadils profit calc app, and some CUDAmanager functions. Perhaps I should set up a bounty for it...

Edit: I know it is probably a lot of work, but what about some GUI work in the program itself to edit/set-up the .conf file? It would be nice.

It shouldn't be too hard for Bombadil to add the launching capability into his app.  That part is actually pretty easy compared to downloading the various API results and displaying relevant information. 

What CUDAmanager functions are you interested in?  I looked at that program a few months back but haven't thought too much of it since.  Once thing I did like about it is how it could display the miner output in a section of the CUDAmanager interface (by intercepting the output of the program).  Not essential to have but nice to not have a separate window launcher for the miner.

As for adding a graphical conf builder, you can add that to the long term wish list.  It is not really that difficult, just a bit tedious doing all of the GUI setup.

Right now, top priority is getting a minimum mine time and/or must be top for so long before switching function into the program.  I've been bouncing back and forth between X11 and X13 all day and sometimes it only spends a couple of minutes on one algorithm which is probably not very efficient.

I like the readouts CUDAmanager gives, such as Yays/minute, average Khash, etc. It's also easy to manage fan settings from the same window, but that's less important than the previous two to me. And take your time, I'm not in a hurry.
Pages:
Jump to: