4 Replies - 1626 Views - Last Post: 23 October 2008 - 05:55 AM Rate Topic: -----

#1 ragingben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 175
  • View blog
  • Posts: 641
  • Joined: 07-October 08

Extract a list of methods from a file?!

Post icon  Posted 21 October 2008 - 04:44 AM

Hi everyone, before we start I havn't included any code because I'm not really looking for code - I'm kinda looking for a pointer in the right direction.

My problem is this - I am creating a system that allows users to create a routine for a robot from a list of units that are built into the program. For example their routine might be "move arm" which would be made up of the units:

- "motors on"
- "move arm up 50 mm",
- "motor off"

(The robot doesn't have arms - thats just an example!)

So I have this list of units, can put them in a delegate, run and it is all fine. BUT... I want to be able to save these units to a file so that they can then use them again. I'm fine on basic file handling, but just not sure about the approach I should take!

Hope you can help :)

Is This A Good Question/Topic? 0
  • +

Replies To: Extract a list of methods from a file?!

#2 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: Extract a list of methods from a file?!

Posted 21 October 2008 - 06:15 PM

Try using the System.IO namespace.
*HINT* Stream, StringReader/Writer, BinaryReader/Writer, etc.

Hope this helps
Was This Post Helpful? 0
  • +
  • -

#3 ragingben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 175
  • View blog
  • Posts: 641
  • Joined: 07-October 08

Re: Extract a list of methods from a file?!

Posted 22 October 2008 - 01:21 AM

Thanks for the reply gbertoli3, maybe I didn't make the problem clear, I'm fine with file IO, but I'm just not sure how I would take a line of the file and then take the method form it... ah I may just have answered my own question...

would a good approach be something like:

#BOF
REP1TO1,2343 <-line in file
#EOF

then in load method or wherever a switch statement to select appropriate methods from each line of file?

thanks :)
Was This Post Helpful? 0
  • +
  • -

#4 zakary  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 427
  • Joined: 15-February 05

Re: Extract a list of methods from a file?!

Posted 22 October 2008 - 06:25 AM

ragingben what is it you are trying to do, are you just trying to read a .txt or .cs file as a string or are you trying to accesses a method from a different project or class. If you are just reading the class as text then IO will work fine. If you want to do something with that method you may want to look into Reflection and or .NET Remoting.
Was This Post Helpful? 0
  • +
  • -

#5 ragingben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 175
  • View blog
  • Posts: 641
  • Joined: 07-October 08

Re: Extract a list of methods from a file?!

Posted 23 October 2008 - 05:55 AM

Thanks for you contrubution zakary, too be honest I don't know why I asked the question! I think I became overwhelemd by the big picture, of which this is a small part! Thanks for you help people :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1