Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
                }
            }
        }
Ejemplo n.º 6
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;
     }
 }