当前位置: 首页>>代码示例>>C#>>正文


C# IVsProject类代码示例

本文整理汇总了C#中IVsProject的典型用法代码示例。如果您正苦于以下问题:C# IVsProject类的具体用法?C# IVsProject怎么用?C# IVsProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IVsProject类属于命名空间,在下文中一共展示了IVsProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnAfterRenameFiles

        public override int OnAfterRenameFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, string[] newFileNames, VSRENAMEFILEFLAGS[] flags)
        {
            if (!_project.IsRefreshing) {
                //Get the current value of the StartupFile Property
                string currentStartupFile = _project.GetProjectProperty(CommonConstants.StartupFile, true);
                string fullPathToStartupFile = Path.Combine(_project.ProjectDir, currentStartupFile);

                //Investigate all of the oldFileNames if they are equal to the current StartupFile
                int index = 0;
                foreach (string oldfile in oldFileNames) {
                    //Compare the files and update the StartupFile Property if the currentStartupFile is an old file
                    if (NativeMethods.IsSamePath(oldfile, fullPathToStartupFile)) {
                        //Get the newfilename and update the StartupFile property
                        string newfilename = newFileNames[index];
                        CommonFileNode node = _project.FindChild(newfilename) as CommonFileNode;
                        if (node == null)
                            throw new InvalidOperationException("Could not find the CommonFileNode object");
                        //Startup file has been renamed
                        _project.SetProjectProperty(CommonConstants.StartupFile, node.Url);
                        break;
                    }
                    index++;
                }
            }
            return VSConstants.S_OK;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:26,代码来源:ProjectDocumentsListenerForStartupFileUpdates.cs

示例2: SubmittablePhysicalItem

        //  -------------------------------------------------------------------
        /// <summary>
        /// Creates a new submittable physical item.
        /// </summary>
        /// <param name="rootPath">
        /// The root path of the solution that contains this item.
        /// </param>
        /// <param name="project">
        /// The project that contains this item.
        /// </param>
        /// <param name="hierItem">
        /// The hierarchy item that this item represents.
        /// </param>
        public SubmittablePhysicalItem(string rootPath, IVsProject project,
			HierarchyItem hierItem)
        {
            this.rootPath = rootPath;
            this.project = project;
            this.hierarchy = hierItem;
        }
开发者ID:edpack1980,项目名称:uml-auto-assessment,代码行数:20,代码来源:SubmittablePhysicalItem.cs

示例3: OnSolutionProjectUpdated

 public void OnSolutionProjectUpdated(IVsProject project, SolutionChangedReason reason)
 {
     if (SolutionProjectChanged != null && project != null)
     {
         SolutionProjectChanged(this, new SolutionEventsListenerEventArgs(project, reason));
     }
 }
开发者ID:XpiritBV,项目名称:ProtractorAdapter,代码行数:7,代码来源:SolutionEventsListener.cs

示例4: IsProjectKnown

 internal bool IsProjectKnown(IVsProject project) {
     var pyProj = project as IPythonProjectProvider;
     if (pyProj != null) {
         return _projectInfo.ContainsKey(pyProj.Project);
     }
     return false;
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:7,代码来源:TestContainerDiscoverer.cs

示例5: DoWorkInWriterLock

        private static async Task DoWorkInWriterLock(IVsProject project, Action<MsBuildProject> action)
        {
            UnconfiguredProject unconfiguredProject = GetUnconfiguredProject(project);
            if (unconfiguredProject != null)
            {
                var service = unconfiguredProject.ProjectService.Services.ProjectLockService;
                if (service != null)
                {
                    using (ProjectWriteLockReleaser x = await service.WriteLockAsync())
                    {
                        await x.CheckoutAsync(unconfiguredProject.FullPath);
                        ConfiguredProject configuredProject = await unconfiguredProject.GetSuggestedConfiguredProjectAsync();
                        MsBuildProject buildProject = await x.GetProjectAsync(configuredProject);

                        if (buildProject != null)
                        {
                            action(buildProject);
                        }

                        await x.ReleaseAsync();
                    }

                    await unconfiguredProject.ProjectService.Services.ThreadingPolicy.SwitchToUIThread();
                }
            }
        }
开发者ID:rikoe,项目名称:nuget,代码行数:26,代码来源:ProjectHelper.cs

示例6: OnAfterRemoveFiles

        public override int OnAfterRemoveFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, VSREMOVEFILEFLAGS[] flags)
        {
            //Get the current value of the MainFile Property
            string currentMainFile = this.project.GetProjectProperty(PythonProjectFileConstants.MainFile, true);
            string fullPathToMainFile = Path.Combine(Path.GetDirectoryName(this.project.BaseURI.Uri.LocalPath), currentMainFile);

            //Investigate all of the oldFileNames if they belong to the current project and if they are equal to the current MainFile
            int index = 0;
            foreach(string oldfile in oldFileNames)
            {
                //Compare this project with the project that the old file belongs to
                IVsProject belongsToProject = projects[firstIndices[index]];
                if(Utilities.IsSameComObject(belongsToProject, this.project))
                {
                    //Compare the files and update the MainFile Property if the currentMainFile is an old file
                    if(NativeMethods.IsSamePath(oldfile, fullPathToMainFile))
                    {
                        //Get the first available py file in the project and update the MainFile property
                        List<PythonFileNode> pythonFileNodes = new List<PythonFileNode>();
                        this.project.FindNodesOfType<PythonFileNode>(pythonFileNodes);
                        string newMainFile = string.Empty;
                        if(pythonFileNodes.Count > 0)
                        {
                            newMainFile = pythonFileNodes[0].GetRelativePath();
                        }
                        this.project.SetProjectProperty(PythonProjectFileConstants.MainFile, newMainFile);
                        break;
                    }
                }

                index++;
            }

            return VSConstants.S_OK;
        }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:35,代码来源:ProjectDocumentsListenerForMainFileUpdates.cs

示例7: ProjectReferenceAdapter

 public ProjectReferenceAdapter(IVsProject project, Func<bool> removeFromParentProject, Action<string, KeyValuePair<string, string>> addBinaryReferenceWithMetadataIfNotExists, bool conditionTrue)
 {
     _project = project;
     _removeFromParentProject = removeFromParentProject;
     _addBinaryReferenceWithMetadataIfNotExists = addBinaryReferenceWithMetadataIfNotExists;
     Condition = conditionTrue;
 }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:7,代码来源:ProjectReferenceAdapter.cs

示例8: OnAfterAddFilesEx

        public override int OnAfterAddFilesEx(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] newFileNames, VSADDFILEFLAGS[] flags)
        {
            //Get the current value of the MainFile Property
            string currentMainFile = this.project.GetProjectProperty(PythonProjectFileConstants.MainFile, true);
            if(!string.IsNullOrEmpty(currentMainFile))
                //No need for further operation since MainFile is already set
                return VSConstants.S_OK;

            string fullPathToMainFile = Path.Combine(Path.GetDirectoryName(this.project.BaseURI.Uri.LocalPath), currentMainFile);

            //Investigate all of the newFileNames if they belong to the current project and set the first pythonFileNode found equal to MainFile
            int index = 0;
            foreach(string newfile in newFileNames)
            {
                //Compare this project with the project that the new file belongs to
                IVsProject belongsToProject = projects[firstIndices[index]];
                if(Utilities.IsSameComObject(belongsToProject, this.project))
                {
                    //If the newfile is a python filenode we willl map this file to the MainFile property
                    PythonFileNode filenode = project.FindChild(newfile) as PythonFileNode;
                    if(filenode != null)
                    {
                        this.project.SetProjectProperty(PythonProjectFileConstants.MainFile, filenode.GetRelativePath());
                        break;
                    }
                }

                index++;
            }

            return VSConstants.S_OK;
        }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:32,代码来源:ProjectDocumentsListenerForMainFileUpdates.cs

示例9: FindTestFiles

 protected override IEnumerable<string> FindTestFiles(IVsProject project)
 {
     // we don't want to react to loading/unloading of projects
     // within the solution. Test discovery is only done using
     // ctest
     return new List<string>();
 }
开发者ID:smkanadl,项目名称:CTestTestAdapter,代码行数:7,代码来源:CTestContainerDiscoverer.cs

示例10: OnNotifyTestFileAddRemove

        private int OnNotifyTestFileAddRemove(int changedProjectCount,
                                              IVsProject[] changedProjects,
                                              string[] changedProjectItems,
                                              int[] rgFirstIndices,
                                              TestFileChangedReason reason)
        {
            // The way these parameters work is:
            // rgFirstIndices contains a list of the starting index into the changeProjectItems array for each project listed in the changedProjects list
            // Example: if you get two projects, then rgFirstIndices should have two elements, the first element is probably zero since rgFirstIndices would start at zero.
            // Then item two in the rgFirstIndices array is where in the changeProjectItems list that the second project's changed items reside.
            int projItemIndex = 0;
            for (int changeProjIndex = 0; changeProjIndex < changedProjectCount; changeProjIndex++)
            {
                int endProjectIndex = ((changeProjIndex + 1) == changedProjectCount) ? changedProjectItems.Length : rgFirstIndices[changeProjIndex + 1];

                for (; projItemIndex < endProjectIndex; projItemIndex++)
                {
                    if (changedProjects[changeProjIndex] != null && TestFileChanged != null)
                    {
                        TestFileChanged(this, new TestFileChangedEventArgs(changedProjectItems[projItemIndex], reason));
                    }

                }
            }
            return VSConstants.S_OK;
        }
开发者ID:squadwuschel,项目名称:chutzpah,代码行数:26,代码来源:TestFileAddRemoveListener.cs

示例11: OnAfterAddDirectoriesEx

        //~ Methods ..........................................................
        // ------------------------------------------------------
        public int OnAfterAddDirectoriesEx(int cProjects, int cDirectories,
			IVsProject[] rgpProjects, int[] rgFirstIndices,
			string[] rgpszMkDocuments, VSADDDIRECTORYFLAGS[] rgFlags)
        {
            CxxTestPackage.Instance.TryToRefreshTestSuitesWindow();

            return VSConstants.S_OK;
        }
开发者ID:edpack1980,项目名称:uml-auto-assessment,代码行数:10,代码来源:TrackProjectDocumentsEventsHandler.cs

示例12: GetProjectFilePath

        public static string GetProjectFilePath(IVsProject project)
        {
            string path = string.Empty;
            int hr = project.GetMkDocument(HierarchyConstants.VSITEMID_ROOT, out path);
            System.Diagnostics.Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project.");

            return path;
        }
开发者ID:ldematte,项目名称:BlenXVSP,代码行数:8,代码来源:ProjectUtilities.cs

示例13: VsItem

        public VsItem(IVsProject vsProject)
        {
            m_vsHierarchy = vsProject as IVsHierarchy;
            Debug.Assert(object.ReferenceEquals(m_vsHierarchy, null) == object.ReferenceEquals(vsProject, null));

            m_vsItemID = VSITEMID.Root;
            m_vsParent = null;
        }
开发者ID:jrmwng,项目名称:like2015,代码行数:8,代码来源:VsItem.cs

示例14: ProjectNode

 public ProjectNode(IVsSolution vsSolution, Guid projectGuid)
     : base(vsSolution, projectGuid)
 {
     this.project = this.Hierarchy as IVsProject;
     // Commented because it will show up an error dialog before getting back control to the recipe (caller)
     //Debug.Assert(project != null);  
     Debug.Assert(ItemId == VSConstants.VSITEMID_ROOT);
 }
开发者ID:attilah,项目名称:ProjectLinker,代码行数:8,代码来源:ProjectNode.cs

示例15: ProjectNugetifier

 public ProjectNugetifier(IVsProject vsProject, IPackageRepository packageRepository, IFileSystem projectFileSystem, IConsole console, IHintPathGenerator hintPathGenerator)
 {
     _console = console;
     _projectFileSystem = projectFileSystem;
     _vsProject = vsProject;
     _packageRepository = packageRepository;
     _hintPathGenerator = hintPathGenerator;
 }
开发者ID:GrahamTheCoder,项目名称:NuGet.Extensions,代码行数:8,代码来源:ProjectNugetifier.cs


注:本文中的IVsProject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。