Click here to Skip to main content
15,887,849 members
Home / Discussions / C#
   

C#

 
GeneralRe: Simple Windows App. HELP A GUY OUT! Pin
Amber Star16-Feb-03 7:46
Amber Star16-Feb-03 7:46 
GeneralRe: Simple Windows App. HELP A GUY OUT! Pin
Nick Parker17-Feb-03 1:43
protectorNick Parker17-Feb-03 1:43 
Questionwhy is the OleDbCommand busy? Pin
mkomasi15-Feb-03 0:18
mkomasi15-Feb-03 0:18 
GeneralDisabling a Forms movement and mouse responce Pin
jtmtv1814-Feb-03 22:59
jtmtv1814-Feb-03 22:59 
GeneralRe: Disabling a Forms movement and mouse responce Pin
Stephane Rodriguez.14-Feb-03 23:17
Stephane Rodriguez.14-Feb-03 23:17 
GeneralPlease Help me about PropertyGrid Control Pin
TonyZWH14-Feb-03 15:41
TonyZWH14-Feb-03 15:41 
GeneralRe: Please Help me about PropertyGrid Control Pin
TonyZWH14-Feb-03 23:38
TonyZWH14-Feb-03 23:38 
GeneralI need your suggestion about data storage Pin
lnong14-Feb-03 14:47
lnong14-Feb-03 14:47 
This may be a bit long, but I will try to explain it clearly, so please read on.

I'm writing a web-based file management application (in ASP.NET/C#) that requires keeping track of a hierarchy of the names of folders and their files and subfolders (which may include their own files and subfolders). I need to store this whole organizational structure in memory at all times for quick access and modification. This structure will frequently need to be saved to a single file in some format (text, binary or xml) for storage after the application ends.

At first, I thought of using ArrayLists (one for folders and one for files). Each would be written as a single object into a binary file for storage. But I realize that it would be rather hard to manage nested folders using an ArrayList.

My next attempt is to keep track of the folders using a tree stucture. For instance, the 1st level child nodes will be the 1st level folders, and their children nodes can represent their subfolders, and so on. I need to be using a general tree, not a binary tree because a folder cna have more than 2 subfolders. However, I cannot find a Tree class in .NET anywhere. (There's not even a BinaryTree class).

But I did notice that an XML document resembles a general tree structure, which is what I need. My question is that is it possible and efficient for me to store a whole folder hierarchy in XML format?

I've never worked with XML documents before, but basically, I want to know if it possible for me to keep track of nested folders like this: (my syntax may be far from correct)

<folder name="Main Folder" folderCount="2" fileCount="1">
<folder name="Subfolder 1" folderCount="1" fileCount="0">
<folder name="Subfolder 1a" folderCount="0" fileCount="0">
</folder>
</folder>
<folder name="Subfolder 2" folderCount="0" fileCount="0">
</folder>
<file name="File 1">
</file>
</folder>

And remember, I need to be able to keep on adding as many levels of nested folders as I want. Am I able to do this with an XML structure? Also, can I dynamically add, remove or modify any folder?

MSDN says that ".NET XMLDocument class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document and enables the navigation and editing of this document"

If I understand this correctly, it means that this "XML Document" is still an object stored in memory which will allow quick access. I can then write this object to an XML or binary file at any time.

.NET also has an easy way to load the data from the XMLDocument object into a DataSet. This can be very convenient for me because I can map this DataSet to a DataView and then display it on the screen using a DataGrid or DataList. That would be perfect.

OK. So would you suggest the XML method? Or should I just stop dreaming and find a way to manage nested folder using ArrayLists and DataTables? Please let me know. Thanks.
GeneralRe: I need your suggestion about data storage Pin
Rocky Moore14-Feb-03 19:41
Rocky Moore14-Feb-03 19:41 
QuestionIs there a Tree class in .NET? Pin
lnong14-Feb-03 13:05
lnong14-Feb-03 13:05 
AnswerRe: Is there a Tree class in .NET? Pin
Furty14-Feb-03 19:08
Furty14-Feb-03 19:08 
GeneralForms/Listbox Display Pin
Sovman14-Feb-03 11:17
Sovman14-Feb-03 11:17 
GeneralRe: Forms/Listbox Display Pin
Ray Cassick14-Feb-03 11:23
Ray Cassick14-Feb-03 11:23 
GeneralIrDAClient Pin
Daniel Strigl14-Feb-03 10:35
Daniel Strigl14-Feb-03 10:35 
GeneralConverting a Graphics Object Back to a Bitmap Pin
draco_iii14-Feb-03 8:21
draco_iii14-Feb-03 8:21 
GeneralRe: Converting a Graphics Object Back to a Bitmap Pin
draco_iii14-Feb-03 8:34
draco_iii14-Feb-03 8:34 
GeneralRe: Converting a Graphics Object Back to a Bitmap Pin
Furty14-Feb-03 8:58
Furty14-Feb-03 8:58 
GeneralRe: Converting a Graphics Object Back to a Bitmap Pin
clarkwuzhe14-Feb-03 10:29
clarkwuzhe14-Feb-03 10:29 
GeneralRe: Converting a Graphics Object Back to a Bitmap Pin
Furty14-Feb-03 11:11
Furty14-Feb-03 11:11 
GeneralRuntime Error in Treeview Imagelist Pin
vlusardi14-Feb-03 7:52
vlusardi14-Feb-03 7:52 
GeneralRe: Runtime Error in Treeview Imagelist Pin
John Mautari14-Feb-03 8:29
John Mautari14-Feb-03 8:29 
GeneralRe: Runtime Error in Treeview Imagelist Pin
vlusardi14-Feb-03 8:45
vlusardi14-Feb-03 8:45 
GeneralRe: Runtime Error in Treeview Imagelist Pin
Furty14-Feb-03 9:02
Furty14-Feb-03 9:02 
GeneralRe: Runtime Error in Treeview Imagelist Pin
vlusardi14-Feb-03 9:19
vlusardi14-Feb-03 9:19 
GeneralRe: Runtime Error in Treeview Imagelist Pin
dazinith16-May-03 4:46
dazinith16-May-03 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.