/// <summary>
 /// Adds a child FSO to this node
 /// </summary>
 public RAFInMemoryFileSystemObject AddChildFSO(RAFFSOType type, string name)
 {
     RAFInMemoryFileSystemObject result = null;
     this.Nodes.Add(
         result = new RAFInMemoryFileSystemObject(
             this, type, name
         )
     );
     return result;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a child FSO to this node
        /// </summary>
        public RAFInMemoryFileSystemObject AddChildFSO(RAFFSOType type, string name)
        {
            RAFInMemoryFileSystemObject result = null;

            this.Nodes.Add(
                result = new RAFInMemoryFileSystemObject(
                    this, type, name
                    )
                );
            return(result);
        }
        /// <summary>
        /// TreeNode that can be displayed in a treeview.  Represents a RAF Internal File System Object.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="fsoType"></param>
        /// <param name="name"></param>
        public RAFInMemoryFileSystemObject(RAFInMemoryFileSystemObject parent, RAFFSOType fsoType, string name)
            :base( //lol.  Is this a sign that I haven't played with C# enough?
                /*(fsoType==RAFFSOType.DIRECTORY?
                    "[DIR] ":
                    (fsoType==RAFFSOType.ARCHIVE?
                        "[ARC] ":
                        "[FIL] "
                    )
                ) +  */name
            )
        {
            //if(this.parent != null)
            //    this.parent.Nodes.Add(this);

            this.fsoType = fsoType;
            this.Name = name;
            this.Text = name;
        }
Exemplo n.º 4
0
        /// <summary>
        /// TreeNode that can be displayed in a treeview.  Represents a RAF Internal File System Object.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="fsoType"></param>
        /// <param name="name"></param>
        public RAFInMemoryFileSystemObject(RAFInMemoryFileSystemObject parent, RAFFSOType fsoType, string name)
            : base( //lol.  Is this a sign that I haven't played with C# enough?

                /*(fsoType==RAFFSOType.DIRECTORY?
                 *  "[DIR] ":
                 *  (fsoType==RAFFSOType.ARCHIVE?
                 *      "[ARC] ":
                 *      "[FIL] "
                 *  )
                 * ) +  */name
                )
        {
            //if(this.parent != null)
            //    this.parent.Nodes.Add(this);

            this.fsoType = fsoType;
            this.Name    = name;
            this.Text    = name;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds a child FSO to this treenode.
        /// This function supports pathing, so you can add a file with directory names!
        ///
        /// Directories are created if not existing already
        ///
        /// Such as: root/subDir/SubSubDir/file.name
        /// </summary>
        public RAFInMemoryFileSystemObject AddToTree(RAFFSOType type, string name)
        {
            string[] dirNames = name.Replace("\\", "/").Split("/");

            RAFInMemoryFileSystemObject currentNode = this;

            //Traverse FS Tree to the directory containing our file
            for (int i = 0; i < dirNames.Length - 1; i++)
            {
                RAFInMemoryFileSystemObject childNode = currentNode.GetChildFSO(dirNames[i]);

                if (childNode == null)
                {
                    childNode = currentNode.AddChildFSO(RAFFSOType.DIRECTORY, dirNames[i]);
                }

                currentNode = childNode;
            }

            //Add the childnode to our tree..
            return(currentNode.AddChildFSO(RAFFSOType.FILE, dirNames.Last()));
        }
        /// <summary>
        /// Adds a child FSO to this treenode.  
        /// This function supports pathing, so you can add a file with directory names!
        /// 
        /// Directories are created if not existing already
        /// 
        /// Such as: root/subDir/SubSubDir/file.name
        /// </summary>
        public RAFInMemoryFileSystemObject AddToTree(RAFFSOType type, string name)
        {
            string[] dirNames = name.Replace("\\", "/").Split("/");

            RAFInMemoryFileSystemObject currentNode = this;

            //Traverse FS Tree to the directory containing our file
            for(int i = 0; i < dirNames.Length-1; i++)
            {
                RAFInMemoryFileSystemObject childNode = currentNode.GetChildFSO(dirNames[i]);

                if (childNode == null)
                    childNode = currentNode.AddChildFSO(RAFFSOType.DIRECTORY, dirNames[i]);

                currentNode = childNode;
            }

            //Add the childnode to our tree..
            return currentNode.AddChildFSO(RAFFSOType.FILE, dirNames.Last());
        }