open All Channels
seplocked EVE Technology Lab
blankseplocked Advice for simple market monitoring program
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

selina69
Posted - 2011.07.19 18:22:00 - [1]
 

Writing a program in C# just to keep a track of a few items in jita using eve-central. I looked up their api but for some reason I couldn't get it to work properly using the built in XML readers within Visual studio.

I downloaded EveAI but EvEAi does not let you parse by system, even though eve-central's API does let you.

has anyone here built a similar app or knows how to get the eve-central api to work properly with the XML readers in visual studio?

TL;DR - Having trouble, eve-central api parse by system. C#

Biba Tradzor
Posted - 2011.07.19 22:37:00 - [2]
 

Assuming you have put the result of /char/WalletTransactions.xml.aspx in transactions.xml


XmlTextReader reader = new XmlTextReader("transactions.xml");
while (reader.Read())
{
if (reader.Name == "row")
{
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
Int32 typeID;
if (reader.Name == "typeID") { typeID = Int32.Parse(reader.Value); }
..
..
}
}
}
}
reader.Close();



selina69
Posted - 2011.07.21 14:04:00 - [3]
 

I have the majority of it working now. Just having a little trouble parsing a search string with multiple typeids.

See link: http://pastebin.com/V7EXnwtm

Of course it doesn't work though, trying to figure out why. Any suggestions?

basically, i'm trying to pull down minimum sell price for minerals in jita with one query and then send the value to the labels accordingly.

Bosence
Anuran Origin
Posted - 2011.07.21 15:17:00 - [4]
 

Edited by: Bosence on 21/07/2011 15:19:36
I took a look at your code, and adjusted it. This worked on my test enviroments. Please don't forget to cache a local copy, for the sake of eve-centrals bandwidth and the system admins hair! :)

Sometimes, it's easy to see where you were going wrong by just looking at code (99% of coding errors are simple little things over looked, (and 86% of statistics are made up)), if you can't work it out drop me an evemail - I'll be more than happy to explain it.


XmlTextReader xtr = new XmlTextReader("http://api.eve-central.com/api/marketstat?typeid=34&typeid=35&typeid=36&typeid=37&typeid=38&typeid=39&typeid=40&typeid=11399&usesystem=30000142");
xtr.WhitespaceHandling = WhitespaceHandling.None;

XmlDocument X = new XmlDocument();
X.Load(xtr);

if (!(X == null))
{
try
{
foreach (XmlNode type in X.SelectNodes("evec_api/marketstat/type"))
{
switch (type.Attributes["id"].Value.ToString())
{
case "34":
tPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "35":
pPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "36":
mEXPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "37":
pPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "38":
nPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "39":
mEGPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "40":
zPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "11399":
mOPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
default:
MessageBox.Show("Broke", "Something went wrong!", MessageBoxButtons.OK);
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}


Edit: Changed from quote to code, didn't realise the forums had those tags Neutral

selina69
Posted - 2011.07.21 15:25:00 - [5]
 

Originally by: Bosence
Edited by: Bosence on 21/07/2011 15:19:36
I took a look at your code, and adjusted it. This worked on my test enviroments. Please don't forget to cache a local copy, for the sake of eve-centrals bandwidth and the system admins hair! :)

Sometimes, it's easy to see where you were going wrong by just looking at code (99% of coding errors are simple little things over looked, (and 86% of statistics are made up)), if you can't work it out drop me an evemail - I'll be more than happy to explain it.


XmlTextReader xtr = new XmlTextReader("http://api.eve-central.com/api/marketstat?typeid=34&typeid=35&typeid=36&typeid=37&typeid=38&typeid=39&typeid=40&typeid=11399&usesystem=30000142");
xtr.WhitespaceHandling = WhitespaceHandling.None;

XmlDocument X = new XmlDocument();
X.Load(xtr);

if (!(X == null))
{
try
{
foreach (XmlNode type in X.SelectNodes("evec_api/marketstat/type"))
{
switch (type.Attributes["id"].Value.ToString())
{
case "34":
tPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "35":
pPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "36":
mEXPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "37":
pPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "38":
nPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "39":
mEGPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "40":
zPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
case "11399":
mOPrice.Text = type.SelectSingleNode("all/min").InnerText.ToString();
break;
default:
MessageBox.Show("Broke", "Something went wrong!", MessageBoxButtons.OK);
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}


Edit: Changed from quote to code, didn't realise the forums had those tags Neutral


This will help out a lot. I've been messing around with it but couldn't find a way to separate it. I'm sure the type.attributes switch will work though. Little new to parsing xml and not much to go off of for eve central. I'll set it up and see if it works!


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only