• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVsProject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetProjectFilePath

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

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


示例17: XmlFileWrapper

        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigFileWrapper"/> class.
        /// </summary>
        /// <param name="ownerProject">The owner project.</param>
        /// <param name="doc">The doc.</param>
        /// <param name="fileName">Name of the file.</param>
        public XmlFileWrapper(XmlDocument doc, string fileName=null, IVsProject ownerProject=null)
        {
            Guard.ArgumentNotNull(doc, "doc");

            Document = doc;
            FileName = fileName;
            OwnerProject = ownerProject;
        }
开发者ID:t4generators,项目名称:t4-SolutionManager,代码行数:14,代码来源:ConfigFileWrapper.cs


示例18: GetSource

 private static string GetSource(IVsProject project, string source)
 {
     var directory = Directory.Exists(source) ? source : Path.GetDirectoryName(source);
     var candidates = new[]{
         Path.Combine(directory, Globals.SettingsFilename)
     };
     return candidates.FirstOrDefault(f => project.HasFile(f));
 }
开发者ID:jbijlsma,项目名称:JasmineNodeTestAdapter,代码行数:8,代码来源:JasmineTestContainerSource.cs


示例19: OnAfterRemoveFiles

        // ------------------------------------------------------
        public int OnAfterRemoveFiles(int cProjects, int cFiles,
			IVsProject[] rgpProjects, int[] rgFirstIndices,
			string[] rgpszMkDocuments, VSREMOVEFILEFLAGS[] rgFlags)
        {
            CxxTestPackage.Instance.TryToRefreshTestSuitesWindow();

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


示例20:

 int IVsTrackProjectDocumentsEvents2.OnAfterRemoveDirectories(int cProjects,
                                                              int cDirectories,
                                                              IVsProject[] rgpProjects,
                                                              int[] rgFirstIndices,
                                                              string[] rgpszMkDocuments,
                                                              VSREMOVEDIRECTORYFLAGS[] rgFlags)
 {
     return VSConstants.S_OK;
 }
开发者ID:jischebeck,项目名称:KarmaTestAdapter,代码行数:9,代码来源:TestFileAddRemoveListener.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVsSolution类代码示例发布时间:2022-05-24
下一篇:
C# IVsPackageManagerFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap