public override void Play() { ReleaseResources(); if (Game.PlayAction.Type == GameActionType.URL && Game.PlayAction.Path.StartsWith("uplay", StringComparison.OrdinalIgnoreCase)) { OnStarting(this, new GameControllerEventArgs(this, 0)); if (Directory.Exists(Game.InstallDirectory)) { var requiresUplay = Uplay.GetGameRequiresUplay(Game); stopWatch = Stopwatch.StartNew(); procMon = new ProcessMonitor(); procMon.TreeStarted += ProcMon_TreeStarted; procMon.TreeDestroyed += Monitor_TreeDestroyed; GameActionActivator.ActivateAction(Game.PlayAction); StartRunningWatcher(requiresUplay); } else { OnStopped(this, new GameControllerEventArgs(this, 0)); } } else { throw new Exception("Unknown Play action configuration."); } }
public static GameAction GetGamePlayTask(string id) { return(new GameAction() { Type = GameActionType.URL, Path = Uplay.GetLaunchString(id), IsHandledByPlugin = true }); }
public UplayMetadataProvider() { try { productInfo = Uplay.GetLocalProductCache(); } catch (Exception e) { logger.Error(e, "Failed to get Uplay product info from cache."); } }
public List <GameInfo> GetLibraryGames() { var games = new List <GameInfo>(); var dlcsToIgnore = new List <uint>(); foreach (var item in Uplay.GetLocalProductCache()) { if (item.root.addons.HasItems()) { foreach (var dlc in item.root.addons.Select(a => a.id)) { dlcsToIgnore.AddMissing(dlc); } } if (item.root.third_party_platform != null) { continue; } if (item.root.is_ulc) { dlcsToIgnore.AddMissing(item.uplay_id); continue; } if (dlcsToIgnore.Contains(item.uplay_id)) { continue; } if (item.root.start_game == null) { continue; } var newGame = new GameInfo { Name = item.root.name.RemoveTrademarks(), GameId = item.uplay_id.ToString(), BackgroundImage = item.root.background_image, Icon = item.root.icon_image, CoverImage = item.root.thumb_image, Source = "Uplay", Platform = "PC" }; games.Add(newGame); } return(games); }
public override void Play() { ReleaseResources(); OnStarting(this, new GameControllerEventArgs(this, 0)); if (Directory.Exists(Game.InstallDirectory)) { var requiresUplay = Uplay.GetGameRequiresUplay(Game); stopWatch = Stopwatch.StartNew(); procMon = new ProcessMonitor(); procMon.TreeStarted += ProcMon_TreeStarted; procMon.TreeDestroyed += Monitor_TreeDestroyed; ProcessStarter.StartUrl(Uplay.GetLaunchString(Game.GameId)); StartRunningWatcher(requiresUplay); } else { OnStopped(this, new GameControllerEventArgs(this, 0)); } }