diff --git a/README.md b/README.md index a825f45..425455a 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ A wrapper for the API of wrag.io, to get a game including all it's data ### Created using - .NET Core 6.0 -### Nuget(s) -- Newtonsoft.Json (Needs to be added to your project too, until I figure out why) +### Nugets/Dependencies used +- Newtonsoft.Json ## Features ### New -- Thanks to sgamesdev, I got reminded that the screenshots are missing too, those are included by now +- A nuget package exists now, no more problems: https://www.nuget.org/packages/RawgNET ### General - Get a "Game" object including the complete data like images, description, achievements, screenshots and many more things.. @@ -42,7 +42,7 @@ using (RawgClient client = new(new RawgClientOptions("YOUR KEY FROM https://rawg Console.WriteLine($"Screenshots {Environment.NewLine}--------------"); foreach (Screenshot item in game.Screenshots) { - Console.WriteLine($"------ {Environment.NewLine} Id: {item.Id} {Environment.NewLine} Url: {item.Image} {Environment.NewLine} Image: {item.Image} {Environment.NewLine}"); + Console.WriteLine($"------ {Environment.NewLine} Id: {item.Id} {Environment.NewLine} Url: {item.Image} {Environment.NewLine} Dimension: {item.Width}x{item.Height} {Environment.NewLine}"); } } else @@ -74,7 +74,5 @@ At https://rawg.io/apidocs just press the "Get API Key" button. ## Roadmap -- Make code more clean especially the ""RawgRequest"" method! -- Clean up the messy RawgAccessManager -- Export "Newtonsoft.Json" nuget package with library +- Clean up the messy RawgAccessManager! - More to come.. diff --git a/RawgNET/RawgAccessManager.cs b/RawgNET/RawgAccessManager.cs index 15169e6..86a77bf 100644 --- a/RawgNET/RawgAccessManager.cs +++ b/RawgNET/RawgAccessManager.cs @@ -181,7 +181,7 @@ private static async Task QueryMoreAchievements(string page) private static async Task QueryScreenshots(string gamename, string rawgkey) { - string RawgRequestUrl = GameNameToAchievementQueryUrl(gamename, rawgkey); + string RawgRequestUrl = GameNameToScreenshotQueryUrl(gamename, rawgkey); string JsonResponse = ""; using (HttpClient Client = new()) { @@ -231,6 +231,24 @@ private static async Task QueryGame(string gamename, string rawgkey) return DeserializeGameJson(JsonResponse); } + /// + /// Method to build a ready-to-query url (screenshots) + /// + /// Name of the game we'd like to query + /// Your API-Key + /// + private static string GameNameToScreenshotQueryUrl(string gamename, string rawgkey) + { + string GameName = gamename; + GameName = GameName.ToLower(); + if (gamename.Contains(' ')) + { + GameName = GameName.Replace(" ", "-"); + } + string reqUrl = RawgApiBaseUrl + GameName + $"/screenshots?key={rawgkey}"; + return reqUrl; + } + /// /// Method to build a ready-to-query url (achievements) /// diff --git a/RawgNET/RawgNET.csproj b/RawgNET/RawgNET.csproj index 74f4b77..72f40b4 100644 --- a/RawgNET/RawgNET.csproj +++ b/RawgNET/RawgNET.csproj @@ -4,15 +4,27 @@ net6.0 enable enable - 0.0.4 + 0.0.5 RawgNet liebki liebki https://github.com/liebki/RawgNET https://github.com/liebki/RawgNET git + True + A wrapper for the API of wrag.io, to get a game including all it's data + False + True + LICENSE.txt + + + True + \ + + + diff --git a/RawgNetDemo/Program.cs b/RawgNetDemo/Program.cs index 8f38fa4..d5ce2ac 100644 --- a/RawgNetDemo/Program.cs +++ b/RawgNetDemo/Program.cs @@ -26,7 +26,7 @@ private static void Main(string[] args) Console.WriteLine($"Screenshots {Environment.NewLine}--------------"); foreach (Screenshot item in game.Screenshots) { - Console.WriteLine($"------ {Environment.NewLine} Id: {item.Id} {Environment.NewLine} Url: {item.Image} {Environment.NewLine} Image: {item.Image} {Environment.NewLine}"); + Console.WriteLine($"------ {Environment.NewLine} Id: {item.Id} {Environment.NewLine} Url: {item.Image} {Environment.NewLine} Dimension: {item.Width}x{item.Height} {Environment.NewLine}"); } } else diff --git a/RawgNetDemo/RawgNetDemo.csproj b/RawgNetDemo/RawgNetDemo.csproj index b737f96..a39a4cd 100644 --- a/RawgNetDemo/RawgNetDemo.csproj +++ b/RawgNetDemo/RawgNetDemo.csproj @@ -5,7 +5,7 @@ net6.0 enable enable - 0.0.4 + 0.0.5 RawgNetDemo liebki liebki