5 Replies - 815 Views - Last Post: 10 February 2012 - 07:10 AM Rate Topic: -----

#1 Codey09  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 210
  • Joined: 20-August 09

Storing the file-system hierarchy in an XML file

Posted 09 February 2012 - 04:23 PM

I'm working on a file management program in 3D, and I'm trying to work out the best way to store the file-system hierarchy for use in the app.

I had thought about using arrays/lists to store the data returned from the Directory.GetFiles() method and wasn't sure if that was going to be too memory hungry if the folder I'm looking at holds a lot files.

So I have been thinking is it possible to copy the file system hierarchy into an XML file?

If so can you point me in the right direction for tutorials as I have no experience with using XML at present but get the basic idea of it.

Is This A Good Question/Topic? 0
  • +

Replies To: Storing the file-system hierarchy in an XML file

#2 negligible  Icon User is offline

  • D.I.C Regular

Reputation: 62
  • View blog
  • Posts: 302
  • Joined: 02-December 10

Re: Storing the file-system hierarchy in an XML file

Posted 09 February 2012 - 04:55 PM

This was posted in the thread beneath this one... I found it's explained pretty well.

http://www.dreaminco...izing-the-data/

This post has been edited by negligible: 09 February 2012 - 04:56 PM

Was This Post Helpful? 0
  • +
  • -

#3 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

Re: Storing the file-system hierarchy in an XML file

Posted 09 February 2012 - 07:03 PM

One way or another, when you use that data, it's going into memory. Adding a step that writes it to disk, or even just creates the XML in memory is nothing but a slowdown. You have gigs of memory, just how many files are we talking about?

One major lesson to learn is to not try to prematurely optimize your programs. Try it the simple way first, then work on optimization if necessary.
Was This Post Helpful? 0
  • +
  • -

#4 Codey09  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 210
  • Joined: 20-August 09

Re: Storing the file-system hierarchy in an XML file

Posted 10 February 2012 - 02:13 AM

View PostCurtis Rutland, on 10 February 2012 - 02:03 AM, said:

One way or another, when you use that data, it's going into memory. Adding a step that writes it to disk, or even just creates the XML in memory is nothing but a slowdown. You have gigs of memory, just how many files are we talking about?

One major lesson to learn is to not try to prematurely optimize your programs. Try it the simple way first, then work on optimization if necessary.

Thanks for the advice I will try it with using arrays/lists first.
The amount of files in will vary depending on the users computer, but for example my daughter has 7000 music files, and I was concerned that would take up a lot of memory by instantiating 7000 objects.

But as you say most computers now have lots of memory.
Was This Post Helpful? 0
  • +
  • -

#5 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

Re: Storing the file-system hierarchy in an XML file

Posted 10 February 2012 - 06:53 AM

7k strings is nothing. I've loaded hundreds of thousands of database rows in C# before. Just as long as you're not trying to preload the entire disk, you should be fine.
Was This Post Helpful? 0
  • +
  • -

#6 Codey09  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 210
  • Joined: 20-August 09

Re: Storing the file-system hierarchy in an XML file

Posted 10 February 2012 - 07:10 AM

No just the My Documents, My Music, My Pictures and My Videos.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1