dcsimg
Results 1 to 2 of 2

Thread: Best way to save class properties to human readable text file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2004
    Location
    Kansas, USA
    Posts
    324

    Best way to save class properties to human readable text file

    I want to set up a class to be used to describe three robots in the shop. I need to set up data about the robots like work envelope, acceleration times, speeds, etc. All the properties will be numbers or strings. Because there are three robots we don't really need a custom form to set up and load settings. In the beginning there will be a set up period where we will be tweaking robot settings.

    I am thinking a text, human readable file where the settings could be tweaked on the target machine. Something like an XML file. In some cases one robot may not have all the settings that the other robot has so the text file and method for reading/writing text file would need to be flexible in regard to missing values. If the value is there read it and initialize the class, if not then don't blow up.

    Do you all have some pointers on how to accomplish this simply and quickly? XML? Something else?
    Thanks,
    Eric
    --------------------------------------------------------------------------------------------------------------------
    VB.net ... Visual Studio 2012

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,244

    Re: Best way to save class properties to human readable text file

    XML serialization will be the easiest. It may or may not be the most readable. MS Office products generally work really well with XML, so you may be able to directly read them without the tags in things like Excel or Word....though maybe not, depending on the complexity. Even without that, you can always read XML as a text file, and even manipulate it. If you start manipulating tags, you have a fine chance to mess up the file, but otherwise you would likely be fine.

    The other option that would make it even more readable would be to come up with some custom layout. Perhaps a CSV file, or something more like JSON written to a file. Those won't be as easy to work with, because you'll be writing more code to read and write them, but they could end up more human readable than XML with all its tags.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width