예제 #1
0
        private void AddFolder(string folderName, ProjectFolder parentFolder)
        {
            ProjectFolder folder = new ProjectFolder(parentFolder, folderName);

            parentFolder.AddFolder(folder);
            _model.OnNodesChanged(parentFolder);
        }
예제 #2
0
        public ProjectFolder AddFolder(string folderName, ProjectFolder parentDir)
        {
            ProjectFolder folder = new ProjectFolder(parentDir, folderName);

            parentDir.AddFolder(folder);
            if (ProjectFolderAdded != null)
            {
                ProjectFolderAdded(this, EventArgs.Empty);
            }

            return(folder);
        }
예제 #3
0
        public void FindFolderTest()
        {
            string   projectFile = @"C:\Users\Test\file.wcodeproj";
            string   projectName = "Project";
            IProject project     = new Project(projectFile, projectName);

            string         folderName  = "Folder";
            string         folderName2 = "Folder 2";
            ProjectFolder  target      = new ProjectFolder(project, folderName);
            IProjectFolder expected    = new ProjectFolder(project, folderName2);          // TODO: Initialize to an appropriate value
            IProjectFolder actual;

            target.AddFolder(expected);
            actual = target.FindFolder(folderName2);
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void RemoveTest()
        {
            string   projectFile = @"C:\Users\Test\file.wcodeproj";
            string   projectName = "Project";
            IProject project     = new Project(projectFile, projectName);

            string        folderName   = "Folder";
            string        parentName   = "Parent Folder";
            ProjectFolder target       = new ProjectFolder(project, folderName);
            ProjectFolder parentFolder = new ProjectFolder(project, parentName);

            parentFolder.AddFolder(target);
            target.Remove();

            Assert.AreEqual(parentFolder.Folders.Count, 0);
            Assert.AreEqual(true, project.NeedsSave);
        }
예제 #5
0
        public void AddFolderTest()
        {
            string   projectFile = @"C:\Users\Test\file.wcodeproj";
            string   projectName = "Project";
            IProject project     = new Project(projectFile, projectName);

            string         folderName  = "Folder";
            string         folderName2 = "Folder 2";
            ProjectFolder  target      = new ProjectFolder(project, folderName);
            IProjectFolder subFolder   = new ProjectFolder(project, folderName2);

            target.AddFolder(subFolder);

            Assert.AreEqual(target.Folders.Count, 1);
            Assert.IsTrue(project.NeedsSave);
            Assert.AreEqual(subFolder.Name, target.Folders[0].Name);
            Assert.AreEqual(subFolder.ParentFolder.Name, target.Name);
        }
예제 #6
0
        private void projViewer_DragDrop(object sender, DragEventArgs e)
        {
            projViewer.BeginUpdate();

            var           nodes      = (TreeNodeAdv[])e.Data.GetData(typeof(TreeNodeAdv[]));
            var           dropNode   = projViewer.DropPosition.Node;
            ProjectFolder nodeFolder = dropNode.Tag as ProjectFolder ?? dropNode.Parent.Tag as ProjectFolder;

            if (nodeFolder == null)
            {
                return;
            }

            foreach (TreeNodeAdv n in nodes)
            {
                ProjectFolder folder = n.Tag as ProjectFolder;
                if (folder == _projectService.Project.MainFolder)
                {
                    continue;
                }

                if (folder != null)
                {
                    folder.Parent.DeleteFolder(folder);
                    nodeFolder.AddFolder(folder);
                }
                else
                {
                    ProjectFile file = n.Tag as ProjectFile;
                    if (file == null)
                    {
                        continue;
                    }

                    file.Remove();
                    nodeFolder.AddFile(file);
                }
            }

            dropNode.Expand();

            BuildProjTree();
            projViewer.EndUpdate();
        }
예제 #7
0
        private void BrowserFolder(ProjectFolder projectFolder)
        {
            ProjectFolder subFolder;
            ProjectFile projectFile;
            DirectoryInfo dir = new DirectoryInfo(projectFolder.Path);

            /// Add all files to curent folder
            foreach (FileInfo fileInfo in dir.GetFiles())
            {
                projectFile = new ProjectFile(fileInfo.Name,fileInfo.FullName);
                projectFolder.AddFile(projectFile);
                //Log.Write(fileInfo.FullName, this, "BrowserFolder", Log.LogType.DEBUG);
            }

            /// Add all subfolders to curent folder and ...
            foreach (DirectoryInfo di in dir.GetDirectories())
            {
                subFolder = new ProjectFolder(di.Name, di.FullName);
                projectFolder.AddFolder(subFolder);
                BrowserFolder(subFolder);
            }
        }