Beispiel #1
0
        /// <summary>
        /// Creates a project tree structure by combining all the files under a directory into a project
        /// </summary>
        public void createProjectTree()
        {
            for (int i = 0; i < files.Count; ++i)
            {
                bool   parentpresent   = false;
                string currentFilename = System.IO.Path.GetFileName(files[i]);
                string parentDirName   = System.IO.Path.GetDirectoryName(files[i]);
                string relativePath    = getRelativePath(files[i]);
                if (relativePath.Contains("\\"))
                {
                    int index = relativePath.LastIndexOf("\\");
                    relativePath = relativePath.Substring(0, index);
                }
                else
                {
                    relativePath = "Current Dir";
                }


                for (int j = 0; j < projectList.Count; j++)
                {
                    ProjectTree temp = projectList[j];
                    if (temp.parentAbsolutePath == parentDirName)
                    {
                        parentpresent = true;
                        temp.filesList.Add(currentFilename);
                    }
                }
                if (!parentpresent)
                {
                    ProjectTree currentTree = new ProjectTree();
                    currentTree.parentAbsolutePath = parentDirName;
                    currentTree.parentRelativePath = relativePath;
                    currentTree.filesList.Add(currentFilename);
                    projectList.Add(currentTree);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a project tree structure by combining all the files under a directory into a project
        /// </summary>
        public void createProjectTree()
        {
            for (int i = 0; i < files.Count; ++i)
            {
                bool parentpresent = false;
                string currentFilename = System.IO.Path.GetFileName(files[i]);
                string parentDirName = System.IO.Path.GetDirectoryName(files[i]);
                string relativePath = getRelativePath(files[i]);
                if (relativePath.Contains("\\"))
                {
                    int index = relativePath.LastIndexOf("\\");
                    relativePath = relativePath.Substring(0, index);
                }
                else
                    relativePath = "Current Dir";


                for (int j = 0; j < projectList.Count; j++)
                {
                    ProjectTree temp = projectList[j];
                    if (temp.parentAbsolutePath == parentDirName)
                    {
                        parentpresent = true;
                        temp.filesList.Add(currentFilename);
                    }
                }
                if (!parentpresent)
                {
                    ProjectTree currentTree = new ProjectTree();
                    currentTree.parentAbsolutePath = parentDirName;
                    currentTree.parentRelativePath = relativePath;
                    currentTree.filesList.Add(currentFilename);
                    projectList.Add(currentTree);
                }
            }
        }