Example #1
0
        private void InitChild()
        {
            try
            {
                //get sub-folders for this folder
                Array subFolders = System.IO.Directory.GetDirectories(fullPath);

                //create space for the children
                children = new ShengFileSystemNode[subFolders.Length];

                for (int i = 0; i < subFolders.Length; i++)
                {
                    //create the child value
                    children[i] = new ShengFileSystemNode(subFolders.GetValue(i).ToString(), this);
                }
            }

            /**
             * This is just a sample, so has bad error handling ;)
             *
             **/
            catch (System.Exception ioex)
            {
                //write a message to stderr
                System.Console.Error.WriteLine(ioex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Populates this node as a root node representing "My Computer"
        /// </summary>
        private void GenerateRootNode()
        {
            // if we have data, we can't become a root node.
            if (children != null)
            {
                return;
            }

            //get the display name of the first logical drive
            fullPath    = "";
            this.parent = null;

            //get our drives
            string[] drives = Environment.GetLogicalDrives();

            //create space for the children
            children = new ShengFileSystemNode[drives.Length];

            for (int i = 0; i < drives.Length; i++)
            {
                //create the child value
                children[i] = new ShengFileSystemNode(drives[i], this);
            }

            //get the icon
            GenerateNodeDisplayDetails();
        }
Example #3
0
        /// <summary>
        /// Creates a File System node with a given path
        /// </summary>
        /// <param name="path">Path that this node represents</param>
        /// <param name="depth">Integer represnting how deep in the hierarchy this node is</param>
        public ShengFileSystemNode(string path, ShengFileSystemNode parent)
        {
            //fill in the relevant details
            fullPath    = path;
            this.parent = parent;

            //get the icon
            GenerateNodeDisplayDetails();
        }