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

C# EnvDTE类代码示例

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

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



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

示例1: AddProperty

 public EnvDTE.CodeProperty AddProperty(string getterName, string putterName, object type, object position, EnvDTE.vsCMAccess access, object location)
 {
     return FileCodeModel.EnsureEditor(() =>
     {
         return FileCodeModel.AddProperty(LookupNode(), getterName, putterName, type, position, access);
     });
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:CodeInterface.cs


示例2: GetSubProject

        // http://social.msdn.microsoft.com/Forums/vstudio/en-US/36adcd56-5698-43ca-bcba-4527daabb2e3/finding-the-startup-project-in-a-complicated-solution
        public static EnvDTE.Project GetSubProject(EnvDTE.Project project, string uniqueName)
        {
            EnvDTE.Project ret = null;

            if (project != null)
            {
                if (project.UniqueName == uniqueName)
                {
                    ret = project;
                }
                else if (project.Kind == vsProjectKindSolutionItems)
                {
                    // Solution folder
                    foreach (EnvDTE.ProjectItem projectItem in project.ProjectItems)
                    {
                        ret = GetSubProject(projectItem.SubProject, uniqueName);

                        if (ret != null)
                            break;
                    }
                }
            }

            return ret;
        }
开发者ID:stjeong,项目名称:AttachToW3WP,代码行数:26,代码来源:AttachToW3WPPackage.cs


示例3: Transform

        public override string Transform(string fullFileName, string text, EnvDTE.ProjectItem projectItem)
        {
            var tags = regexScripts.Matches(text).Cast<Match>().Reverse();

            foreach (var match in tags)
            {
                var tagName = match.Groups[1].Value;
                var attrs = match.Groups[2].Value;
                var code = match.Groups[3].Value;

                if (tagName.Is("script"))
                {
                    code = JsEngine.Minify(fullFileName, code, projectItem, Xml.MinifyType.Unspecified,string.Empty);
                }
                else if (tagName.Is("style"))
                {
                    int i = attrs.IndexOf("text/less", StringComparison.InvariantCultureIgnoreCase);
                    if (i > -1)
                    {
                        attrs = attrs.Substring(0, i) + "text/css" + attrs.Substring(i + "text/less".Length);
                        code = code.Replace("@@import", "@import"); // Razor views need the @ symbol to be escaped :/
                        code = LessEngine.TransformToCss(fullFileName, code, projectItem);
                        code = code.Replace("@import", "@@import"); // Now we have to re-escape it
                    }

                    code = CssEngine.Minify(fullFileName, code, projectItem, Xml.MinifyType.Unspecified);
                }

                text = text.Substring(0, match.Index)
                    + '<' + tagName + attrs + '>' + code + "</" + tagName + '>'
                    + text.Substring(match.Index + match.Length);
            }

            return text;
        }
开发者ID:cbilson,项目名称:chirpy,代码行数:35,代码来源:ViewEngine.cs


示例4: GetActiveProject

        private bool GetActiveProject(out EnvDTE.Project project, out FrameworkName frameworkName)
        {
            project = null;
            frameworkName = null;

            IntPtr hierarchyPointer = IntPtr.Zero;
            IntPtr selectionContainerPointer = IntPtr.Zero;

            try
            {
                uint itemid;
                IVsMultiItemSelect multiItemSelect;

                Marshal.ThrowExceptionForHR(
                    _monitorSelection.GetCurrentSelection(
                        out hierarchyPointer,
                        out itemid,
                        out multiItemSelect,
                        out selectionContainerPointer));

                if (itemid != (uint)VSConstants.VSITEMID.Root)
                {
                    return false;
                }

                var hierarchy = Marshal.GetObjectForIUnknown(hierarchyPointer) as IVsHierarchy;
                if (hierarchy == null)
                {
                    return false;
                }

                object extensibilityObject;
                object targetFrameworkVersion;
                object targetFrameworkMonikerObject;
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out extensibilityObject));
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID3.VSHPROPID_TargetFrameworkVersion, out targetFrameworkVersion));
                Marshal.ThrowExceptionForHR(
                    hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID4.VSHPROPID_TargetFrameworkMoniker, out targetFrameworkMonikerObject));

                string targetFrameworkMoniker = targetFrameworkMonikerObject as string;
                frameworkName = new System.Runtime.Versioning.FrameworkName(targetFrameworkMoniker);

                project = extensibilityObject as EnvDTE.Project;
                return true;
            }
            finally
            {
                if (hierarchyPointer != IntPtr.Zero)
                {
                    Marshal.Release(hierarchyPointer);
                }

                if (selectionContainerPointer != IntPtr.Zero)
                {
                    Marshal.Release(selectionContainerPointer);
                }
            }
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:60,代码来源:AbstractResetInteractiveMenuCommand.cs


示例5: ToHierarchy

        public static IVsHierarchy ToHierarchy(EnvDTE.Project project)
        {
            if (project == null) throw new ArgumentNullException("project");

            string uniqueName = project.UniqueName;
            IVsSolution solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));

            IVsHierarchy hierarchy;

            solution.GetProjectOfUniqueName(uniqueName, out hierarchy);

            return hierarchy;
            /*if (project == null) throw new ArgumentNullException("project"); string projectGuid = null;        // DTE does not expose the project GUID that exists at in the msbuild project file.        // Cannot use MSBuild object model because it uses a static instance of the Engine,         // and using the Project will cause it to be unloaded from the engine when the         // GC collects the variable that we declare.       
            using (XmlReader projectReader = XmlReader.Create(project.FileName))
            {
                projectReader.MoveToContent();
                object nodeName = projectReader.NameTable.Add("ProjectGuid");
                while (projectReader.Read())
                {
                    if (Object.Equals(projectReader.LocalName, nodeName))
                    {
                        projectGuid = (String)projectReader.ReadElementContentAsString(); break;
                    }
                }
            }
            Debug.Assert(!String.IsNullOrEmpty(projectGuid));
            IServiceProvider serviceProvider = new ServiceProvider(project.DTE as Microsoft.VisualStudio.OLE.Interop.IServiceProvider); return VsShellUtilities.GetHierarchy(serviceProvider, new Guid(projectGuid));*/
        }
开发者ID:Bubesz,项目名称:meta-cs,代码行数:28,代码来源:VsHelper.cs


示例6: GetExpandedProjectHierarchyItems

        private static ICollection<VsHierarchyItem> GetExpandedProjectHierarchyItems(EnvDTE.Project project)
        {
            VsHierarchyItem projectHierarchyItem = GetHierarchyItemForProject(project);
            IVsUIHierarchyWindow solutionExplorerWindow = GetSolutionExplorerHierarchyWindow();

            if (solutionExplorerWindow == null)
            {
                // If the solution explorer is collapsed since opening VS, this value is null. In such a case, simply exit early.
                return new VsHierarchyItem[0];
            }

            var expandedItems = new List<VsHierarchyItem>();

            // processCallback return values: 
            //     0   continue, 
            //     1   don't recurse into, 
            //    -1   stop
            projectHierarchyItem.WalkDepthFirst(
                fVisible: true, 
                processCallback:
                            (VsHierarchyItem vsItem, object callerObject, out object newCallerObject) =>
                            {
                                newCallerObject = null;
                                if (IsVsHierarchyItemExpanded(vsItem, solutionExplorerWindow))
                                {
                                    expandedItems.Add(vsItem);
                                }
                                return 0;
                            },
                callerObject: null);

            return expandedItems;
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:33,代码来源:VsHierarchyHelper.cs


示例7: FireOnBuildDone

 public void FireOnBuildDone(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
 {
     if (OnBuildDone != null)
     {
         OnBuildDone(scope, action);
     }
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:7,代码来源:MockBuildEvents.cs


示例8: UpdateGeneratedCodeWizard

 public UpdateGeneratedCodeWizard(EnvDTE.DTE dte)
 {
     InitializeComponent();
     DataContext = this;
     _dte = dte;
     Loaded += (_, __) => Run().ConfigureAwait(true);
 }
开发者ID:bnjMichel,项目名称:waqs,代码行数:7,代码来源:UpdateGeneratedCodeWizard.xaml.cs


示例9: OnAfterCreated

 public override void OnAfterCreated(EnvDTE.DTE dteObject)
 {
     this.cboPackerEncoding.DataSource = System.Enum.GetNames(typeof(Dean.Edwards.ECMAScriptPacker.PackerEncoding));
     this.cboPackerEncoding.Text = this.Settings.ChirpDeanEdwardsPackerEncoding.ToString();
     this.chkFastDecode.Checked = this.Settings.ChirpDeanEdwardsPackerFastDecode;
     this.chkSpecialChars.Checked = this.Settings.ChirpDeanEdwardsPackerSpecialChars;
 }
开发者ID:cbilson,项目名称:chirpy,代码行数:7,代码来源:DeanEdwardsPacker.cs


示例10: TransformToJs

        public static string TransformToJs(string fullFileName, string text, EnvDTE.ProjectItem projectItem)
        {
            string error = null;
            try
            {
               Settings settings = Settings.Instance(fullFileName);
               return CoffeeScript.compile(text, settings.CoffeeScriptOptions);
            }
            catch (Exception e)
            {
                Match match;
                if (TaskList.Instance != null && (match = regexError.Match(e.Message)).Success)
                {
                    TaskList.Instance.Add(
                        projectItem.ContainingProject,
                        Microsoft.VisualStudio.Shell.TaskErrorCategory.Error,
                        fullFileName,
                        match.Groups[2].Value.ToInt(1),
                        0,
                        match.Groups[1].Value);
                }
                else
                {
                    error = e.Message;
                }

                return null;
            }
        }
开发者ID:Malediction,项目名称:Spartan,代码行数:29,代码来源:CoffeeScriptEngine.cs


示例11: AddTranslationDialog

        public AddTranslationDialog(EnvDTE.Project pro)
        {
            project = pro;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            ShowInTaskbar = false;

            this.langLabel.Text = SR.GetString("AddTranslationDialog_Language");
            this.cancelButton.Text = SR.GetString(SR.Cancel);
            this.okButton.Text = SR.GetString(SR.OK);
            this.label1.Text = SR.GetString("AddTranslationDialog_FileName");
            this.Text = SR.GetString("AddTranslationDialog_Title");

            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

            //if (SR.LanguageName == "ja")
            //{
            //    this.cancelButton.Location = new System.Drawing.Point(188, 72);
            //    this.cancelButton.Size = new System.Drawing.Size(84, 24);
            //    this.okButton.Location = new System.Drawing.Point(100, 72);
            //    this.okButton.Size = new System.Drawing.Size(84, 24);
            //}
            this.KeyPress += new KeyPressEventHandler(this.AddTranslationDialog_KeyPress);
        }
开发者ID:ago1024,项目名称:Qt4VSAddin,代码行数:26,代码来源:AddTranslationDialog.cs


示例12: Execute

 public void Execute(EnvDTE.vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
 {
     if (FmMain.DoDialog("") == DialogResult.OK)
     {
         (IDE.ApplicationObject.ActiveDocument.Selection as TextSelection).Text = FmMain.Code;
     }
 }
开发者ID:AlexandrM,项目名称:VSExpert,代码行数:7,代码来源:Restore.cs


示例13: if

        /// <summary>
        /// Runs custom wizard logic when a project has finished generating
        /// </summary>
        void IWizard.ProjectFinishedGenerating(EnvDTE.Project project)
        {
            if (project != null) {
                if (project.Name == "SolutionItemsContainer") {
                    PerformSolutionInitialization(project);
                    MoveSolutionItemsToLib(project);
                }
                else if (project.Name == "ToolsSolutionItemsContainer") {
                    MoveSolutionItemsToToolsLib(project);
                }
                else if (project.Name == "CrudScaffolding") {
                    Project movedProject = MoveProjectTo("\\tools\\", project, "Code Generation");
                    ExcludeProjectFromBuildProcess(movedProject);
                }
                else if (project.Name == "CrudScaffoldingForEnterpriseApp") {
                    Project movedProject = MoveProjectTo("\\tools\\", project, "Code Generation");
                    ExcludeProjectFromBuildProcess(movedProject);
                }
                else if (project.Name == GetSolutionName() + ".Tests") {
                    MoveProjectTo("\\tests\\", project);
                }
                else if (project.Name == GetSolutionName() + ".Web.Controllers" ||
                    project.Name == GetSolutionName() + ".ApplicationServices" ||
                    project.Name == GetSolutionName() + ".Core" ||
                    project.Name == GetSolutionName() + ".Data" ||
                    project.Name == GetSolutionName() + ".Web") {
                    Project movedProject = MoveProjectTo("\\app\\", project);

                    // Give the solution time to release the lock on the project file
                    System.Threading.Thread.Sleep(MIN_TIME_FOR_PROJECT_TO_RELEASE_FILE_LOCK);

                    CaptureProjectGuidOf(movedProject);
                }
            }
        }
开发者ID:bondehagen,项目名称:Sharp-Architecture,代码行数:38,代码来源:WizardImplementation.cs


示例14: FrmActivateMemoryContracts

        public FrmActivateMemoryContracts(EnvDTE.Projects projects, string contractsAssemblyPath)
        {
            InitializeComponent();

            this.projects = projects;
            this.contractsAssemblyPath = contractsAssemblyPath;
        }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:7,代码来源:FrmActivateMemoryContracts.cs


示例15: GetSiblings

        private static IEnumerable<EnvDTE.ProjectItem> GetSiblings(EnvDTE.ProjectItem item)
        {
            EnvDTE.ProjectItem folder = item.Collection.Parent as EnvDTE.ProjectItem;
            List<EnvDTE.ProjectItem> items = new List<EnvDTE.ProjectItem>();

            while (folder != null)
            {
              if (!folder.Kind.Equals(VSConstants.ItemTypeGuid.PhysicalFolder_string, System.StringComparison.OrdinalIgnoreCase))
              {
                folder = folder.Collection.Parent as EnvDTE.ProjectItem;
              }
              else
              {
                break;
              }
            }

            if (folder != null)
            {
              items.AddRange(folder.ProjectItems.Cast<EnvDTE.ProjectItem>());
            }
            else if (item.ContainingProject != null && item.ContainingProject.ProjectItems != null)
            {
              items.AddRange(item.ContainingProject.ProjectItems.Cast<EnvDTE.ProjectItem>());
            }

            return items.Where(i => i.Kind.Equals(VSConstants.ItemTypeGuid.PhysicalFile_string, System.StringComparison.OrdinalIgnoreCase));
        }
开发者ID:alekseynemiro,项目名称:FileNesting,代码行数:28,代码来源:ItemSelector.xaml.cs


示例16: OnAfterCreated

        public override void OnAfterCreated(EnvDTE.DTE dteObject)
        {
            this.cboEvalTreatment.DataSource = System.Enum.GetNames(typeof(EvalTreatment));
            this.cboLocalRenaming.DataSource = System.Enum.GetNames(typeof(LocalRenaming));
            this.cboOutputMode.DataSource = System.Enum.GetNames(typeof(OutputMode));

            this.chkAllowEmbeddedAspNetBlocks.Checked = this.Settings.MsJsSettings.AllowEmbeddedAspNetBlocks;
            this.chkEvalLiteralExpressions.Checked = this.Settings.MsJsSettings.EvalLiteralExpressions;
            this.chkIgnoreConditionalCompilation.Checked = this.Settings.MsJsSettings.IgnoreConditionalCompilation;
            this.chkInlineSafeStrings.Checked = this.Settings.MsJsSettings.InlineSafeStrings;
            this.chkManualRenamesProperties.Checked = this.Settings.MsJsSettings.ManualRenamesProperties;
            this.chkMinifyCode.Checked = this.Settings.MsJsSettings.MinifyCode;
            this.chkPreserveFunctionNames.Checked = this.Settings.MsJsSettings.PreserveFunctionNames;
            this.chkRemoveFunctionExpressionNames.Checked = this.Settings.MsJsSettings.RemoveFunctionExpressionNames;
            this.chkCollapseToLiteral.Checked = this.Settings.MsJsSettings.CollapseToLiteral;
            this.chkCombineDuplicateLiterals.Checked = this.Settings.MsJsSettings.CombineDuplicateLiterals;
            this.cboEvalTreatment.Text = this.Settings.MsJsSettings.EvalTreatment.ToString();
            this.TxtIndentSize.Value = this.Settings.MsJsSettings.IndentSize;
            this.cboLocalRenaming.Text = this.Settings.MsJsSettings.LocalRenaming.ToString();
            this.txtLineBreakThreshold.Value = this.Settings.MsJsSettings.LineBreakThreshold;
            this.chkMacSafariQuirks.Checked = this.Settings.MsJsSettings.MacSafariQuirks;
            this.cboOutputMode.Text = this.Settings.MsJsSettings.OutputMode.ToString();
            this.chkRemoveUnneededCode.Checked = this.Settings.MsJsSettings.RemoveUnneededCode;
            this.chkStripDebugStatements.Checked = this.Settings.MsJsSettings.StripDebugStatements;
            this.chkStrictMode.Checked = this.Settings.MsJsSettings.StrictMode;
            this.chkTermSemicolons.Checked = this.Settings.MsJsSettings.TermSemicolons;
            this.chkPreserveImportantComments.Checked = this.Settings.MsJsSettings.PreserveImportantComments;
            this.chkReorderScopeDeclarations.Checked=this.Settings.MsJsSettings.ReorderScopeDeclarations;
        }
开发者ID:Malediction,项目名称:Spartan,代码行数:29,代码来源:MsJs.cs


示例17: AddProjectsRecursive

 private static void AddProjectsRecursive(this List<EnvDTE.Project> list, EnvDTE.Project subProject)
 {
     if (subProject.Kind == ProjectKinds.vsProjectKindSolutionFolder)
         list.AddRange(GetSolutionFolderProjects(subProject));
     else
         list.Add(subProject);
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:SolutionProjects.cs


示例18: FireOnBuildBegin

 public void FireOnBuildBegin(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
 {
     if (OnBuildBegin != null)
     {
         OnBuildBegin(scope, action);
     }
 }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:7,代码来源:MockBuildEvents.cs


示例19: ProjectFinishedGenerating

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Runs custom wizard logic when a project has finished generating.
        /// </summary>
        /// <param name="project">The project that finished generating.</param>
        /// ------------------------------------------------------------------------------------
        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {
            if (project == null)
                return;

            // Go through all project items and remove *.vspscc and *.user file (it has to be in
            // the project so that it gets added and properly named by the wizard)
            RemoveItemFromProject(project, project.Name + ".csproj.vspscc");
            RemoveItemFromProject(project, project.Name + ".csproj.user");

            // The project may contain items for a test project - we need to remove those and
            // add it as a separate project! This can't be done using a multi-project template,
            // because we want the projects to be nested.
            ArrayList itemsToRemove = new ArrayList();
            foreach (ProjectItem item in project.ProjectItems)
            {
                if (item.Name.StartsWith(project.Name) && item.ProjectItems.Count > 0)
                    itemsToRemove.Add(item.Name);
            }
            foreach (string itemName in itemsToRemove)
                RemoveItemFromProject(project, itemName);
            if (itemsToRemove.Count > 0)
            {
                string newProject = Path.Combine(Path.GetDirectoryName(project.FileName),
                    Path.Combine(project.Name + "Tests", project.Name + "Tests.csproj"));
                // Rename the temporary bla.csprojX file to bla.csproj
                File.Move(newProject + "X", newProject);
                // Add the test project to the solution
                project.DTE.Solution.AddFromFile(newProject, false);
            }
        }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:37,代码来源:WizardExtension.cs


示例20: ShouldExpand

        private static bool ShouldExpand(EnvDTE.UIHierarchyItem item, CollapseOptions options)
        {
            var solution = item.Object as EnvDTE.Solution;
            if (solution != null)
            {
                // Solution
                return false;
            }

            var project = item.Object as EnvDTE.Project;
            if (project != null)
            {
                if (((EnvDTE.Project)item.Object).Kind != EnvDTE80.ProjectKinds.vsProjectKindSolutionFolder)
                {
                    // Project
                    return (options & CollapseOptions.IncludeProjects) == CollapseOptions.IncludeProjects;
                }
                else
                {
                    // Solution Folder
                    return (options & CollapseOptions.IncludeSolutionFolders) == CollapseOptions.IncludeSolutionFolders;
                }
            }

            //var projectItem = item.Object as EnvDTE.ProjectItem;
            //if ((((projectItem != null) && (((EnvDTE.ProjectItem)item.Object).Object is EnvDTE.Project))
            //        && (((EnvDTE.Project)((EnvDTE.ProjectItem)item.Object).Object).Kind != EnvDTE80.ProjectKinds.vsProjectKindSolutionFolder)))
            //{
            //    // Project item
            //    return true;
            //}

            // Project folders or items
            return true;
        }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:35,代码来源:UIHierarchyExtensions.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# EnvDTE80类代码示例发布时间:2022-05-24
下一篇:
C# Env类代码示例发布时间: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