Ejemplo n.º 1
0
        public bool GetIsUserLoggedIn()
        {
            if (IsConnected == null)
            {
                webViews.NavigateAndWait(UrlBase);
                IsConnected = webViews.GetPageSource().ToLower().IndexOf("log in") == -1;
            }

            IsConnected = (bool)IsConnected;
            return(!!(bool)IsConnected);
        }
Ejemplo n.º 2
0
        public static List <SearchResult> GetMultiXboxData(IPlayniteAPI PlayniteApi, string searchTerm)
        {
#if DEBUG
            logger.Debug($"MetadataLocal - GetMultiXboxData({searchTerm})");
#endif

            string searchUrl = @"https://www.microsoft.com/fr-fr/search/shop/games?q={0}";
            var    results   = new List <SearchResult>();

            try
            {
                IWebView webView = PlayniteApi.WebViews.CreateOffscreenView();
                webView.NavigateAndWait(string.Format(searchUrl, searchTerm));
                string str = webView.GetPageSource();

                HtmlParser    parser       = new HtmlParser();
                IHtmlDocument htmlDocument = parser.Parse(str);

                int i = 0;
                foreach (var gameElem in htmlDocument.QuerySelectorAll("div.m-channel-placement-item"))
                {
                    if (i == 10)
                    {
                        break;
                    }

                    string gameName = gameElem.QuerySelector("h3.c-subheading-6").InnerHtml.Trim();
                    string gameImg  = gameElem.QuerySelector(".c-channel-placement-image picture img").GetAttribute("src");
                    string gamePfns = gameElem.QuerySelector("a").GetAttribute("data-pfns");

                    results.Add(new SearchResult
                    {
                        Name      = gameName,
                        ImageUrl  = gameImg,
                        StoreName = "Xbox",
                        StoreId   = gamePfns
                    });

                    i++;
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "MetadataLocal", $"Failed to download data for {searchTerm}");
            }

            return(results);
        }
 public bool GetIsUserLoggedIn()
 {
     webView.NavigateAndWait(libraryUrl);
     return(webView.GetPageSource().Contains("\"gamekeys\":"));
 }
 public string GetOwnedGames()
 {
     webView.NavigateAndWait(libraryUrl);
     return(webView.GetPageSource());
 }