ontehfritz / csharpmtgdb.info Goto Github PK
View Code? Open in Web Editor NEWC# driver for api.mtgdb.info
Home Page: https://www.mtgdb.info
C# driver for api.mtgdb.info
Home Page: https://www.mtgdb.info
When you have time Gilles that would be awesome! Updates coming Apr 9th
Version 0.2
@TheZappa sent you an email :)
Gets a card in a set
Probably should have a check like this:
if( end < start || start <= 0 )
rather than
if( start > 0 || end > 0 )
to ensure success of the API call.
Whenever I call GetCard (or any other Get method) using the latest source, it always returns null whenever I pass an id parameter.
Code:
var db = new Db();
Card card = db.GetCard(1);
Debugging shows that it is actually actually using the url 'https://api.mtgdb.info/cards/System.String[]' and silently handles this exception.
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'MtgDb.Info.Card' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
The following code:
private void button1_Click(object sender, EventArgs e)
{
var Db = new MtgDb.Info.Driver.Db();
Card card = Db.GetRandomCard(); <-- Throwed here
pictureBox1.Load(card.CardImage);
}
Throws unhandled exception randomly.
Exception:
An unhandled exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in Newtonsoft.Json.dll
Additional information: Error converting value {null} to type 'System.DateTime'. Path 'releasedAt', line 1, position 1890.
The API returns empty release dates and the parser can't handle them, am I right?
Also:
< packages>
< package id="MtgDb.Info.Driver" version="0.3" targetFramework="net40" />
< package id="Newtonsoft.Json" version="6.0.2" targetFramework="net40" />
< /packages>
Side Note: Projects in monodevelop don't seem to be able to load with VS 2010, however vice versa is OK.
Also the C# driver throws exceptions on windows 7:
System.IO.FileNotFoundException: Could not load file or assembly 'MtgDb.Info.Driver, Version=0.1.5176.17133, Culture=en, PublicKeyToken=null' or one of its dependencies. Het systeem kan het opgegeven bestand niet vinden.
File name: 'MtgDb.Info.Driver, Version=0.1.5176.17133, Culture=en, PublicKeyToken=null'
Kudos to: Gilles Van Glabeke
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.