Closed Zallist closed 8 months ago
Hi Zallist, huge thanks for the PR. We appreciate your work very much. We are still preparing for a major change, but we will look at your changes as soon as possible. But at first glance it looks great. Especially the detailed description in the PR.
We get back to you personally. Are you already on our Discord? If not, please join. Communication is a bit easier there.
Then a pro forma question. Have you read and accept the CONTRIBUTING.md?
This is in direct response to #144. If this gets pulled through, I'll then probably make a plugin on for Playnite which interacts with it.
I've introduced a Program.cs + Main() entry point which is triggered before any WPF code gets loaded. This is necessary to get access to the command line arguments before they get manipulated, and speed up the response time of custom actions.
Command Line Options are parsed using https://github.com/commandlineparser/commandline which is MIT licensed.
A custom URI handler has been added in the form of
gamevault://<action>?parameters
, which hooks itself into the Windows Registry to listen globally.Command Line options, custom URI messages and messages sent via the Named Pipe are all handled with the same
CommandOptions
base class. So anything that can be done using the command line can also be done by sending a command through the Pipe or by using the gamevault:// uri.Without modifying the application type away from winexe, it's impossible to actually send messages back to the parent application, so any messages that have to be displayed are displayed in message boxes. The only 2 cases where this is really a problem is when
help
is called, it'd be a lot simpler to write the help the command line, and it'd also let us respond directly to a Query verb by just writing the result to the output.Usage
gamevault.exe <action> [--param=value] [--param value]
[value]
can be wrapped in quotes if it contains spaces, and [param] is prefixed with 2 dashesgamevault://<action>?[param=value]&[param=value]
[params]
and[value]
are uri encodedgamevault.exe --uridata <uri>
NamedPipeClientStream
(or whatever language's equivalent) to the pipe namedGameVault
and then send a message in the format of<uri>
Available actions & params
<none>
(nothing provided)show
, will focus the existing instance if already runningminimized=[true/false]
- Optional, open the application in the backgroundgameid=[id]
- Optional, show a specific gameshow
minimized=[true/false]
- Optional, whether to open without displaying the UIgameid=[id]
- Optional, show a specific gameinstall
gameid
, shows the "downloads" ui and starts downloading the gamegameid=[id]
- Required, the id of the game to installuninstall
gameid
, showing the "game settings" ui and confirming with the user firstgameid=[id]
- Required, the id of the game to uninstallstart
gameid
, or if not installed then does the same asinstall
gameid=[id]
- Required, the id of the game to startautoinstall=[true/false]
- Optional, defaults to true. If false, then the game will just be selected (same asshow
) if not already installedhelp
help show
,help install
,help uninstall
,help start
version
URI "query" action
When sending a request via URI, an additional action called
query
is available, which lets you get infromation from the clientside app. This is not a replacement for the server-side backend, and is just a way to get simple information. The specific value to query is provided in thequery
parameter, with the following available:exists
- Check if the providedgameid
exists locally or on the configured server(True/False)
installed
- Check if the providedgameid
is installed(True/False)
downloaded
- Check if the providedgameid
is downloaded(True/False)
getname
- Get the name of the game defined bygameid
getinstalldirectory
- Get the install directory of the game defined bygameid
getappversion
- Get the version of the applicationgetserverurl
- Get the URL that we're currently configured to point toisloggedin
- Returns if the user is currently logged in(True/False)
Command-line examples
gamevault.exe
gamevault.exe --minimized=true
- Opens the app in the backgroundgamevault.exe show --gameid=3
- Opens the app and shows the game with ID 3gamevault.exe install --gameid=3
- Installs the game with ID 3, or if already installed, shows itgamevault.exe uninstall --gameid=3
- Uninstalls the game with ID 3, or if already uninstalled, shows itgamevault.exe start --gameid=3
- Starts the game with ID 3, or if not installed, callsinstall
gamevault.exe start --gameid=3 --minimized=false
- Starts the game with ID 3 but also brings GameVault into view firstgamevault.exe start --gameid 3 --minimized false
- The same as above but without=
gamevault.exe help
- Displays the help screengamevault.exe help start
- Displays help forstart
gamevault.exe --uridata "gamevault://start?gameid=3"
- The same asgamevault.exe start --gameid=3
gamevault.exe --uridata "gamevault://start?gameid=3&minimized=false"
- The same asgamevault.exe start --gameid=3 --minimized=false
URI examples
gamevault://show
gamevault://show?minimized=true
gamevault://install?gameid=3
gamevault://uninstall?gameid=3
gamevault://start?gameid=3
gamevault://start?gameid=3&minimized=false
Query examples (ensure the main application is running first, expected through the NamedPipe as a message)
gamevault.exe --uridata "<uri>"
gamevault://query?query=exists&gameid=3
- True/False depending on the if the game with ID 3 existsgamevault://query?query=installed&gameid=3
- True/False depending on the installed status of game with ID 3gamevault://query?query=downloaded&gameid=3
- True/False depending on the downloaded status of game with ID 3gamevault://query?query=getname&gameid=3
- The name of game with ID 3gamevault://query?query=getinstalldirectory&gameid=3
- The install directory of the game with ID 3gamevault://query?query=getappversion
- Returns the version of the app (1.8.2)gamevault://query?query=getserverurl
- The URL the app is currently configured forgamevault://query?query=isloggedin
- True/False depending on the login status of the appC# code to interact with the GameVault app through the named pipe