Skip to content

Commit 33a957a

Browse files
committed
Fix deserialization globalization issues, add more xml comments. Should fix #10
1 parent 57e1240 commit 33a957a

File tree

13 files changed

+59
-10
lines changed

13 files changed

+59
-10
lines changed

samples/ScryfallApi.NetFxExample/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static string DrawCard(Card card)
3636
{
3737
const int TitleWidth = 31;
3838
var cardName = card.Name + new string(' ', TitleWidth);
39-
var title = cardName.Substring(0, TitleWidth - 1 - card.ManaCost.Length) + " " + card.ManaCost;
39+
var title = cardName.Substring(0, TitleWidth - 1 - (card.ManaCost?.Length ?? 0)) + " " + card.ManaCost;
4040
var type = (card.TypeLine + new string(' ', TitleWidth)).Substring(0, TitleWidth);
4141

4242
var cardText = SplitOnWidth(card.OracleText, 29);
@@ -73,8 +73,10 @@ static string DrawCard(Card card)
7373

7474
static List<string> SplitOnWidth(string text, int width)
7575
{
76-
var rawLines = text.Split(new[] { "\n" }, StringSplitOptions.None);
7776
var textLines = new List<string>();
77+
if (text is null) return textLines;
78+
79+
var rawLines = text.Split(new[] { "\n" }, StringSplitOptions.None);
7880
for (int i = 0; i < rawLines.Length; i++)
7981
{
8082
var line = rawLines[i];

src/ScryfallApi.Client/Apis/Cards.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace ScryfallApi.Client.Apis
77
{
8+
///<inheritdoc cref="ICards"/>
89
public class Cards : ICards
910
{
1011
private readonly BaseRestService _restService;

src/ScryfallApi.Client/Apis/Catalogs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace ScryfallApi.Client.Apis
55
{
6+
///<inheritdoc cref="ICatalogs"/>
67
public class Catalogs : ICatalogs
78
{
89
private readonly BaseRestService _restService;

src/ScryfallApi.Client/Apis/ICards.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
namespace ScryfallApi.Client.Apis
66
{
7+
/// <summary>
8+
/// APIs for cards. Card objects represent individual Magic: The Gathering cards that players could
9+
/// obtain and add to their collection (with a few minor exceptions).
10+
/// </summary>
711
public interface ICards
812
{
913
Task<Card> GetRandom();

src/ScryfallApi.Client/Apis/ICatalogs.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace ScryfallApi.Client.Apis
44
{
5+
/// <summary>
6+
/// A Catalog object contains an array of Magic datapoints (words, card values, etc). Catalog objects
7+
/// are provided by the API as aids for building other Magic software and understanding possible
8+
/// values for a field on Card objects.
9+
/// </summary>
510
public interface ICatalogs
611
{
712
/// <summary>

src/ScryfallApi.Client/Apis/ISets.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
namespace ScryfallApi.Client.Apis
55
{
6+
/// <summary>
7+
/// APIs for card sets. A Set object represents a group of related Magic cards. All Card objects on
8+
/// Scryfall belong to exactly one set.
9+
/// </summary>
610
public interface ISets
711
{
812
/// <summary>

src/ScryfallApi.Client/Apis/ISymbology.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
namespace ScryfallApi.Client.Apis
55
{
6+
/// <summary>
7+
/// APIs for card symbols. A Card Symbol object represents an illustrated symbol that may appear in card’s
8+
/// mana cost or Oracle text. Symbols are based on the notation used in the Comprehensive Rules.
9+
/// </summary>
610
public interface ISymbology
711
{
812
/// <summary>

src/ScryfallApi.Client/Apis/Sets.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace ScryfallApi.Client.Apis
55
{
6+
///<inheritdoc cref="ISets"/>
67
public class Sets : ISets
78
{
89
private readonly BaseRestService _restService;

src/ScryfallApi.Client/Apis/Symbology.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace ScryfallApi.Client.Apis
55
{
6+
///<inheritdoc cref="ISymbology"/>
67
public class Symbology : ISymbology
78
{
89
private readonly BaseRestService _restService;

src/ScryfallApi.Client/IScryfallApiClient.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
namespace ScryfallApi.Client
44
{
5+
/// <summary>
6+
/// REST client for retrieving data from https://api.scryfall.com/. This software has no affiliation
7+
/// with Scryfall.com
8+
/// </summary>
59
public interface IScryfallApiClient
610
{
11+
12+
///<inheritdoc cref="ICards"/>
713
ICards Cards { get; }
14+
15+
///<inheritdoc cref="ICatalogs"/>
816
ICatalogs Catalogs { get; }
17+
18+
///<inheritdoc cref="ISets"/>
919
ISets Sets { get; }
20+
21+
///<inheritdoc cref="ISymbology"/>
1022
ISymbology Symbology { get; }
1123
}
1224
}

0 commit comments

Comments
 (0)