How to approach a problem..

Discussion in 'ASP .Net' started by SimonH, Feb 25, 2005.

  1. SimonH

    SimonH Guest

    Hi all,

    I'm making a diskspace analyser such that after you select the directory
    that you want analysed and hit go, it iterates through all the directories
    and files and gather information on them. I'd like to be able to offer lots
    of different types of information to the user, including comparitive sizes
    of different file types, file type counts, top ten largest directories, empty
    files and much more besides.

    I'm wondering if anyone could suggest a solution to two different aspects
    of this

    1. What data structure should I use. This doesnt have to be restricted to
    those that come with the .net framework, but whatever is used needs to be
    efficient and fast at accessing the information gathered on the different
    directories

    2. What should I use to gather the statistics that I'll need to be able to
    analyse the directories and files. I'm basically thinking that I will need
    to make a custom object but I'm worried that this could get really complicated.
    Perhaps I would make a directory info object that would contain information
    on itself and the directories contained underneath it?

    I'm pretty confused about how to gather these statistics and how to analyse
    them efficiently

    Any advice or design approaches would be very greatfully received

    Thank all

    Simon
    SimonH, Feb 25, 2005
    #1
    1. Advertising

  2. Hi,

    I'd build custom objects representing a directory, a file, a file collection
    and a directory collection.
    The file and the directory objects would be able to gather and provide
    information about themselves given the physical path.
    The collections would be used to store child files and directories.

    In the end, there would be an object graph rooted at the directory specified
    for analysis and representing the structure beneath this directory (and the
    respective information).
    I'd also make report classes responsible to generate file type/file size
    breakdown reports and other reports you will need. These would use directory
    objects as data sources.

    --
    Sincerely,
    Dmitriy Lapshin [C# / .NET MVP]
    Bring the power of unit testing to the VS .NET IDE today!
    http://www.x-unity.net/teststudio.aspx

    "SimonH" <> wrote in message
    news:...
    > Hi all,
    >
    > I'm making a diskspace analyser such that after you select the directory
    > that you want analysed and hit go, it iterates through all the directories
    > and files and gather information on them. I'd like to be able to offer
    > lots of different types of information to the user, including comparitive
    > sizes of different file types, file type counts, top ten largest
    > directories, empty files and much more besides.
    >
    > I'm wondering if anyone could suggest a solution to two different aspects
    > of this
    >
    > 1. What data structure should I use. This doesnt have to be restricted to
    > those that come with the .net framework, but whatever is used needs to be
    > efficient and fast at accessing the information gathered on the different
    > directories
    >
    > 2. What should I use to gather the statistics that I'll need to be able to
    > analyse the directories and files. I'm basically thinking that I will need
    > to make a custom object but I'm worried that this could get really
    > complicated. Perhaps I would make a directory info object that would
    > contain information on itself and the directories contained underneath it?
    >
    > I'm pretty confused about how to gather these statistics and how to
    > analyse them efficiently
    > Any advice or design approaches would be very greatfully received
    >
    > Thank all
    >
    > Simon
    >
    Dmitriy Lapshin [C# / .NET MVP], Feb 25, 2005
    #2
    1. Advertising

  3. SimonH

    IPGrunt Guest

    On 25 Feb 2005, SimonH <> postulated in
    news::

    > Hi all,
    >
    > I'm making a diskspace analyser such that after you select the

    directory
    > that you want analysed and hit go, it iterates through all the

    directories
    > and files and gather information on them. I'd like to be able to

    offer lots
    > of different types of information to the user, including

    comparitive sizes
    > of different file types, file type counts, top ten largest

    directories, empty
    > files and much more besides.
    >
    > I'm wondering if anyone could suggest a solution to two different

    aspects
    > of this
    >
    > 1. What data structure should I use. This doesnt have to be

    restricted to
    > those that come with the .net framework, but whatever is used needs

    to be
    > efficient and fast at accessing the information gathered on the

    different
    > directories
    >
    > 2. What should I use to gather the statistics that I'll need to be

    able to
    > analyse the directories and files. I'm basically thinking that I

    will need
    > to make a custom object but I'm worried that this could get really

    complicated.
    > Perhaps I would make a directory info object that would contain

    information
    > on itself and the directories contained underneath it?
    >
    > I'm pretty confused about how to gather these statistics and how to

    analyse
    > them efficiently
    >
    > Any advice or design approaches would be very greatfully received
    >
    > Thank all
    >
    > Simon
    >
    >


    Simon,

    IIWY, I'd start at the bottom with the windows file system. You've
    got to learn to Interop and call the Windows API--then you don't need
    to worry about what the .net interfaces.

    There's a new file system coming out with future systems. I'd learn
    as much about that as possible and support it. One trick to getting a
    new utility app off the mark is to support an emerging technology.

    I'm not sure what statistics you're getting at.

    -- ipgrunt
    IPGrunt, Feb 25, 2005
    #3
  4. Hi Simon,

    >
    > I'm making a diskspace analyser such that after you select the directory
    > that you want analysed and hit go, it iterates through all the directories
    > and files and gather information on them. I'd like to be able to offer
    > lots of different types of information to the user, including comparitive
    > sizes of different file types, file type counts, top ten largest
    > directories, empty files and much more besides.
    >
    > I'm wondering if anyone could suggest a solution to two different aspects
    > of this
    >
    > 1. What data structure should I use. This doesnt have to be restricted to
    > those that come with the .net framework, but whatever is used needs to be
    > efficient and fast at accessing the information gathered on the different
    > directories


    Personally, I wonder how you are going to collect information on a
    heirarchical system with keeping track of the heirarchy itself. Two methods
    come to mind: (1) a simple list where each item has associated size, type,
    and path information, and where directories contain summary information, and
    (2) a tree structure where a directory contains two lists: a list of files
    and a list of directories. Files in this structure are different than
    directories in that they do not contain files, but may have a type and size,
    while directories can only have a size. Both can have security attributes.

    To decide which mechanism to offer, it helps to perform a
    Commonality-Variability Analysis. This simple analysis technique helps you
    to decide what capabilities of your objects to place in different places in
    your heirarchy.

    My gut tells me that the tree-structure is more likely to produce the
    results you need.

    >
    > 2. What should I use to gather the statistics that I'll need to be able to
    > analyse the directories and files. I'm basically thinking that I will need
    > to make a custom object but I'm worried that this could get really
    > complicated. Perhaps I would make a directory info object that would
    > contain information on itself and the directories contained underneath it?
    >


    You are unlikely to get the data collection methods you'd want out of the
    basic file and directory objects in .net. I would suggest that you would
    want to encapsulate these objects within a wrapper of your own that provides
    the statistical methods you desire and which contain the tree members that
    you need.


    --
    --- Nick Malik [Microsoft]
    MCSD, CFPS, Certified Scrummaster
    http://blogs.msdn.com/nickmalik

    Disclaimer: Opinions expressed in this forum are my own, and not
    representative of my employer.
    I do not answer questions on behalf of my employer. I'm just a
    programmer helping programmers.
    --
    Nick Malik [Microsoft], Feb 25, 2005
    #4
  5. Sincerest thanks for your comments all

    Simo
    thechaosengine, Feb 26, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S.M. Altaf [MVP]

    Re: best way to approach this problem

    S.M. Altaf [MVP], Nov 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    481
    Stimp
    Nov 11, 2005
  2. Stimp
    Replies:
    0
    Views:
    367
    Stimp
    Dec 28, 2005
  3. Hitesh Joshi
    Replies:
    1
    Views:
    253
    Sybren Stuvel
    Jul 19, 2006
  4. John Salerno
    Replies:
    13
    Views:
    451
    John Salerno
    May 10, 2007
  5. Tony
    Replies:
    2
    Views:
    323
    Naresh Rautela
    Jun 4, 2007
Loading...

Share This Page