public override IEnumerable <PlayController> GetPlayActions(GetPlayActionsArgs args) { return(null); //yield return new AutomaticPlayController(args.Game) //{ // Type = AutomaticPlayActionType.File, // TrackingMode = TrackingMode.Process, // Name = "Notepad", // Path = "notepad.exe" //}; }
public override IEnumerable <PlayController> GetPlayActions(GetPlayActionsArgs args) { if (!settings.Settings.ShowPlayActionsOnLaunch) { return(null); } if (supportedList.Count == 0) { logger.Debug("Supported list was not set"); return(null); } if (!File.Exists(geforceNowExecutablePath)) { logger.Debug("Geforce Now Executable was not detected"); return(null); } var game = args.Game; // Library plugins set the game installation directory when they are // detected as installed. This is used to detect this and not show the Play // Action if it is detected as installed by the game library plugin. if (!string.IsNullOrEmpty(game.InstallDirectory)) { logger.Debug("Game install dir was not empty and was skipped"); return(null); } var storeName = string.Empty; switch (game.PluginId.ToString()) { //Steam case "cb91dfc9-b977-43bf-8e70-55f46e410fab": storeName = "Steam"; break; //Epic case "00000002-dbd1-46c6-b5d0-b1ba559d10e4": storeName = "Epic"; break; //Origin case "85dd7072-2f20-4e76-a007-41035e390724": storeName = "Origin"; break; //Uplay case "c2f038e5-8b92-4877-91f1-da9094155fc5": storeName = "Ubisoft Connect"; break; //GOG case "aebe8b7c-6dc3-4a66-af31-e7375c6b5e9e": storeName = "GOG"; break; default: break; } if (storeName == string.Empty) { return(null); } GeforceGame supportedGame; if (storeName == "Steam") { var steamUrl = string.Format("https://store.steampowered.com/app/{0}", game.GameId); supportedGame = supportedList.FirstOrDefault(g => g.Store == storeName && g.SteamUrl == steamUrl); } else { var matchingName = SatinizeString(game.Name); if (storeName == "Origin") { matchingName = SatinizeOriginGameName(matchingName); } supportedGame = supportedList.FirstOrDefault(g => g.Store == storeName && g.Title == matchingName); } if (supportedGame != null) { return(new List <PlayController>() { new NVIDIAGeForceNowEnablerPlayController(game, supportedGame.Id.ToString(), geforceNowExecutablePath, geforceNowWorkingPath) }); } return(null); }
public override IEnumerable <PlayController> GetPlayActions(GetPlayActionsArgs args) { var game = args.Game; if (game.PluginId != Id) { yield break; } if (game.Links == null || game.Links.Count == 0) { PlayniteApi.Dialogs.ShowMessage(ResourceProvider.GetString("LOCImporter_For_Anilist_PlayActionNoLinksAvailableLabel")); yield break; } var browserPath = string.Empty; if (!string.IsNullOrEmpty(settings.Settings.BrowserPath) && File.Exists(settings.Settings.BrowserPath)) { browserPath = settings.Settings.BrowserPath; } var cubariLinks = new List <Link>(); foreach (Link link in game.Links) { if (link.Name == string.Empty || link.Name == "AniList" || link.Name == "MyAnimeList") { continue; } var match = mangadexIdRegex.Match(link.Url); if (match.Success) { var actionName = string.Format("Cubari (MangaDex) {0}", link.Name.Replace("Mangadex - ", "")); var actionUrl = string.Format(@"https://cubari.moe/read/mangadex/{0}/", match.Groups[1]); cubariLinks.Add(new Link { Name = actionName, Url = actionUrl }); } else { var match2 = mangaseeIdRegex.Match(link.Url); if (match2.Success) { var actionName = string.Format("Cubari (MangaSee) {0}", link.Name.Replace("MangaSee - ", "")); var actionUrl = string.Format(@"https://cubari.moe/read/mangasee/{0}/", match2.Groups[1]); cubariLinks.Add(new Link { Name = actionName, Url = actionUrl }); } } yield return(CreatePlayController(game, link.Name, link.Url, browserPath)); } foreach (Link link in cubariLinks) { yield return(CreatePlayController(game, link.Name, link.Url, browserPath)); } }