Open
Conversation
Checks if workshop link metadata exists and only creates button if it does. Link from metadata is passed to this extension.
darklinkpower
requested changes
Feb 28, 2023
Comment on lines
-31
to
42
| $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") | ||
| { |
Owner
There was a problem hiding this comment.
The new menu item should be added last to prevent modifying all other ones. Also helps to maintain consistency in items placement
Comment on lines
+84
to
+86
| $workshopLink = $game.Links | Where-Object { $_.Name -eq "Workshop" } | ||
| if ($workshopLink) | ||
| { |
Owner
There was a problem hiding this comment.
- 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" } |
Owner
There was a problem hiding this comment.
Also should be done as a loop and via url
Comment on lines
+207
to
+208
| $url = $workshopLink.Url | ||
| $uri = "steam://openurl/{0}" -f $url |
Owner
There was a problem hiding this comment.
This could be done in a single line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.