-
-
Notifications
You must be signed in to change notification settings - Fork 46
Added workshop link #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Added workshop link #371
Conversation
Checks if workshop link metadata exists and only creates button if it does. Link from metadata is passed to this extension.
| $menuItem13 = New-Object Playnite.SDK.Plugins.ScriptGameMenuItem | ||
| $menuItem13.Description = [Playnite.SDK.ResourceProvider]::GetString("LOCSteam_Viewer_MenuItemComponentScreenshotsDescription") | ||
| $menuItem13.FunctionName = "Start-ComponentScreenshots" | ||
| $menuItem13.Description = [Playnite.SDK.ResourceProvider]::GetString("LOCSteam_Viewer_MenuItemComponentNewsDescription") | ||
| $menuItem13.FunctionName = "Start-ComponentNews" | ||
| $menuItem13.MenuSection = "$extensionName|$subSection" | ||
|
|
||
| $menuItem14 = New-Object Playnite.SDK.Plugins.ScriptGameMenuItem | ||
| $menuItem14.Description = [Playnite.SDK.ResourceProvider]::GetString("LOCSteam_Viewer_MenuItemComponentSettingsDescription") | ||
| $menuItem14.FunctionName = "Start-ComponentSettings" | ||
| $menuItem14.Description = [Playnite.SDK.ResourceProvider]::GetString("LOCSteam_Viewer_MenuItemComponentScreenshotsDescription") | ||
| $menuItem14.FunctionName = "Start-ComponentScreenshots" | ||
| $menuItem14.MenuSection = "$extensionName|$subSection" | ||
|
|
||
| $menuItem15 = New-Object Playnite.SDK.Plugins.ScriptGameMenuItem | ||
| $menuItem15.Description = [Playnite.SDK.ResourceProvider]::GetString("LOCSteam_Viewer_MenuItemComponentSettingsDescription") | ||
| $menuItem15.FunctionName = "Start-ComponentSettings" | ||
| $menuItem15.MenuSection = "$extensionName|$subSection" | ||
|
|
||
| $game = $scriptGameMenuItemActionArgs.Games | Select-Object -last 1 | ||
| if ([Playnite.SDK.BuiltinExtensions]::GetExtensionFromId($game.PluginId) -eq "SteamLibrary") | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new menu item should be added last to prevent modifying all other ones. Also helps to maintain consistency in items placement
| $workshopLink = $game.Links | Where-Object { $_.Name -eq "Workshop" } | ||
| if ($workshopLink) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'd be better if the link search was done by the url instead of name as it would prevent false positives or work in cases where the link name was changed for any reason
- I'd prefer if the link search was done in a loop that breaks upon finding, to prevent having to loop through all the links
| ) | ||
| $game = $scriptGameMenuItemActionArgs.Games | Select-Object -last 1 | ||
| #get workshop link | ||
| $workshopLink = $game.Links | Where-Object { $_.Name -eq "Workshop" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should be done as a loop and via url
| $url = $workshopLink.Url | ||
| $uri = "steam://openurl/{0}" -f $url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done in a single line
Checks if workshop link metadata exists and only creates button if it does. Link from metadata is passed to this extension.
I have verified that:
masterbranch.