jeudi 29 octobre 2015

Methods to Save/Load Specific Elements of many Objects

I have a bunch of objects that contain specific variables I need to save and then later load.

The Objects all Contain Much more data then what is needed when they are loaded, but are used while program was running before (stuff that is needed over a few methods to setup all the initial data)

Here's an Example of what I am trying to save

Not valid code (Just representation of the Objects and Children of Objects)

List<string>
hashtable
    {
        eh_entry
        {
            string entry_status
            List<direct_file>
            details_pane
            {
                string rating
                string date
            }
        }
    }

` hashtable contains Many eh_entry (to make searching through them much faster)
details_pane is essentially just a tablelayoutpanel populated with label's. It uses custom get/set methods like the following

public string rating
{
    get { return rating_label.Text.Substring(8, rating_Label.Text.Length); }
    set { rating_label.Text = "Rating: " + value; }
}

If I should post the full classes of the custom objects I can, however They are very long and are probably not very easy to look at (I Only started up with C# about 2-3 months ago).

Essentially I need to create a file that contains parts of an object, and parts of its children objects.

PS:I need to be able to load the data back into an eh_entry and then place that eh_entry back inside a Hashtable.
Speed is a bit of an issue as well, mainly since there are so many eh_entry, the program creates about 20-25 per 1-3 seconds until it finishes scraping data, which is around 2.5million objects inside the Hashtable.

Should I create a separate class that contains Only the data I need to save, and then use it to save/load the data?

Also for something of this size, Should I be planning to use JSON, XML, binary or SQL?

Aucun commentaire:

Enregistrer un commentaire