Skip to content
Lars Kristian Dahl edited this page Feb 15, 2016 · 9 revisions

EveLib.NET


EveLib.NET is a open source library for accessing the Eve Online API, CREST, and many other popular APIs.

Links

Features

  • Fully asynchronous using TAP.
  • XML configuration through app.config.
  • Threadsafe.
  • Access to all popular APIs through one library.
  • Provides caching for CCP API requests.
  • Modular and open source; you can easily change the caching, serialization or any other part of the library.
  • A fairly comprehensive set of unit tests, including static xml tests for calls requiring authentication.

Current Modules

  • Eve Online XML API EveXml [cached]
  • Eve CREST EveCrest [cached]
  • Eve Central API EveCentral
  • Eve Marketdata API EveMarketData
  • Element43 API Element43
  • ZKillboard API ZKillBoard [cached]
  • EveWho EveWho
  • EveAuth EveAuth (Eve SSO)
  • Eve Static Data (Element43) EveStaticData [partial]

General information

The project is split into one dll for each api, aswell as one core library. All libraries require the core library, but can otherwise be mixed and matched as you like.

Code Contracts

The library implements Code Contracts, but this feature is completely optional and is disabled by default. Code Contracts enables static and runtime checks to ensure you are using the EveLib API correctly. If you want to utilize this, you should install http://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970 and read the documentation. The Code Contract reference assemblies are available in the NuGet package. See http://research.microsoft.com/en-us/projects/contracts/ for more information.

Debugging and Tracing

The library uses TraceSource from the System.Diagnostics namespace. The TraceSource is named "EveLib". To add the Default listener to EveLibs TraceSource, add this to your application configuration (usually app.config):

<configuration>
  <system.diagnostics>
    <sources>
      <source name="EveLib" switchValue="All"/>
    </sources>
  </system.diagnostics>
</configuration>

This adds the Default listener, which usually outputs to the VS output window. For more information on using TraceSource, visit http://msdn.microsoft.com/en-us/library/ms228993(v=vs.110).aspx

Caching

Some modules support local cache, as indicated in the list of supported modules. You can change the CacheLevel property on the RequestHandlers to set the cache behaviour. You can replace the Cache instances with your own implementation or new EveLibCache instances with different settings if you need to eg. change the cache path.

Async/Await

All methods that access an API provide both a synchronous and an asynchronous. Asynchronous methods are postfixed with Async. Some classes provide lazily loaded properties, which will always be loaded synchronously if a new request has to be made. To load such properties asynchronously, call InitAsync() on the respective objects, before accessing it's properties. All such properties are documented as such in it's comments.

Exception Handling

The exception handling is slightly different between the synchronous and asynchronous methods. For examples of handling AggregateException, see http://msdn.microsoft.com/en-us/library/dd537614(v=vs.110).aspx

General information

The actual exceptions thrown (directly or inside AggregateException) should always inherit from EveLibException. If any other exception is throw, that is a bug and should be reported. Most exceptions will inherit from EveLibWebException, which indicates there was an error when performing the web request. All EveLibWebExceptions have a property WebException, which contains the responsible WebException. Most modules throw EveLibWebException directly, unless otherwise is stated. (Currently EveOnline and EveCrest throw more specific exceptions).

Synchronous

Because the synchronous methods use sync over async, they can throw multiple exceptions. This is handled by wrapping all exceptions in an AggregateException, which has a list, InnerExceptions, of all Exceptions that has been thrown. When using the synchronous methods, you catch AggregateException.

Asynchronous

When using async/await, the AggregateException is unwrapped and only the FIRST inner exception is thrown. The AggregateException is available through the Exception property on the Task that is awaited. Catch InvalidRequestException or any other specific exception, like normal, and check the Exception on the Task if you need to handle more than the first.

EveCentral API

This module provides access to all calls on the EveCentral api. All api calls can be made through any EveCentral object. Most parameters for requests can be set and passed in a EveCentralOptions object.

var options = new EveCentralOptions() { HourLimit = 4, MinQuantity = 5 };
options.Items.Add(34);
options.Regions.Add(10000002);
var eveCentral = new EveCentral();
MarketStatResponse response = eveCentral.GetMarketStat(options);

Element43 API

Similar to EveCentral API. Uses Element43Options.

EveMarketData API

Similar to EveCentral API. Uses EveMarketDataOptions.

Zkillbord

Please read ZKillboard API documentation.

EveWho

Please read EveWho API documentation.

Clone this wiki locally