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
#261 - 2015-10-22 22:25:03 UTC
Malketh Terona wrote:
Trying to install this in a Universal app project in VS2015 and I'm getting an error message stating that all of the packages are "not compatible with UAP,Version=v10.0 (win10-x64-aot)". Thought you might like to know.


Thanks for the feedback, I'll have a look at it :)

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#262 - 2015-10-22 22:27:18 UTC
Dextrome Thorphan wrote:
Icahmura Hasaki wrote:
Dextrome Thorphan wrote:
Icahmura Hasaki wrote:
Uhm, forgot I haven't actually published that fix on nuget. I wanted to release that together with some other fixes. I'll see if I can get it done later today, I'll post back here when I publish it.


Hehe ok, thanks Big smile


If you use the source from github the fix is in there, feel free to test it.


Ah sorry, haven't had the chance to get around to it yet, will check it out some time this week and will let you know :)


Your issue has been fixed in the newest version on nuget, along with some other things.

Developer of EveLib and EveAuthUtility

Groot DeStefano
Caldari Provisions
Caldari State
#263 - 2015-10-23 16:12:24 UTC
Thanks for your work!
Where can I find some kind of documentation about the code? As a c# noob, i am struggeling (crest market stuff...). I get System.AggregateException errors.
Revigon VI
Ministry of War
Amarr Empire
#264 - 2015-10-24 20:23:50 UTC  |  Edited by: Revigon VI
Heya. Great work so far but ... do you plan move your lib's to be able to use them on Universal Windows Platform?
Dextrome Thorphan
#265 - 2015-10-25 08:52:19 UTC  |  Edited by: Dextrome Thorphan
Groot DeStefano wrote:
Thanks for your work!
Where can I find some kind of documentation about the code? As a c# noob, i am struggeling (crest market stuff...). I get System.AggregateException errors.


Take a look at the inner exception, see if you can't find a more specific error message - System.AggregateException is quite vague ;)

There's some general explanation & code samples over here, at the bottom: https://github.com/ezet/evelib
Icahmura Hasaki
Perkone
Caldari State
#266 - 2015-10-25 11:31:26 UTC
Groot DeStefano wrote:
Thanks for your work!
Where can I find some kind of documentation about the code? As a c# noob, i am struggeling (crest market stuff...). I get System.AggregateException errors.


As Dextrome mentioned, you need to look at the inner exception. The 'real' exceptions get wrapped in Aggregate exceptions because of the async code, so there could be more of them. The inner exception is a property of the Aggregate one. Please let me know if something isn't working correctly so I can fix it ;)

Developer of EveLib and EveAuthUtility

Ocean Cineol
Too Big To Die
#267 - 2015-10-25 23:02:09 UTC
Thanks for your help, I learned quiet a bit!

var BlackRise = crest.GetRoot().Query(a => a.Regions).Query(b=> b.Where(x => x.Name == "BlackRise")).First();
BlackRise.MarketBuyOrders = "?type=" + /* what should be here? */;
var allbuys = BlackRise.Query(c=> c.MarketBuyOrders).Items.ToList();

the code starts at the root , finds the first fitting ID for my region.
Then i should query the the type of order(buy/sell) and the TypeID of my desired Item. (here i fail badly)
Then it is saved to the cachefiles.
Dextrome Thorphan, your code really helped to try to understand that stuff.
The exception happens, because i fail to query the typeID in the right way and the uri is wrong.
Cheers!
Icahmura Hasaki
Perkone
Caldari State
#268 - 2015-10-26 06:54:31 UTC
Ocean Cineol wrote:
Thanks for your help, I learned quiet a bit!

var BlackRise = crest.GetRoot().Query(a => a.Regions).Query(b=> b.Where(x => x.Name == "BlackRise")).First();
BlackRise.MarketBuyOrders = "?type=" + /* what should be here? */;
var allbuys = BlackRise.Query(c=> c.MarketBuyOrders).Items.ToList();

the code starts at the root , finds the first fitting ID for my region.
Then i should query the the type of order(buy/sell) and the TypeID of my desired Item. (here i fail badly)
Then it is saved to the cachefiles.
Dextrome Thorphan, your code really helped to try to understand that stuff.
The exception happens, because i fail to query the typeID in the right way and the uri is wrong.
Cheers!


The API for passing along parameters isn't really finished, which is why you're not finding any examples of how to pass in the type. I can't test this right now, but you could try to do eg.

BlackRise.MarketBuyOrders += "?type=https://public-crest.eveonline.com/types/2/";

And then query that., it might work unless I'm forgetting something :) Also

var allbuys = BlackRise.Query(c=> c.MarketBuyOrders).AllItems();

would you give ALL items in the list by going through all pages, Items().ToList() would only return the items from page you are requesting.

I should make it clear that any way of passing parameters that you find working now, isn't officially supported and might change in the future. I'll try and find good way to handle both parameters and POST requests shortly.

Developer of EveLib and EveAuthUtility

Dextrome Thorphan
#269 - 2015-10-26 11:18:59 UTC  |  Edited by: Dextrome Thorphan
-nvm, misunderstood- (too bad you can't delete replies)
Groot DeStefano
Caldari Provisions
Caldari State
#270 - 2015-10-26 15:50:43 UTC  |  Edited by: Groot DeStefano
System.AggregateException
HResult=-2146233088
Source=mscorlib
StackTrace:
bei System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
bei System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
bei System.Threading.Tasks.Task`1.get_Result()
bei eZet.EveLib.EveCrestModule.EveCrest.Load[T](Href`1 uri)
bei eZet.EveLib.EveCrestModule.Models.Resources.CrestResource`1.Query[TOut](Func`2 objFunc)
bei ConsoleApplication4.Test.Main(String[] args) in C:\Users\***\Documents\Visual Studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs:Zeile 76.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146233088
LineNumber=1
LinePosition=694
Message=JSON integer 4294091884 is too large or small for an Int32. Path 'items[0].id', line 1, position 694.
Path=items[0].id
Source=Newtonsoft.Json


 var crest = new EveCrest();
             var root = crest.GetRoot();
            var theForge = crest.GetRoot().Query(r => r.Regions).Query(r => r.Where(x => x.Name == "The Forge")).First();
            theForge.MarketBuyOrders += "?type=https://public-crest.eveonline.com/types/34/";
            var allbuys = theForge.Query(c => c.MarketBuyOrders).Items.ToList();


With "?type=https://public-crest.eveonline.com/types/2/"; the code is running...

P.S. AllItems is not working.

Edit: i get it, the Nuget version is not updated yet :)
the updated version is working :) thanks!
Icahmura Hasaki
Perkone
Caldari State
#271 - 2015-10-26 16:10:14 UTC  |  Edited by: Icahmura Hasaki
Groot DeStefano wrote:
System.AggregateException
HResult=-2146233088
Source=mscorlib
StackTrace:
bei System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
bei System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
bei System.Threading.Tasks.Task`1.get_Result()
bei eZet.EveLib.EveCrestModule.EveCrest.Load[T](Href`1 uri)
bei eZet.EveLib.EveCrestModule.Models.Resources.CrestResource`1.Query[TOut](Func`2 objFunc)
bei ConsoleApplication4.Test.Main(String[] args) in C:\Users\***\Documents\Visual Studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs:Zeile 76.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146233088
LineNumber=1
LinePosition=694
Message=JSON integer 4294091884 is too large or small for an Int32. Path 'items[0].id', line 1, position 694.
Path=items[0].id
Source=Newtonsoft.Json


 var crest = new EveCrest();
             var root = crest.GetRoot();
            var theForge = crest.GetRoot().Query(r => r.Regions).Query(r => r.Where(x => x.Name == "The Forge")).First();
            theForge.MarketBuyOrders += "?type=https://public-crest.eveonline.com/types/34/";
            var allbuys = theForge.Query(c => c.MarketBuyOrders).Items.ToList();


With "?type=https://public-crest.eveonline.com/types/2/"; the code is running...

P.S. AllItems is not working.

Edit: i get it, the Nuget version is not updated yet :)


Are you using the newest version of EveCrest, 3.1.0? At least it seems that way of providing a type parameter works. I thought the int32 problem was fixed in the newest version on nuget. I'll have a look in an hour or two.

Appending the ?type string to the MarketBuyOrders or MarketSellOrders property and then doing a query works, as does AllItems(), at least in the version that is SUPPOSED to be on nuget, 3.1.0. Can someone please confirm or deny?


        [TestMethod]
        public async Task GetBuyOrder() {
            var theForge =
                await
                    (await
                        (await crest.GetRootAsync())
                    .QueryAsync(r => r.Regions))
                .QueryAsync(x => x.Single(r => r.Name == "The Forge"));
            theForge.MarketBuyOrders += "?type=https://public-crest.eveonline.com/types/34/";
            var orders = await (await theForge.QueryAsync(r => r.MarketBuyOrders)).AllItemsAsync();
        }


Also, anyone got any ideas for how to make chaining async calls easier/cleaner? I guess I need to return a custom awaitable ?

Developer of EveLib and EveAuthUtility

Groot DeStefano
Caldari Provisions
Caldari State
#272 - 2015-10-26 18:08:48 UTC
AllItems is working!
Icahmura Hasaki
Perkone
Caldari State
#273 - 2015-10-26 19:07:25 UTC  |  Edited by: Icahmura Hasaki
I've added a possible implementation for passing parameters, as simple key/value string pairs that can be included in .Load() or .Query() calls.

Example:

var orders = crest.GetRoot().Query(r => r.Regions)
  .Query(x => x.Single(r => r.Name == "The Forge"))
  .Query(r => r.MarketBuyOrders, "type", "https://public-crest.eveonline.com/types/34/");


This isn't very safe tho as is very apt to typing bugs. It also allows partly user constructed URLs, which breaks some of the goals with CREST.

So should I perhaps disallow manual URLs like the example above, and do something like this:

var type = crest.GetRoot().Query(r => r.MarketTypes).Items.Single(r => r.Type.Id == 34);
var orders = crest.GetRoot().Query(r => r.Regions)
  .Query(x => x.Single(r => r.Name == "The Forge"))
  .Query(r => r.MarketBuyOrders, "type", type);


Where you first need to get the type you want through CREST, and you pass that in directly?
It would still be possible to construct URLs manually if you really wanted, but is more in line with the stated goals for CREST.

The parameter name is still manually typed, but I'm not sure if it is worth the hassle to enforce that with eg. enums or a parameter object for each name/value pair ? I'm open for input on how you would like this to be implemented :)

The first example is valid for the newest version on github if anyone wants to try it out. It allows an arbitrary amount of name/value pairs, and works for all types of resources that support it, eg. market types, market groups, and so on.

Developer of EveLib and EveAuthUtility

Erick1111
Quebec's Underdog League
Quebec United Legions
#274 - 2015-10-29 14:56:44 UTC
Really nice work doing this tool btw! I love it. I'm having an issue when I try to load a character image. I'm probably doing something wrong, but I can't figure out what exactly... Here's my code:


byte[] charImg = img.GetCharacterPortraitData(characterList[0].CharacterId, eZet.EveLib.EveXmlModule.Image.CharacterPortraitSize.X64);
charPortrait.Source = ByteToImage(charImg);



When I call GetCharacterPortraitData, it just doesn't go any further as if the thread would never be comming to an end. I've tried accessing it directly on my web browser and it works, and I've also tried crest.LoadImage() with the uri, and I get the exact same issue...

You have an idea what could be the cause?
Ocean Cineol
Too Big To Die
#275 - 2015-10-29 20:34:58 UTC
Good evening!
I am trying to access the cached files.


string savedstuff= IEveLibCache.LoadAsync(Uri.uri);


I believe that EveLibApiBase creates the Uri, but I can't use it. What do I have to enter for Uri.uri?
Thanks...
Icahmura Hasaki
Perkone
Caldari State
#276 - 2015-10-29 22:21:52 UTC
Erick1111 wrote:
Really nice work doing this tool btw! I love it. I'm having an issue when I try to load a character image. I'm probably doing something wrong, but I can't figure out what exactly... Here's my code:


byte[] charImg = img.GetCharacterPortraitData(characterList[0].CharacterId, eZet.EveLib.EveXmlModule.Image.CharacterPortraitSize.X64);
charPortrait.Source = ByteToImage(charImg);



When I call GetCharacterPortraitData, it just doesn't go any further as if the thread would never be comming to an end. I've tried accessing it directly on my web browser and it works, and I've also tried crest.LoadImage() with the uri, and I get the exact same issue...

You have an idea what could be the cause?


I haven't really tested that part of the library much, and it's been a long long time since I touched it. I'll have a look at it tomorrow and get back to you with a solution :)

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#277 - 2015-10-30 08:19:02 UTC
Ocean Cineol wrote:
Good evening!
I am trying to access the cached files.


string savedstuff= IEveLibCache.LoadAsync(Uri.uri);


I believe that EveLibApiBase creates the Uri, but I can't use it. What do I have to enter for Uri.uri?
Thanks...


I don't quite understand what exactly you are trying to accomplish? The cached files are stored as plain xml and json files in the cache dir. You can load the files through an instance of IEveLibCache, but not the interface itself.

If you told me more about what you are trying to accomplish I might be able to help you more.

Developer of EveLib and EveAuthUtility

Ocean Cineol
Too Big To Die
#278 - 2015-10-30 10:41:00 UTC  |  Edited by: Ocean Cineol
Your code works fine, I am just trying to implement the IEveLibCache Interface Roll to load the cached data. Seems like I went down too deep.
Icahmura Hasaki
Perkone
Caldari State
#279 - 2015-10-30 18:49:42 UTC
Ocean Cineol wrote:
Your code works fine, I am just trying to implement the IEveLibCache Interface Roll to load the cached data. Seems like I went down too deep.


Ah, okay. Well, your idea should work fine, if thats how you want to do it. As I said, the cached files are available in the CachePath as plain text files, with the filenames being a hash of the url they represent. So if you want to implement your own IEveLibCache to read files stored by my implementation, you need to use the same hash to retrieve the correct file. You'll find the details in my EveLibFileCache, its just a SHA1 with the hyphens (-) removed.

Developer of EveLib and EveAuthUtility

Erick1111
Quebec's Underdog League
Quebec United Legions
#280 - 2015-10-30 22:21:30 UTC
Icahmura Hasaki wrote:
Erick1111 wrote:
Really nice work doing this tool btw! I love it. I'm having an issue when I try to load a character image. I'm probably doing something wrong, but I can't figure out what exactly... Here's my code:


byte[] charImg = img.GetCharacterPortraitData(characterList[0].CharacterId, eZet.EveLib.EveXmlModule.Image.CharacterPortraitSize.X64);
charPortrait.Source = ByteToImage(charImg);



When I call GetCharacterPortraitData, it just doesn't go any further as if the thread would never be comming to an end. I've tried accessing it directly on my web browser and it works, and I've also tried crest.LoadImage() with the uri, and I get the exact same issue...

You have an idea what could be the cause?


I haven't really tested that part of the library much, and it's been a long long time since I touched it. I'll have a look at it tomorrow and get back to you with a solution :)


Well, I got it to work using the synchronous methods of WebClient and replaced the code consequently in your project. I wont use async until later in my app.

I was also getting troubles with EveCrest.LoadImage() I,m just trying to confirm with you that these are actual bugs and not some mess up on my side before I try and invest time in it.

Thanks