Example #1
0
        public void FromNameList(List <string> pNameList)
        {
            Root = null;
            if ((pNameList == null) || (pNameList.Count == 0))
            {
                return;
            }

            Root = new FileHierNode("\\", "\\");
            foreach (string item in pNameList)
            {
                ExtractNodes(item);
            }
        }
Example #2
0
        private void ExtractNodes(string pFileName)
        {
            pFileName = pFileName?.Trim();
            if (string.IsNullOrEmpty(pFileName))
            {
                return;
            }

            FileHierNode currentNode = Root;

            string[] components = pFileName.Split("\\".ToCharArray());

            for (int index = 0; index < components.Length; ++index)
            {
                string component = components[index];

                currentNode.AddChild(component, pFileName);
                currentNode = currentNode.GetChildByName(component);
            }
        }