Пример #1
0
        private void AddSubFolderInProject(Project project, ProjectItem vsProjectItem)
        {
            var newFolder = new FolderProxy(vsProjectItem.Name, project);

            newFolder.VsProjectItem = vsProjectItem;
            newFolder.DirectoryPath = new System.IO.DirectoryInfo(vsProjectItem.get_FileNames(0)).FullName;

            project.Items.Add(newFolder);

            if (vsProjectItem.ProjectItems.Count > 0)
            {
                AddFilesAndFolders(newFolder, vsProjectItem);
            }
        }
Пример #2
0
 public Folder NewFolder(string name, Folder parentFolder)
 {
     if (parentFolder is FolderProxy)
     {
         var parentFolderProxy = parentFolder as FolderProxy;
         var newFolder         = new FolderProxy(name, parentFolderProxy);
         var newVsFolder       = parentFolderProxy.VsProjectItem.ProjectItems.AddFolder(name, EnvDTE.Constants.vsProjectItemKindPhysicalFolder);
         newFolder.VsProjectItem = newVsFolder;
         return(newFolder);
     }
     else
     {
         var parentProjectProxy = parentFolder as ProjectProxy;
         var newFolder          = new FolderProxy(name, parentProjectProxy);
         var newVsFolder        = parentProjectProxy.VsProject.ProjectItems.AddFolder(name, EnvDTE.Constants.vsProjectItemKindPhysicalFolder);
         newFolder.VsProjectItem = newVsFolder;
         return(newFolder);
     }
 }
Пример #3
0
        private void AddFilesAndFolders(Folder parentFolder, ProjectItem parentVsItem)
        {
            for (int x = 1; x <= parentVsItem.ProjectItems.Count; x++)
            {
                var vsItem = parentVsItem.ProjectItems.Item(x);
                if (vsItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFolder)
                {
                    var newFolder = new FolderProxy(vsItem.Name, parentFolder);
                    newFolder.VsProjectItem = vsItem;
                    newFolder.DirectoryPath = new System.IO.DirectoryInfo(vsItem.get_FileNames(0)).FullName;

                    parentFolder.Items.Add(newFolder);

                    if (vsItem.ProjectItems.Count > 0)
                    {
                        AddFilesAndFolders(newFolder, vsItem);
                    }
                }
                else if (vsItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFile)
                {
                    var newFile = AddFileToFolder(parentFolder, vsItem);
                }
            }
        }
        private void AddSubFolderInProject(Project project, ProjectItem vsProjectItem)
        {
            var newFolder = new FolderProxy(vsProjectItem.Name, project);
            newFolder.VsProjectItem = vsProjectItem;
            newFolder.DirectoryPath = new System.IO.DirectoryInfo(vsProjectItem.get_FileNames(0)).FullName;

            project.Items.Add(newFolder);

            if (vsProjectItem.ProjectItems.Count > 0)
            {
                AddFilesAndFolders(newFolder, vsProjectItem);
            }
        }
        private void AddFilesAndFolders(Folder parentFolder, ProjectItem parentVsItem)
        {
            for (int x = 1; x <= parentVsItem.ProjectItems.Count; x++)
            {
                var vsItem = parentVsItem.ProjectItems.Item(x);
                if (vsItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFolder)
                {
                    var newFolder = new FolderProxy(vsItem.Name, parentFolder);
                    newFolder.VsProjectItem = vsItem;
                    newFolder.DirectoryPath = new System.IO.DirectoryInfo(vsItem.get_FileNames(0)).FullName;

                    parentFolder.Items.Add(newFolder);

                    if (vsItem.ProjectItems.Count > 0)
                        AddFilesAndFolders(newFolder, vsItem);
                }
                else if (vsItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFile)
                {
                    var newFile = AddFileToFolder(parentFolder, vsItem);
                }
            }
        }
 public Folder NewFolder(string name, Folder parentFolder)
 {
     if (parentFolder is FolderProxy)
     {
         var parentFolderProxy = parentFolder as FolderProxy;
         var newFolder = new FolderProxy(name, parentFolderProxy);
         var newVsFolder = parentFolderProxy.VsProjectItem.ProjectItems.AddFolder(name, EnvDTE.Constants.vsProjectItemKindPhysicalFolder);
         newFolder.VsProjectItem = newVsFolder;
         return newFolder;
     }
     else
     {
         var parentProjectProxy = parentFolder as ProjectProxy;
         var newFolder = new FolderProxy(name, parentProjectProxy);
         var newVsFolder = parentProjectProxy.VsProject.ProjectItems.AddFolder(name, EnvDTE.Constants.vsProjectItemKindPhysicalFolder);
         newFolder.VsProjectItem = newVsFolder;
         return newFolder;
     }
 }