Example #1
0
        public async void StartInstallWatcher()
        {
            watcherToken = new CancellationTokenSource();

            while (true)
            {
                if (watcherToken.IsCancellationRequested)
                {
                    return;
                }
                var program = Twitch.GetUninstallRecord(Game.GameId);
                if (program != null)
                {
                    var installInfo = new GameInfo()
                    {
                        PlayAction       = TwitchLibrary.GetPlayAction(Game.GameId),
                        InstallDirectory = Paths.FixSeparators(program.InstallLocation)
                    };

                    OnInstalled(this, new GameInstalledEventArgs(installInfo, this, 0));
                    return;
                }

                await Task.Delay(2000);
            }
        }
        public async void StartInstallWatcher()
        {
            watcherToken = new CancellationTokenSource();
            await Task.Run(async() =>
            {
                while (true)
                {
                    if (watcherToken.IsCancellationRequested)
                    {
                        return;
                    }
                    var program = Twitch.GetUninstallRecord(Game.GameId);
                    if (program != null)
                    {
                        if (Game.PlayAction == null)
                        {
                            Game.PlayAction = TwitchLibrary.GetPlayAction(Game.GameId);
                        }

                        Game.InstallDirectory = Paths.FixSeparators(program.InstallLocation);
                        OnInstalled(this, new GameControllerEventArgs(this, 0));
                        return;
                    }


                    await Task.Delay(2000);
                }
            });
        }
Example #3
0
        public TwitchMetadataProvider(TwitchLibrary library)
        {
            this.library = library;
            var token = library.GetAuthToken();

            if (!token.IsNullOrEmpty())
            {
                try
                {
                    entitlements = AmazonEntitlementClient.GetAccountEntitlements(token);
                }
                catch (Exception e)
                {
                    logger.Error(e, "Failed to get entitlements for Twitch metadata.");
                }
            }
        }
Example #4
0
 public TwitchGameController(Game game, TwitchLibrary library, IPlayniteAPI api) : base(game)
 {
     this.library = library;
     this.api     = api;
 }
 public TwitchMetadataProvider(TwitchLibrary library)
 {
     this.library = library;
 }