These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[EveLib] A .NET library for EveXML, CREST, EveCentral, and more

First post
Author
Icahmura Hasaki
Perkone
Caldari State
#141 - 2014-12-19 16:05:31 UTC  |  Edited by: Icahmura Hasaki
Another update is out on nuget, a final release of version 2.1.0 will probably be out shortly.

You can no longer switch between authenticated and public mode after instantiating the EveCrest object, since all resources hold a reference to it and use it for queries.

I've added two new ctors which enables authenticated mode, one takes an access token, and the other a refresh token and an encoded key. The default ctor uses public mode.

Automatic paging for LINQ queries
A cool new feature is support for automatic pagination of collections when using LINQ in queries. This enables you to query multiple pages with a single LINQ expression, and is enabled by default. To disable, set AllowAutomaticPaging to false.
An example would be finding data about an alliance, which would usually require you to go through 13 pages, following 'next' links and checking the content. This can now be done with a single statement:
var alliance = crest.GetRoot().Query(r => r.Alliances).Query(r => r.Single(a => a.Id == 123));
or
var alliances = crest.GetRoot().Query(r => r.Alliances).Query(r => r.Where(a => a.Id > 23));

And it supports all possible LINQ expressions and extensions.

  • I've added properties for setting XRequestedWith, Charset and UserAgent to CrestRequestHandler.
  • I've added discovery of new resources, which will let you know when CCP implements a previously unsupported resource if you attempt to query it.
  • You can now pass ImageHrefs, which are usually logos and portraits, to EveCrest.LoadImage() to get the byte data.
  • I've added support for some newly discovered resources, and added a couple of missing ones to the root model.
  • The root object can be cached in the evecrest object, and is enabled by default. If you have a seriously long running task which uses the same EveCrest object (weeks?), you might want to disable this.


And lots of other various tweaks and fixes. The README has also had its section on CREST updated.

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#142 - 2014-12-22 22:32:04 UTC
EveLib 3.0 is now released. Because of the backward incompatibilities, it's been bumped as a new major release.

EveLib is now being distributed as separate libraries on nuget, instead of a single package. This lets me release updates to specific modules without affecting the others. There is a Core module that will be installed automatically as a dependency, so just pick the modules you need and let nuget handle the rest. I'll put links in the original post.

Core
Improved EveLibFileCache, with better support for multiple and concurrent instances. Cache paths are now set in a constructor instead of Config.
Improved cache purging.
Added a CacheLevel enum. This currently supports 4 modes, the default should suffice for most uses.

EveOnlineApi
EveOnlineApi has been renamed to EveXml, which better describes the module. This affects the assembly name, the namespace and 4 classes.
Added support for CacheLevel to the RequestHandler.
Removed EnableCacheLoad and EnableCacheStore properties.

ZKillboard
Added support for CacheLevel to the RequestHandler.
Removed EnableCacheLoad and EnableCacheStore properties.

EveCrest
Added complete support for public and authenticated CREST, with refresh token or access tokens, and several new features related to authenticated CREST.
Added support for every currently available resource, I think
Added LINQ support for paginated collection resources
Added local caching with support for CacheLevel
Added MaxConcurrentRequests property for the RequestHandler. The RequestHandler can be shared between EveCrest instances which allows you to throttle properly while using several different instances with different tokens.

Lots of other features that have been described in recent posts.

Developer of EveLib and EveAuthUtility

SJ Astralana
Syncore
#143 - 2015-01-06 01:04:51 UTC
I did a clone today, and can't build due to a missing CrestCollection.cs in EveCrest.

Hyperdrive your production business: Eve Production Manager

Tango Papa
Cynosural Field Network
#144 - 2015-01-18 04:43:49 UTC
Can someone post a simple working example of interacting with the Zkillboard module? I'm a C# noob and I'm having a difficult time getting going.
Icahmura Hasaki
Perkone
Caldari State
#145 - 2015-01-19 03:37:23 UTC
var api = new ZKillboard();
var options = new ZKillboardOptions();
options.Limit = 1;
options.WSpace = true;
ZkbResponse response = api.GetKills(options);
// use the data in the response

You should read the documentation on ZKillboard what options you can use and combine.

Developer of EveLib and EveAuthUtility

Tango Papa
Cynosural Field Network
#146 - 2015-01-19 18:34:59 UTC
Icahmura Hasaki wrote:
var api = new ZKillboard();
var options = new ZKillboardOptions();
options.Limit = 1;
options.WSpace = true;
ZkbResponse response = api.GetKills(options);
// use the data in the response

You should read the documentation on ZKillboard what options you can use and combine.


You make it look so easy.

I'm more confident creating structs and using pointers in C so I'm really out of my league when it comes to anything with classes and methods. I can read the ZKillboard API but what I really needed was a C# code example to get started with. Thanks a ton for your help!
Tango Papa
Cynosural Field Network
#147 - 2015-01-21 01:52:26 UTC
What really obvious thing am I missing? I'm trying to get information from attackers such as corp, alliance, id, etc. but I can only see DamageDone, FinalBlow, FinalBowString, SecurityStatus, etc.

It's obvious that in the JSON returned by Zkb all is as expected:

Quote:

"attackers":[
{"characterID":"384765072",
"characterName":"Ssj4gogeta",
"corporationID":"98170031",
"corporationName":"The Desolate Order",
"allianceID":"99003214",
"allianceName":"Brave Collective",
"factionID":"0",
"factionName":"",
"securityStatus":"0.0710392792773426",
"damageDone":"900",
"finalBlow":"1",
"weaponTypeID":"31886",
"shipTypeID":"12005"
}
],


But I'm totally overlooking something here:

Quote:
var api = new ZKillboard();
var options = new ZKillboardOptions();

options.Limit = 1;
options.WSpace = true;
ZkbResponse response = api.GetKills(options);
foreach (var data in response)
{
Console.WriteLine("KillID: " + data.KillId);
Console.WriteLine("Number of attackers: " + data.Attackers.Count);
foreach (var attackers in data.Attackers)
{
// Can only get DamageDone, FinalBlow, FinalBowString, SecurityStatus, ShipTypeId, and WeaponTypeId here.

}
}
Icahmura Hasaki
Perkone
Caldari State
#148 - 2015-01-21 04:25:51 UTC
I don't have access to the project here, but looking at the code at github, it seems I've forgotten to inherit ZkbAttacker from ZkbEntity, so many of the general properties are missing. If you've compiled it yourself you can change

public class ZkbAttacker {

to

public class ZkbAttacker : ZkbEntity {

in Models/ZkbResponse.cs

I'll push a fix for this when I get the opportunity, maybe tomorrow.

Developer of EveLib and EveAuthUtility

Tango Papa
Cynosural Field Network
#149 - 2015-01-21 05:28:40 UTC
Icahmura Hasaki wrote:
I don't have access to the project here, but looking at the code at github, it seems I've forgotten to inherit ZkbAttacker from ZkbEntity, so many of the general properties are missing. If you've compiled it yourself you can change

public class ZkbAttacker {

to

public class ZkbAttacker : ZkbEntity {

in Models/ZkbResponse.cs

I'll push a fix for this when I get the opportunity, maybe tomorrow.



Awesome, glad I wasn't going crazy. I installed using the package manager so I'll just wait for a new release for now and work on other aspects of my project.

Thanks again!
SJ Astralana
Syncore
#150 - 2015-01-21 18:03:58 UTC
Tango Papa wrote:
Icahmura Hasaki wrote:
var api = new ZKillboard();
var options = new ZKillboardOptions();
options.Limit = 1;
options.WSpace = true;
ZkbResponse response = api.GetKills(options);
// use the data in the response

You should read the documentation on ZKillboard what options you can use and combine.


You make it look so easy.


C# is C++ with training wheels. Funny thing about training wheels, they're like diapers: you need them when you're too young or too old.

Hyperdrive your production business: Eve Production Manager

Tango Papa
Cynosural Field Network
#151 - 2015-01-22 17:06:34 UTC
I sent a pull request on Github for the change.
Syrsyrian
The Scope
Gallente Federation
#152 - 2015-02-19 16:04:15 UTC
Firstly, thank you so much for this. Made working with the API much less of a pain. Secondly I am trying to search through alliances by name rather than id but the names are null using the following code block;


EveCrest crest = new EveCrest();

var alliance = crest.GetRoot().Query(r => r.Alliances).Query(r => r.Where(a => a.Name == allianceName)).FirstOrDefault();







any ideas?
Warren DeMartini
Blood Alcohol Content
T O P S H E L F
#153 - 2015-03-07 00:31:24 UTC  |  Edited by: Warren DeMartini
Sorry for the noob question, but I can't seem to get a market return for a specific system. Using eve-central library, do you have to provide both the region and the system?

I've tried this (VB.NET):

options.Regions.Add(10000002)
options.System = ItemID' itemID is the id for the specific system
Dim response As EveCentralModule.Models.MarketStatResponse = EveCentral.GetMarketStat(options)


...which does return data for the region, but I can't figure out how to get info on the system. If I provide only the system, I get all 0's on the returns. Am I going about it the wrong way?

What I'm looking for is a code example for getting information for a specific system. I appreciate any help!

If anyone has some code that shows best practices on how to use the market objects in general, that would also be greatly appreciated!

If there's already documentation that's easy to follow, I apologize - all I could find were the sparse examples on Git.

-Warren
Icahmura Hasaki
Perkone
Caldari State
#154 - 2015-03-08 04:07:51 UTC
https://eve-central.com/home/develop.html

There is an example there using system without a region, which I assume is the correct way. If this returns 0 or errors as you say it's a bug. I'll have a look tomorrow.

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#155 - 2015-03-10 12:52:49 UTC
I just tested using a system and it seems to be working fine, are you still having issues?

Developer of EveLib and EveAuthUtility

Dor Cadmon
New Artisian and Mercenary Association
#156 - 2015-03-15 11:33:29 UTC
I would like to thank you for creating this package.

i'm looking to integrate with the corp api stuff available. I have specific questions regarding starbases.

I have created a corp api object and returned the get star base list and then started iterating through each. I have two problems because i'm a newb.

1. I don't know how to find out the pos name! very frustrating
1b. I can't do lookups using starbase ids of type long because the lookup functions I found require int types.




Dim api As New EveApi
api.Authentication = auth

Dim info() As PropertyInfo = api.GetType().GetProperties()
Dim charsInfo = api.GetAccountEntries()
Dim corpApi = api.GetCorporationStarbaseList
Dim StarBaseList = api.GetCorporationStarbaseList


For Each mm As StarbaseListEntry In StarBaseList

Dim stbDetails = api.GetCorporationStarbaseDetail(mm.ItemID)


>>>>>>>>>>> Dim ControlToweName As String = ""




Dim ControlTowerLocation = stbDetails.AdditionalData.Location.Name

Next
Icahmura Hasaki
Perkone
Caldari State
#157 - 2015-03-16 14:27:41 UTC
I'm not sure how this relates to EveLib. The code you have does not use EveLib, maybe you have it confused with another library ?

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#158 - 2015-03-16 14:42:48 UTC  |  Edited by: Icahmura Hasaki
Try using the location API to get the name.

Developer of EveLib and EveAuthUtility

Dor Cadmon
New Artisian and Mercenary Association
#159 - 2015-03-16 14:46:31 UTC
so sorry for referencing wrong code (I did try a couple diff libs to see if they would teach me.

Dim corp As New Corporation(corKey, corpId)


Dim sbL = corp.GetStarbaseList.Result.Starbases
For Each sb As Starbase In sbL
Dim sbState As Integer = 0

sbState = sb.State





Next


I know I can get the location for this object but would you please show me how I'd use the ID coming from the starbase asset (or any corp asset for that matter) to retrieve the name? I believe that pos' and jb's are considered containers in this context?

again thanks for taking the time to educate me and great api.
Icahmura Hasaki
Perkone
Caldari State
#160 - 2015-03-16 15:04:26 UTC  |  Edited by: Icahmura Hasaki
Use the Locations API, it returns the name.

Dim location = corp.GetLocations(itemID) // you can do multiple IDs at a time
Dim itemName = location.itemName

Developer of EveLib and EveAuthUtility