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


C# EnvDTE.get_FileNames方法代码示例

本文整理汇总了C#中EnvDTE.get_FileNames方法的典型用法代码示例。如果您正苦于以下问题:C# EnvDTE.get_FileNames方法的具体用法?C# EnvDTE.get_FileNames怎么用?C# EnvDTE.get_FileNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnvDTE的用法示例。


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

示例1: GetSourceFile

 private static SourceFile GetSourceFile(EnvDTE.ProjectItem projectItem)
 {
     return CodeRush.Source.ActiveSolution.FindSourceFile(projectItem.get_FileNames(0));
 }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:4,代码来源:IssueProcessor.cs

示例2: ProjectItemRenamed

        private void ProjectItemRenamed(EnvDTE.ProjectItem projectItem, string oldName)
        {
            try
            {
                string originalPath = Path.GetDirectoryName(projectItem.get_FileNames(0)) + Path.DirectorySeparatorChar + oldName;
                foreach (CodeIssueFile codeIssue in CodeIssues)
                {
                    if (codeIssue.file.Name == originalPath)
                        codeIssue.file = GetSourceFile(projectItem);
                }
            }
            catch (Exception err)
            {
                Debug.Assert(false, "Error renaming code issues", err.Message);
            }

            OnResults(null);
        }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:18,代码来源:IssueProcessor.cs

示例3: EnsureExtensions

		/// <summary>
		/// Ensure that the current project item has the required extensions loaded.
		/// This is only called after verifying that the current project item does
		/// not satisfy the requirements.
		/// </summary>
		/// <param name="projectItem">The <see cref="EnvDTE.ProjectItem"/> to modify</param>
		/// <param name="serviceProvider">The <see cref="IServiceProvider"/> for document tracking.</param>
		/// <param name="extensions">An <see cref="T:ICollection{System.String}"/> of additional required extensions</param>
		public static bool EnsureExtensions(EnvDTE.ProjectItem projectItem, IServiceProvider serviceProvider, ICollection<string> extensions)
		{
			ServiceProvider provider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)projectItem.DTE);
			// UNDONE: Localize message strings in here
			if ((int)DialogResult.No == VsShellUtilities.ShowMessageBox(
				provider,
				"Additional extensions are required to support the chosen generators. Would you like to load the required extensions now?",
				"ORM Generator Selection",
				OLEMSGICON.OLEMSGICON_QUERY,
				OLEMSGBUTTON.OLEMSGBUTTON_YESNO,
				OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST))
			{
				return false;
			}
			EnvDTE.Document document = projectItem.Document;
			bool secondPass = false;
			bool tryDocument = true;
			string itemPath = null;
			while (tryDocument)
			{
				object documentExtensionManager;
				MethodInfo methodInfo;
				if (null != document &&
					null != (documentExtensionManager = ORMCustomToolUtility.GetDocumentExtension<object>(document, "ORMExtensionManager", itemPath ?? (itemPath = projectItem.get_FileNames(0)), serviceProvider)) &&
					null != (methodInfo = documentExtensionManager.GetType().GetMethod("EnsureExtensions", new Type[] { typeof(string[]) })))
				{
					string[] extensionsArray = new string[extensions.Count];
					extensions.CopyTo(extensionsArray, 0);
					methodInfo.Invoke(documentExtensionManager, new object[] { extensionsArray });
					return true;
				}

				if (secondPass)
				{
					return false;
				}
				tryDocument = false;
				secondPass = true;

				// UNDONE: Localize message strings in here
				if ((int)DialogResult.No == VsShellUtilities.ShowMessageBox(
					provider,
					"The .ORM file must be open in the default designer to add extensions. Would you like to open or reopen the document now?",
					"ORM Generator Selection",
					OLEMSGICON.OLEMSGICON_QUERY,
					OLEMSGBUTTON.OLEMSGBUTTON_YESNO,
					OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST))
				{
					return false;
				}

				if (document != null)
				{
					document.Close(EnvDTE.vsSaveChanges.vsSaveChangesPrompt);
					document = projectItem.Document;
				}
				if (document == null)
				{
					projectItem.Open(Guid.Empty.ToString("B")).Visible = true;
					document = projectItem.Document;
					tryDocument = true;
				}
			}
			return false;
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:73,代码来源:ORMExtensionManager.cs

示例4: ProjectItemRemoved

        private void ProjectItemRemoved(EnvDTE.ProjectItem projectItem)
        {
            try
            {
                CodeIssues.RemoveAll(new CodeIssueMatch(projectItem.get_FileNames(0)).FilePathMatch);
            }
            catch (Exception err)
            {
                Debug.Assert(false, "Error removing code issues", err.Message);
            }

            OnResults(null);
        }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:13,代码来源:IssueProcessor.cs

示例5: ProjectItemFinishedGenerating

        /// <summary>
        /// Runs custom wizard logic when a project item has finished generating.
        /// </summary>
        /// <param name="projectItem">The project item that finished generating.</param>
        public override void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {
            base.ProjectItemFinishedGenerating(projectItem);

            if (this.projectItemCreated == null)
            {
                this.projectItemCreated = projectItem.get_FileNames(1);
            }
        }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:13,代码来源:InstantiationTemplateWizard.cs


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