Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
epsilonion
|
Posted - 2011.06.09 23:03:00 -
[1]
I am new to this programming lark, last time i programmed anything was in pascal years and years ago and things have moved on since then....
The problem I have.... As you can tell with the code below I have tried everything with all the imports.. :D gone through forums books you name it...
My idea is to pull the corp memberlist from the api and store it in a database (this is the hard part for me, everything else from taht point is easy for me..
I am using VB (visual Studio)...
I get the API back into the 'webdata' but nothing will parse it from there tried reading it with everything thing nothing works... also tried eveai but lack of documentation i gave up.... but had the same problem there nothing would open webdata as could not convert type was all i seemed to get...
once i get the damn thing parsed I will be happy and able to continue.. :D
any help would be great.. :D
==================================================================================
Imports System.Net Imports System.Text Imports System.IO Imports System.Xml Imports System.Object Imports System.Xml.XmlReader Imports System.Xml.Serialization Imports System.Web.UI.Page
Public Class _Default
' Inherits SerializableData
Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim userID As String = "xxxxxxxxx" 'txtUserID.Text Dim CharacterID As String = "xxxxxxxxxxxx" Dim apikey As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ' txtAPIKey.Text
' Set the URL to retrieve data Dim remoteURL As String = "https://api.eveonline.com/corp/MemberTracking.xml.aspx"
' Set the POST data Dim postData As String = "userID=" & userID & "&characterID=" & CharacterID & "&apikey=" & apikey
' Create the requester Dim request As HttpWebRequest = CType(WebRequest.Create(remoteURL), HttpWebRequest)
' Setup request parameters request.Method = "POST" request.ContentLength = postData.Length request.ContentType = "application/x-www-form-urlencoded"
' Setup a stream to write the HTTP "POST" data Dim WebEncoding As New ASCIIEncoding() Dim byte1 As Byte() = WebEncoding.GetBytes(postData) Dim newStream As Stream = request.GetRequestStream() newStream.Write(byte1, 0, byte1.Length) newStream.Close()
' Prepare for a response from the server Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) ' Get the stream associated with the response. Dim receiveStream As Stream = response.GetResponseStream() Dim readStream As New StreamReader(receiveStream, Encoding.UTF8) Dim webdata As String = readStream.ReadToEnd()
' TextBox1.Text() = webdata <<--- does not work says can not convert to value '================ ========================================= ' Now we have the API XML lets parse the XML and put the corp members into a database.
'=========================================================================
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub End Class
|
epsilonion
|
Posted - 2011.06.09 23:06:00 -
[2]
should also mention that the data sent back is over 300 records... dont know if that will make a difference as it should be parsed in memory then the session destroyed when the data is saved into the database.
ty |
Hel O'Ween
Men On A Mission EVE Trade Consortium
|
Posted - 2011.06.10 10:00:00 -
[3]
It might be worth to have a look at EveAI, a .NET wrapper for the EVE API. -- EVEWalletAware - an offline wallet manager |
epsilonion
|
Posted - 2011.06.10 10:13:00 -
[4]
Tried eveai still could not get it working.... had the required returned values from the webcall but after that could not get anything working with the data.
as there is no documentation with eveai, i gave up on that route..
|
Immersive
Immersive Technology Solutions
|
Posted - 2011.06.10 12:13:00 -
[5]
Originally by: epsilonion
' TextBox1.Text() = webdata <<--- does not work says can not convert to value '================ ========================================= ' Now we have the API XML lets parse the XML and put the corp members into a database.
It's been a while since I did VB. I'm mostly a C++/C# guy now.
I think the problem is you're trying to use a function as a property. The corrected code should be:
TextBox1.Text = webdata '<<--- note the missing parentheses Good Luck.
--- New to the API? GrabRaw XML
It's coming...
|
Desmont McCallock
|
Posted - 2011.06.10 12:54:00 -
[6]
As Immersive said.
You are trying to assign data of type String (webdata) to a property that takes String type data (Text) of a control class (TextBox1) that implements the Text property.
In your code you are calling "Text" as a method (Text())and not as a property (Text). Therefore, the correct code should be: TextBox1.Text = webdata
|
Zeta Zhul
Caldari Preemptive Paranoia
|
Posted - 2011.06.10 16:24:00 -
[7]
EveAI basic code:
1. Get the UserId and full APIKey for -your- account. 2. Use the UserId & APiKey + CharacterId to get character info -or- Corporation info **of the corporation that your character is a member of**
3. This code is in C# and not VB.NET -but- just basically copy & paste and then correct any errors that might come up. Not entirely familiar with VB.NET as I haven't done it in about 8 years. This is fairly straightforward stuff. If you need additional help simply post it here.
To get Account information:
Quote:
EveApi api = new EveApi(UserId, APIKey); List<AccountEntry> charAE = api.GetAccountEntries();
foreach (AccountEntry AE in charAE) { AE.CharacterID //is the ID of each character in the account // put your code here }
Get Character data
Quote:
EveApi api = new EveApi(UserId, APIKey, CharacterId); CharacterSheet charSH = api.GetCharacterSheet(); CorporationId = charSH.CorporationID; CorporationName = charSH.CorporationName; WalletBalance = charSH.Balance; TotalSkillPoints = charSH.SkillpointTotal; Name = charSH.Name;
List<CharacterSheet.LearnedSkill> tSkill = charSH.Skills; foreach (CharacterSheet.LearnedSkill iSkill in tSkill) { if (iSkill.Skill.Name == "Trade") { // put your code here } // put your code here }
Character Assets
Quote:
EveApi api = new EveApi(UserId, APIKey, CharacterId); List<Asset> charAS = api.GetCharacterAssets();
foreach (Asset AS in charAS) { // put your code here }
Corporation Assets
Quote:
EveApi api = new EveApi(UserId, APIKey, CharacterId); List<Asset> corpAS = api.GetCorporationAssets();
foreach (Asset AS in corpAS) { // put your code here }
Corporation Members
Quote:
EveApi api = new EveApi(UserId, APIKey, CharacterId); List<MemberTrackingEntry> corpAS = api.GetCorporationMemberTracking(); foreach (MemberTrackingEntry MTE in corpAS) { MTE.BaseName; MTE.CharacterID; MTE.JoinDate; MTE.LocationName; MTE.LogonDate; MTE.LogoffDate ; MTE.LogoffDateLocalTime; MTE.ShipType; MTE.Title; MTE.Name; MTE.ShipTypeName; }
|
Zeta Zhul
Caldari Preemptive Paranoia
|
Posted - 2011.06.11 23:30:00 -
[8]
So how did it work out? Work for you?
|
epsilonion
|
Posted - 2011.06.12 00:01:00 -
[9]
Yay getting there.. :D ty for your help... :D I got the api back, and I am going add it streight to a database... :D pulling all the corp members into it.. :D
from there I intend to get new corp applicants to enter a application to the corp streight to the database... call the api once a day and that will keep the member list uptadate... also having there full api key in the database means i can see there char sheets without loading other programs... or even set it up soo if they hit the min skills to give a green light.
then call kills and set a monthly kill minimum if people dont hit that then a flag will be raised... and Hr can deal with them.
isk per member per month to see whothe care bears are whos not attending CTA's...
ship rembursement to go in a database keeps things running tight and a papertrail i have messy forums...
from there I will hit up the industrial side with a mining buddy like program API secure of course.. :D auto price (jita) updating once a week.. :D
and maybe a pos tracker... soo yeah my goal in the end will be to have a fully functional corp management program.. :D
Imports EveAI.Live Imports EveAI
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Declaire strStuff as object and other veriables Dim strStuff As Object Dim MyApi As New EveApi ' declaire stuff as string as the value we are pulling from the object it a string value. Dim stuff As String
'Enter authentication info into MyApi MyApi = New EveApi(xxxxx, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxxx)
'Get the return of the call from teh website api and put into strStuff strStuff = MyApi.GetCorporationMemberTracking
'declair i as a integer for the count of the object Dim i As Integer
' Now the information from the object is put into the database. For i = 0 To strStuff.Count - 1 'each time the loop loops it should put the new value into the stuff veriable stuff = strStuff.Item(i).Name
Next i
End Sub End Class |
Zeta Zhul
Caldari Preemptive Paranoia
|
Posted - 2011.06.12 01:25:00 -
[10]
Glad that worked out for you. EveAI is a little light on the documentation and you do have to do a lot of searching to get the basic stuff. But hopefully now it is on the forum it will be easier to find for anybody who needs a starting point.
BTW if you're getting full api keys from your corp members you can also consider setting up an 'asset value' system. This would be where you go through each characters assets and then reference prices gained from eve-marketdata.com or eve-central.com. Essentially the corp members sell their unwanted loot to the corp @ jita4-4 buy price and then the corp can either transport the accumulated loot or use a courier contract and then put it up for sale in Jita or some other hub. This makes life a lot simpler for low-sec/null-sec corp members and it gives a reasonably decent profit margin to the corp on sales. Or you can simply take the whole load and contract it to a trader. You make a lower percentage but still a good profit margin that can help pay for ships.
|
|
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |