Lacyway / V-Rising-Server-Manager

Server manager for V Rising.
MIT License
22 stars 5 forks source link

Integrated cmd prompt & minimize to tray #26

Open zebz213 opened 1 year ago

zebz213 commented 1 year ago

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

Lacyway commented 1 year ago

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

zebz213 commented 1 year ago

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.

Maverik commented 1 year ago

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!

Lacyway commented 1 year ago

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 ๐Ÿ˜Š

Maverik commented 1 year ago

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.

Lacyway commented 1 year ago

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