class Node
{
FooType Data; // I can save Data to file with extension .foo
void Save()
{
// save Data to .foo file
}
}
Now ,
class Graph
{
List<Node> Nodes;
void Save()
{
foreach(Node node in Nodes)
{
node.Save();
}
}
}
Now when I invoke someGraph.Save(); then it creates Nodes.Count number of files.
I would like to appear those files as one file with extension somename.graph and be able to read it again as Nodes.
How can I do this? Is there a way to bundle files into a single different file?
Use an archive format like zip.
Without external library support, you could just use .Net’s serialisation mechanism to store a
Dictionary<string, byte[]>(filename and data for each file) in a single file. Start here.