// To add new game menu items override GetGameMenuItems
        public override IEnumerable <GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs args)
        {
            var GameMenu = args.Games.First();

            List <GameMenuItem> gameMenuItems = new List <GameMenuItem>();

            if (PluginSettings.Settings.EnableBackgroundImage)
            {
                gameMenuItems.Add(new GameMenuItem
                {
                    // Manage game background
                    MenuSection = resources.GetString("LOCBc"),
                    Description = resources.GetString("LOCBcManageBackground"),
                    Action      = (gameMenuItem) =>
                    {
                        var ViewExtension      = new ImagesManager(PlayniteApi, PluginDatabase.Get(GameMenu), false);
                        Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCBc") + " - " + resources.GetString("LOCGameBackgroundTitle"), ViewExtension);
                        windowExtension.ShowDialog();
                    }
                });
            }

            if (PluginSettings.Settings.EnableCoverImage)
            {
                gameMenuItems.Add(new GameMenuItem
                {
                    // Manage game cover
                    MenuSection = resources.GetString("LOCBc"),
                    Description = resources.GetString("LOCBcManageCover"),
                    Action      = (gameMenuItem) =>
                    {
                        var ViewExtension      = new ImagesManager(PlayniteApi, PluginDatabase.Get(GameMenu), true);
                        Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCBc") + " - " + resources.GetString("LOCGameCoverImageTitle"), ViewExtension);
                        windowExtension.ShowDialog();
                    }
                });
            }

#if DEBUG
            gameMenuItems.Add(new GameMenuItem
            {
                MenuSection = resources.GetString("LOCBc"),
                Description = "-"
            });
            gameMenuItems.Add(new GameMenuItem
            {
                MenuSection = resources.GetString("LOCBc"),
                Description = "Test",
                Action      = (mainMenuItem) =>
                {
                }
            });
#endif

            return(gameMenuItems);
        }
        // To add new game menu items override GetGameMenuItems
        public override IEnumerable <GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs args)
        {
            Game            GameMenu        = args.Games.First();
            List <Guid>     Ids             = args.Games.Select(x => x.Id).ToList();
            GameScreenshots gameScreenshots = PluginDatabase.Get(GameMenu);

            List <GameMenuItem> gameMenuItems = new List <GameMenuItem>();

            if (gameScreenshots.HasData)
            {
                gameMenuItems.Add(new GameMenuItem
                {
                    // Delete & download localizations data for the selected game
                    MenuSection = resources.GetString("LOCSsv"),
                    Description = resources.GetString("LOCSsvViewScreenshots"),
                    Action      = (gameMenuItem) =>
                    {
                        WindowOptions windowOptions = new WindowOptions
                        {
                            ShowMinimizeButton = false,
                            ShowMaximizeButton = true,
                            ShowCloseButton    = true
                        };

                        var ViewExtension          = new SsvScreenshotsView(PluginDatabase.GameContext);
                        Window windowExtension     = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCSsvTitle"), ViewExtension, windowOptions);
                        windowExtension.ResizeMode = ResizeMode.CanResize;
                        windowExtension.ShowDialog();
                    }
                });

                if (gameScreenshots.ScreenshotsFolders != null && gameScreenshots.ScreenshotsFolders.Count != 0 && gameScreenshots.FoldersExist)
                {
                    gameMenuItems.Add(new GameMenuItem
                    {
                        // Open directory
                        MenuSection = resources.GetString("LOCSsv"),
                        Description = resources.GetString("LOCSsvOpenScreenshotsDirectory"),
                        Action      = (gameMenuItem) =>
                        {
                            foreach (string Folder in gameScreenshots.ScreenshotsFolders)
                            {
                                Process.Start(Folder);
                            }
                        }
                    });
                }

                if (gameScreenshots.Items.Count > 0 && PluginDatabase.PluginSettings.Settings.EnableFolderToSave)
                {
                    gameMenuItems.Add(new GameMenuItem
                    {
                        MenuSection = resources.GetString("LOCSsv"),
                        Description = resources.GetString("LOCSsvMoveToSave"),
                        Action      = (gameMenuItem) =>
                        {
                            if (Ids.Count == 1)
                            {
                                PluginDatabase.MoveToFolderToSave(GameMenu);
                            }
                            else
                            {
                                PluginDatabase.MoveToFolderToSave(Ids);
                            }
                        }
                    });
                }

                if (gameScreenshots.Items.Count > 0)
                {
                    gameMenuItems.Add(new GameMenuItem
                    {
                        MenuSection = resources.GetString("LOCSsv"),
                        Description = resources.GetString("LOCSsvConvertToJPG"),
                        Action      = (gameMenuItem) =>
                        {
                            GlobalProgressOptions globalProgressOptions = new GlobalProgressOptions(
                                $"{PluginDatabase.PluginName} - {resources.GetString("LOCCommonConverting")}",
                                true
                                );
                            globalProgressOptions.IsIndeterminate = Ids.Count == 1;

                            PlayniteApi.Dialogs.ActivateGlobalProgress((activateGlobalProgress) =>
                            {
                                Stopwatch stopWatch = new Stopwatch();
                                stopWatch.Start();

                                string CancelText = string.Empty;
                                if (Ids.Count > 1)
                                {
                                    activateGlobalProgress.ProgressMaxValue = Ids.Count;
                                }

                                try
                                {
                                    Ids.ForEach(y =>
                                    {
                                        GameScreenshots data = PluginDatabase.Get(y);
                                        if (data.HasData)
                                        {
                                            bool HasConvert = false;
                                            data.Items.ForEach(x =>
                                            {
                                                if (activateGlobalProgress.CancelToken.IsCancellationRequested)
                                                {
                                                    CancelText = " canceled";
                                                    return;
                                                }

                                                if (!x.IsVideo)
                                                {
                                                    string oldFile = x.FileName;
                                                    string newFile = ImageTools.ConvertToJpg(oldFile, PluginDatabase.PluginSettings.Settings.JpgQuality);

                                                    if (!newFile.IsNullOrEmpty())
                                                    {
                                                        DateTime dt = File.GetLastWriteTime(oldFile);
                                                        File.SetLastWriteTime(newFile, dt);
                                                        FileSystem.DeleteFileSafe(oldFile);
                                                        HasConvert = true;
                                                    }
                                                }
                                            });

                                            if (HasConvert)
                                            {
                                                GameSettings gameSettings = PluginDatabase.GetGameSettings(y);
                                                if (gameSettings != null)
                                                {
                                                    PluginDatabase.SetDataFromSettings(gameSettings);
                                                }
                                            }

                                            if (activateGlobalProgress.CancelToken.IsCancellationRequested)
                                            {
                                                CancelText = " canceled";
                                                return;
                                            }

                                            if (Ids.Count > 1)
                                            {
                                                activateGlobalProgress.CurrentProgressValue++;
                                            }
                                        }
                                    });
                                }
                                catch (Exception ex)
                                {
                                    Common.LogError(ex, false, true, PluginDatabase.PluginName);
                                }

                                stopWatch.Stop();
                                TimeSpan ts = stopWatch.Elapsed;
                                logger.Info($"Task RefreshData(){CancelText} - {string.Format("{0:00}:{1:00}.{2:00}", ts.Minutes, ts.Seconds, ts.Milliseconds / 10)} for {activateGlobalProgress.CurrentProgressValue}/{Ids.Count} items");
                            }, globalProgressOptions);
                        }
                    });
                }

                gameMenuItems.Add(new GameMenuItem
                {
                    MenuSection = resources.GetString("LOCSsv"),
                    Description = "-"
                });
            }

            gameMenuItems.Add(new GameMenuItem
            {
                // Refresh data
                MenuSection = resources.GetString("LOCSsv"),
                Description = resources.GetString("LOCCommonRefreshGameData"),
                Action      = (gameMenuItem) =>
                {
                    if (Ids.Count == 1)
                    {
                        PluginDatabase.RefreshData(GameMenu);
                    }
                    else
                    {
                        PluginDatabase.RefreshData(Ids);
                    }
                }
            });

#if DEBUG
            gameMenuItems.Add(new GameMenuItem
            {
                MenuSection = resources.GetString("LOCSsv"),
                Description = "-"
            });
            gameMenuItems.Add(new GameMenuItem
            {
                MenuSection = resources.GetString("LOCSsv"),
                Description = "Test",
                Action      = (mainMenuItem) =>
                {
                }
            });
#endif

            return(gameMenuItems);
        }