shupershuff / Diablo2RLoader

Diablo 2: Resurrected launcher for multi-boxing
MIT License
59 stars 11 forks source link

Add ReadKeyTimeout function #13

Closed never147 closed 1 year ago

never147 commented 1 year ago

Add a new function that works like Read-Host except it takes a timeout in seconds and a default answer. If no key is pressed in the given time the default will be used, if enter is pressed with no key pressed the default is also used.

Altered the main question of which account to select so that it will refresh the screen if no key is pressed within the given timeout of 10 seconds. This might be too aggressive so feel free to alter/suggest changes.

This is a possible solution for issue #11

shupershuff commented 1 year ago

You absolute legend! Will give this a test.

shupershuff commented 1 year ago

Looks good. Thanks heaps! I'll probably look to use the "host.UI.RawUI.ReadKey" method of input going forward as it means users don't have to mash the enter key as much. I wasn't aware of this input method until now so good to learn something here too :)

never147 commented 1 year ago

Great! Glad it was useful! 😁