Пример #1
0
        //Set PS Store side panel information with game item data
        private void SetPanelPSN(PSNItem game)
        {
            PanelTitle.Text = game.TitleName;
            PanelSize.Text  = $"Install Size: {game.Size}GB";

            //Parse and insert Release Date
            if (game.ReleaseDate != null)
            {
                string month = game.ReleaseDate.ToString("MMM", CultureInfo.InvariantCulture);
                string date  = $"{month} {game.ReleaseDate.Date.Day}, {game.ReleaseDate.Year}";
                PanelRelease.Text = $"Released: {date}";
            }

            //Game Description
            if (game.LongDesc != null)
            {
                String _description = game.LongDesc.Replace("<br>", Environment.NewLine);
                _description          = _description.Replace("<BR>", Environment.NewLine);
                _description          = Environment.NewLine + _description;
                PanelDescription.Text = $"{_description}";
            }

            if (game.Images != null)
            {
                PanelIconImage.Source = PanelImageSource(game.Images[0].Url);
            }

            if (game.PlayablePlatform != null)
            {
                PanelPlatform.Text = "Platform: ";
                foreach (string platform in game.PlayablePlatform)
                {
                    PanelPlatform.Text += $"{platform}, ";
                }
            }

            if (game.Metadata.Genre != null)
            {
                PanelGenre.Text = "Genre: ";
                foreach (string genre in game.Metadata.Genre.Values)
                {
                    PanelGenre.Text += $"{genre}, ";
                }
            }
            else
            {
                PanelGenre.Text = String.Empty;
            }
        }
Пример #2
0
        //Fetches Chihiro API and updates PS Store side panel
        private void Chihiro_Fetch(object sender, DoWorkEventArgs e)
        {
            List <object> arguments = e.Argument as List <object>;

            PSNItem CurrentPSNGame = null;

            CurrentPSNGame = Chihiro.PSNItemAPI((string)arguments[0], (string)arguments[1]);

            //If Chihiro returns content, then populate side panel
            //If not, forge a dummy item
            if (CurrentPSNGame != null)
            {
                Dispatcher.BeginInvoke(new Action(() => SetPanelPSN(CurrentPSNGame)));
            }
        }
Пример #3
0
        //Return a PSN store item
        public PSNItem PSNItemAPI(string ContentID, string Region)
        {
            GETResponse APIResponse;

            try
            {
                APIResponse = GETRequestAsync(ContentID, Region);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }

            PSNItem item = new PSNItem();
            string  body = APIResponse.Body;

            item = PSNItem.FromJson(body);
            return(item);
        }
 public static string ToJson(this PSNItem self) => JsonConvert.SerializeObject(self, Converter.Settings);