Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Integrated cmd prompt & minimize to tray #26

Open
zebz213 opened this issue Jul 24, 2023 · 6 comments
Open

Integrated cmd prompt & minimize to tray #26

zebz213 opened this issue Jul 24, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@zebz213
Copy link

zebz213 commented Jul 24, 2023

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
Copy link
Owner

Lacyway commented Jul 24, 2023

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 Lacyway added the enhancement New feature or request label Jul 24, 2023
@Lacyway Lacyway self-assigned this Jul 24, 2023
@zebz213
Copy link
Author

zebz213 commented Jul 24, 2023

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
Copy link

Maverik commented Aug 29, 2023

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
Copy link
Owner

Lacyway commented Aug 29, 2023

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'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
Copy link

Maverik commented Aug 29, 2023

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
Copy link
Owner

Lacyway commented Aug 29, 2023

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:

private async Task<bool> StartServer(Server server)

It uses the "Server" object here:

public class Server : PropertyChangedBase

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants