public void GetImageUrlTest() { var image = new PlayniteServices.Models.IGDB.GameImage { url = @"//images.igdb.com/igdb/image/upload/t_thumb/fh5txlnfczqruy55bo6i.jpg" }; Assert.AreEqual( "https://images.igdb.com/igdb/image/upload/t_720p/fh5txlnfczqruy55bo6i.jpg", IgdbMetadataPlugin.GetImageUrl(image, ImageSizes.p720)); }
internal static string GetImageUrl(PlayniteServices.Models.IGDB.GameImage image, string imageSize) { var url = image.url; if (!url.StartsWith("https:", StringComparison.OrdinalIgnoreCase)) { url = "https:" + url; } url = Regex.Replace(url, @"\/t_[^\/]+", "/t_" + imageSize); return(url); }