static private IList <ISearchAction <string> > GetActions(AddonManifestBase addon)
        {
            var actions = new List <ISearchAction <string> > {
                new CommandAction()
                {
                    Action = () => { var p = Process.Start($"playnite://playnite/installaddon/{addon.AddonId}"); p?.Close(); p?.Dispose(); }, Name = addon.IsInstalled ? ResourceProvider.GetString("LOC_QS_UpdateAction") : ResourceProvider.GetString("LOC_QS_InstallAction")
                }
            };

            if (addon.IsInstalled)
            {
                var api = SearchPlugin.Instance.PlayniteApi;
                var installationBasePath = api.Paths.ConfigurationPath;
                var installationPath     = Path.Combine(installationBasePath, "Extensions", addon.AddonId);
                if (Directory.Exists(installationPath))
                {
                    var extensionManifestPath = Path.Combine(installationPath, "extension.yaml");
                    actions.Add(new CommandAction()
                    {
                        Action = () => { var p = Process.Start(installationPath); p?.Close(); p?.Dispose(); }, Name = ResourceProvider.GetString("LOC_QS_InstallationData")
                    });
                    if (File.Exists(extensionManifestPath))
                    {
                        try
                        {
                            if (ExtensionManifest.FromFile(extensionManifestPath) is ExtensionManifest manifest)
                            {
                                var dataBasePath = api.Paths.ExtensionsDataPath;
                                var plugin       = api.Addons.Plugins
                                                   .FirstOrDefault(p => (p.GetType().Assembly.GetName().Name + ".dll").Equals(manifest.Module, StringComparison.OrdinalIgnoreCase));
                                if (plugin != null)
                                {
                                    actions.Insert(1, new CommandAction()
                                    {
                                        Action = () => { var p = Process.Start(plugin.GetPluginUserDataPath()); p?.Close(); p?.Dispose(); }, Name = ResourceProvider.GetString("LOC_QS_UserData")
                                    });
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            SearchPlugin.logger.Error(ex, $"Couldn't parse extension.yaml file at {extensionManifestPath}");
                        }
                    }
                }
                //if (addon.Type == AddonType.Generic || addon.Type == AddonType.GameLibrary)
                //{
                //    if (addon.IsEnabled)
                //    {
                //        actions.Add(new CommandAction { Action = () => { api.Addons.DisabledAddons.AddMissing(addon.AddonId); addon.IsEnabled = false; }, CloseAfterExecute = false, Name = "Disable" });
                //    } else
                //    {
                //        actions.Add(new CommandAction { Action = () => { api.Addons.DisabledAddons.Remove(addon.AddonId); addon.IsEnabled = true; }, CloseAfterExecute = false, Name = "Enable" });
                //    }
                //}
            }

            return(actions);
        }
        public AddonItem(AddonManifestBase addon)
        {
            var api         = SearchPlugin.Instance.PlayniteApi;
            var isInstalled = api.Addons.Addons.Contains(addon.AddonId);
            var isDisabled  = isInstalled && api.Addons.DisabledAddons.Contains(addon.AddonId);

            addon.IsEnabled = !isDisabled;
            if (addon.Type == AddonType.ThemeDesktop || addon.Type == AddonType.ThemeFullscreen)
            {
                var typeFolder = addon.Type == AddonType.ThemeDesktop ? "Desktop" : "Fullscreen";
                var themePath  = Path.Combine(api.Paths.ConfigurationPath, "Themes", typeFolder, addon.AddonId);
                if (Directory.Exists(themePath))
                {
                    isInstalled = File.Exists(Path.Combine(themePath, "theme.yaml"));
                }
            }
            addon.IsInstalled = isInstalled;
            this.addon        = addon;
            Keys = new List <ISearchKey <string> > {
                new CommandItemKey()
                {
                    Key = addon.Name ?? "Add-on Name", Weight = 1
                },
                new CommandItemKey()
                {
                    Key = addon.Author ?? "Unknown Author", Weight = 1
                },
            };
            if (addon.Tags is List <string> tags && tags.Count > 0)
            {
                var tagString = string.Join(" ", tags);
                if (!string.IsNullOrWhiteSpace(tagString))
                {
                    Keys.Add(new CommandItemKey()
                    {
                        Key = tagString, Weight = 0.95f
                    });
                }
            }

            if (!string.IsNullOrWhiteSpace(addon.ShortDescription))
            {
                Keys.Add(new CommandItemKey()
                {
                    Key = addon.ShortDescription, Weight = 0.95f
                });
            }

            if (!string.IsNullOrWhiteSpace(addon.Description))
            {
                Keys.Add(new CommandItemKey()
                {
                    Key = addon.Description, Weight = 0.95f
                });
            }
            if (isInstalled)
            {
                if (Uri.TryCreate(addon.IconUrl, UriKind.RelativeOrAbsolute, out var uri))
                {
                    Icon = uri;
                }
            }
            if (Icon == null)
            {
                if (Uri.TryCreate(addon.IconUrl, UriKind.RelativeOrAbsolute, out var uri))
                {
                    Icon = uri;
                }
                else
                {
                    Icon = (System.Windows.Application.Current.FindResource("TrayIcon") as BitmapImage).UriSource;
                }
            }
        }