TreeNode.cs :  » Business-Application » IsoCreator » BER » CDCat » Export » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Business Application » IsoCreator 
IsoCreator » BER » CDCat » Export » TreeNode.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace BER.CDCat.Export{
  public class TreeNode {
    #region Fields

    private TreeNodeCollection m_dirCol = new TreeNodeCollection();
    private TreeNodeCollection m_fileCol = new TreeNodeCollection();

    private string m_name = "";
    private string m_shortName = "";
    private UInt32 m_length;
    private DateTime m_creationTime;
    private bool m_isDirectory;
    private string m_fullName = "";

    #endregion

    #region Constructors

    #endregion

    #region Properties

    public TreeNodeCollection Files {
      get {
        return m_fileCol;
      }
    }

    public TreeNodeCollection Directories {
      get {
        return m_dirCol;
      }
    }

    public string Name {
      get {
        return m_name;
      }
      set {
        m_name = value;
      }
    }

    public string ShortName {
      get {
        return m_shortName;
      }
      set {
        m_shortName = value;
      }
    }

    public UInt32 Length {
      get {
        return m_length;
      }
      set {
        m_length = value;
      }
    }

    public DateTime CreationTime {
      get {
        return m_creationTime;
      }
      set {
        m_creationTime = value;
      }
    }

    public bool IsDirectory {
      get {
        return m_isDirectory;
      }
      set {
        m_isDirectory = value;
      }
    }

    public string FullName {
      get {
        return m_fullName;
      }
      set {
        m_fullName = value;
      }
    }

    #endregion

    #region Useful Methods

    public TreeNode[] GetFiles() {
      return m_fileCol.ToArray();
    }

    public TreeNode[] GetDirectories() {
      return m_dirCol.ToArray();
    }

    public TreeNode[] GetAllChildren() {
      TreeNodeCollection result = new TreeNodeCollection();
      result.AddRange( m_dirCol );
      result.AddRange( m_fileCol );
      return result.ToArray();
    }

    /// <summary>
    /// Debug purposes: generates a rudimentary xml.
    /// </summary>
    /// <returns></returns>
    public override string ToString() {
      string result = "<node name=\"" + this.Name + "\" dir=\"true\">";
      TreeNode[] dirs = this.GetDirectories();
      for ( int i=0; i<dirs.Length; i++ ) {
        result += dirs[i].ToString();
      }
      TreeNode[] files = this.GetFiles();
      for ( int i=0; i<files.Length; i++ ) {
        result += "<node name=\"" + files[i].Name + "\" dir=\"false\"/>";
      }
      result += "</node>";
      return result;
    }

    #endregion
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.