-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using eZet.EveLib.Core.RequestHandlers; | ||
using eZet.EveLib.Core.Serializers; | ||
using eZet.EveLib.Core.Util; | ||
|
||
namespace eZet.EveLib.Core { | ||
/// <summary> | ||
/// This is a class for general EveLib utilities and methods | ||
/// </summary> | ||
public class EveLib : EveLibApiBase { | ||
private readonly JsonSerializer _jsonSerializer = new JsonSerializer(); | ||
|
||
private readonly XmlSerializer _xmlSerializer = new XmlSerializer(); | ||
|
||
/// <summary> | ||
/// Default constructor | ||
/// </summary> | ||
public EveLib() { | ||
RequestHandler = new RequestHandler(_jsonSerializer); | ||
} | ||
|
||
/// <summary> | ||
/// Requests and deserializes JSON content to a dynamic object | ||
/// </summary> | ||
/// <param name="uri">URI to request</param> | ||
/// <returns></returns> | ||
public Task<dynamic> RequestJsonAsync(string uri) { | ||
RequestHandler.Serializer = _jsonSerializer; | ||
return requestAsync<dynamic>(uri); | ||
} | ||
|
||
/// <summary> | ||
/// Requests and deserializes JSON content to a dynamic object | ||
/// </summary> | ||
/// <param name="uri">URI to request</param> | ||
/// <returns></returns> | ||
public dynamic RequestJson(string uri) { | ||
return RequestJsonAsync(uri).Result; | ||
} | ||
|
||
/// <summary> | ||
/// Requests and deserializes XML content to a dynamic object. Not implemented yet. | ||
/// </summary> | ||
/// <param name="uri">URI to request</param> | ||
/// <returns></returns> | ||
public Task<dynamic> RequestXmlAsync(string uri) { | ||
throw new NotImplementedException(); | ||
RequestHandler.Serializer = _xmlSerializer; | ||
return requestAsync<dynamic>(uri); | ||
} | ||
|
||
/// <summary> | ||
/// Requests and deserializes XML content to a dynamic object. Not implemented yet. | ||
/// </summary> | ||
/// <param name="uri">URI to request</param> | ||
/// <returns></returns> | ||
public dynamic RequestXml(string uri) { | ||
throw new NotImplementedException(); | ||
return RequestXmlAsync(uri).Result; | ||
} | ||
} | ||
} |