V-Rising-Server-Manager icon indicating copy to clipboard operation
V-Rising-Server-Manager copied to clipboard

Integrated cmd prompt & minimize to tray

Open zebz213 opened this issue 2 years ago • 6 comments

Would it be possible to have the command window be integrated into the application and possibly a minimize to tray feature?

I edited the layout to try and Show what I mean

image image

zebz213 avatar Jul 24 '23 21:07 zebz213

Unfortunately this prevents proper shutdown of the server. I've experimented with it already but it's not possible to "gracefully" shutdown the server without the window, as there is no way to shut it down without clicking the 'X' or 'Ctrl+C'.

Neither of those work without without the window being visible. If there is no window I have to kill the process which could lead to bad things, e.g. corrupted saves.

I'll have another look at it, though. It's been a while since I tried. I'll let you know what I find out.

Thank you

Lacyway avatar Jul 24 '23 22:07 Lacyway

That was the conclusion I ended up with, but I have very limit knowledge, so figured I would pitch it here to see if it was possible. Thank you for explaining why it couldn't be done.

zebz213 avatar Jul 24 '23 22:07 zebz213

There is actually an easy way to do this but it requires you to redirect Input & Output stream of the window when you launch the Process from .net, you can select where the window output goes & where does it get its input. By controlling that stream, you get the console output as a stream to wherever you'd prefer to display it & you can write to input stream to control the process as if you typed it using keyboard.

Here's the relevant link with an example in there: Process.StandardInput Property

I'm well experienced in the .net world, and happy to help discuss and help along. Thank you for making this project as your first c# project!

Maverik avatar Aug 29 '23 16:08 Maverik

If you're referring to redirecting the standard output of the process in C# it's unfortunately very inconsistent, see here: https://github.com/ValveSoftware/Source-1-Games/issues/1684

I've given it a few tries and after a few nights I decided it just wasn't worth it. If you find an easy way to work around it I'd be happy to take a look at it.

Thanks 😊

Lacyway avatar Aug 29 '23 16:08 Lacyway

If you're referring to redirecting the standard output of the process in C# it's unfortunately very inconsistent, see here: ValveSoftware/Source-1-Games#1684

I'm unsure of what that issue is talking about, but I've done this personally without an issue. Their issue description is implying a problem with steamcmd's output specifically. I've not browsed your code much, but are you going through steamcmd to launch? Also considering the issue is from 2014, do you have any documentation about what problems you ran into with the flakey behavior? Perhaps we can connect on discord and have a go together.

I unfortunately couldn't get it to start myself as the only error i got was it couldn't find server exe (I sort of expected this) but i found no obvious way to tell the program where to look or which files to copy over to \Server folder.

Maverik avatar Aug 29 '23 16:08 Maverik

Yeah, it's with SteamCMD specifically and (from what I've read) how it flushes it's buffer, so the output is really inconsistent and sometimes never even outputs anything. It's very sporadic and rarely worked for me.

Any other process I've tried with works flawlessly, I did use the output of the server for a bit to make a live log reader but dropped the idea. Although you've definitely made me want to try again 😁And sure; my Discord is lacyway.

Regarding the server exe, it should be the entire installation of the dedicated server in that folder. E.g. this is what mine looks like that I use for testing. It should install it when clicking "Update Server".

image

Here's a direct link: https://github.com/Lacyway/V-Rising-Server-Manager/blob/74a8a89ab84e8349d55097320d543828c86302e4/VSM/MainWindow.xaml.cs#L205

It uses the "Server" object here: https://github.com/Lacyway/V-Rising-Server-Manager/blob/74a8a89ab84e8349d55097320d543828c86302e4/VSM/MainSettings.cs#L66

Lacyway avatar Aug 29 '23 17:08 Lacyway