public ProjectFile AddFile(ProjectFolder parent, FilePath fullPath) { ProjectFile file = new ProjectFile(parent, fullPath, Project.ProjectDirectory); parent.AddFile(file); if (ProjectFileAdded != null) { ProjectFileAdded(this, EventArgs.Empty); } return(file); }
public void RemoveTest() { string projectFile = @"C:\Users\Test\file.wcodeproj"; string projectName = "Project"; IProject project = new Project(projectFile, projectName); string fullPath = @"C:\Users\Test\file.8xp"; ProjectFile target = new ProjectFile(project, fullPath); ProjectFolder projectFolder = new ProjectFolder(project, "Folder"); projectFolder.AddFile(target); target.Remove(); Assert.AreEqual(projectFolder.Files.Count, 0); }
public void FindFileTest() { string projectFile = @"C:\Users\Test\file.wcodeproj"; string projectName = "Project"; IProject project = new Project(projectFile, projectName); string folderName = "Folder"; ProjectFolder target = new ProjectFolder(project, folderName); string file = @"C:\Folder\File.8xp"; IProjectFile expected = new ProjectFile(project, file); target.AddFile(expected); IProjectFile actual = target.FindFile(System.IO.Path.GetFileName(file)); Assert.AreEqual(expected, actual); }
public void AddFileTest() { string projectFile = @"C:\Users\Test\file.wcodeproj"; string projectName = "Project"; IProject project = new Project(projectFile, projectName); string folderName = "Folder"; string filePath = @"C:\Folder"; ProjectFolder target = new ProjectFolder(project, folderName); IProjectFile file = new ProjectFile(project, filePath); target.AddFile(file); Assert.AreEqual(target.Files.Count, 1); Assert.IsTrue(project.NeedsSave); Assert.AreEqual(file.Folder.Name, target.Name); }
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(); }
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); } }