Quantcast

Jump to content


Photo

C# - Parsing pet names

AutoTrainer

  • Please log in to reply
4 replies to this topic

#1 Adam

Adam
  • Coffee God


  • 4771 posts


Users Awards

Posted 15 May 2012 - 04:25 PM

I've never been able to fully grasp how to parse [GET] pet names or codestones from the neopets website and have it [POST] to my auto trainer. I need to post the pet name to a text box. I've never been able to finish my projects that have to do with parsing. This is what my Auto Trainer looks like so far, mind you I've only started working on it about an hour ago. I have the login working..lol

[attachment=10235:halp.png]


If someone such as Waser wants my project, I'd be happy to send it to ya.



Here is the wrapper I'm using.
Spoiler

Edited by Adam, 15 May 2012 - 04:27 PM.


#2 Waser Lave

Waser Lave

  • 25516 posts


Users Awards

Posted 15 May 2012 - 04:27 PM

You can either use something like regular expressions to parse the data using patterns or you can use basic string manipulation like String.SubString().

#3 artificial

artificial
  • 186 posts


Users Awards

Posted 15 May 2012 - 04:28 PM

Basically the idea is you use GET to request the source code of that page, you use various string parsing techniques to retrieve the pet name(s) within that page source, and use that information when you POST to whatever page you want.

You may want to look in to some regex tutorials for .NET (the good thing about regex is syntax wise the patterns are almost universal across all languages, but implementation can change language to language). Here's a brief tutorial I found on Google that may help you: http://www.codeproje...-Regex-Tutorial

#4 Adam

Adam
  • Coffee God


  • 4771 posts


Users Awards

Posted 15 May 2012 - 08:43 PM

Okay I think I've gotten it..but I've ran into a small problem...
I changed the layout of my program to something very different, but when I compile it the GUI goes back to how I originally had it. Anyone care to explain why?

Oh also:

var strHTML = myWrapper.Request("GET", "http://www.neopets.com/island/process_training.phtml?type=pay&pet_name=MYPETNAME"
+ itemList.Items[i].ToString() + "http://www.neopets.com/island/process_training.phtml?type=start&course_type=COURSE", "http://www.neopets.com/island/training.phtml?type=courses");
				// Pause(1);
				courseText = GrabAll(strHTML, "option value='S", " H");
courseText = GrabAll(strHTML, "option value='S", " H"); is supposed to grab the course value and translate it to be Strength...not sure if it's right.

Edited by Adam, 15 May 2012 - 08:50 PM.


#5 data

data
  • 63 posts

Posted 30 May 2012 - 07:19 AM

Okay I think I've gotten it..but I've ran into a small problem...
I changed the layout of my program to something very different, but when I compile it the GUI goes back to how I originally had it. Anyone care to explain why?

Oh also:


var strHTML = myWrapper.Request("GET", "http://www.neopets.com/island/process_training.phtml?type=pay&pet_name=MYPETNAME"
+ itemList.Items[i].ToString() + "http://www.neopets.com/island/process_training.phtml?type=start&course_type=COURSE", "http://www.neopets.com/island/training.phtml?type=courses");
				// Pause(1);
				courseText = GrabAll(strHTML, "option value='S", " H");
courseText = GrabAll(strHTML, "option value='S", " H"); is supposed to grab the course value and translate it to be Strength...not sure if it's right.


Post your 'GrabAll' function. What do you mean the GUI resets? Do all the buttons get removed and does it return to a blank moveable form?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users