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


C# IProjectFile.GetSolution方法代码示例

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


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

示例1: ProcessProjectItem

 ///<returns>
 ///True if further search is not needed
 ///</returns>
 ///
 public bool ProcessProjectItem(IProjectFile projectItem)
 {
     IFile psiFile = PsiManager.GetInstance(projectItem.GetSolution()).GetPsiFile(projectItem);
     if (psiFile != null)
     {
         return this.ProcessElement(psiFile);
     }
     return false;
 }
开发者ID:willrawls,项目名称:arp,代码行数:13,代码来源:ReferencesSearcher.cs

示例2: GetXmlFile

 protected static IXmlFile GetXmlFile(IProjectFile projectFile)
 {
     if (projectFile == null)
     {
         return null;
     }
     PsiManager manager = PsiManager.GetInstance(projectFile.GetSolution());
     if (!manager.IsCommitted(projectFile))
     {
         return null;
     }
     return (manager.GetPsiFile(projectFile) as IXmlFile);
 }
开发者ID:willrawls,项目名称:arp,代码行数:13,代码来源:BaseXmlDaemonStage.cs

示例3: GetLineCount

        /// <summary>
        /// Gets the count of lines for the IProjectFile provided.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to use.
        /// </param>
        /// <returns>
        /// An integer of the line count for the file.
        /// </returns>
        public static JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine> GetLineCount(IProjectFile projectFile)
        {
            ISolution solution = projectFile.GetSolution();
            IDocument document = DocumentManager.GetInstance(solution).GetOrCreateDocument(projectFile);
            JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine> lineCount;

            using (ReadLockCookie.Create())
            {
                lineCount = document.GetLineCount();
            }

            return lineCount;
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:22,代码来源:Utils.cs

示例4: GetTextRange

        /// <summary>
        /// Gets a TextRange for the ReSharper line number provided.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to use.
        /// </param>
        /// <param name="resharperLineNumber">
        /// These are zero based.
        /// </param>
        /// <returns>
        /// A TextRange covering the line number specified.
        /// </returns>
        public static JB::JetBrains.Util.TextRange GetTextRange(
            IProjectFile projectFile, JB::JetBrains.Util.dataStructures.TypedIntrinsics.Int32<DocLine> resharperLineNumber)
        {
            using (ReadLockCookie.Create())
            {
                ISolution solution = projectFile.GetSolution();
                if (solution == null)
                {
                    return new JB::JetBrains.Util.TextRange();
                }

                IDocument document = DocumentManager.GetInstance(solution).GetOrCreateDocument(projectFile);

                return GetTextRangeForLineNumber(document, resharperLineNumber);
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:28,代码来源:Utils.cs

示例5: Execute

        /// <summary>
        /// Executes <see cref="styleCopCore"/> within the <see cref="OnViolationEncountered"/>.
        /// </summary>
        /// <remarks>
        /// Violations are raised as events, handled by <see cref="IProjectFile"/>.
        /// </remarks>
        /// <param name="projectFile">
        /// <see cref="StyleCopStageProcess"/>representing the file currently being parsed by ReSharper.
        /// </param>
        /// <param name="document">
        /// The document being checked.
        /// </param>
        public void Execute(IProjectFile projectFile, IDocument document)
        {
            StyleCopTrace.In(projectFile, document);

            if (projectFile == null)
            {
                return;
            }

            this.Initialize();

            this.violationHighlights.Clear();

            if (!this.styleCopSettings.SkipAnalysisForDocument(projectFile))
            {
                FileHeader fileHeader = new FileHeader(Utils.GetCSharpFile(projectFile.GetSolution(), document));

                if (!fileHeader.UnStyled && StyleCopReferenceHelper.EnsureStyleCopIsLoaded())
                {
                    this.file = projectFile;
                    this.document = document;
                    this.RunStyleCop(document);
                }
            }

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:39,代码来源:StyleCopRunnerInt.cs

示例6: Process

        /// <summary>
        /// Process clean-up on file.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to process.
        /// </param>
        /// <param name="range">
        /// The range marker to process.
        /// </param>
        /// <param name="profile">
        /// The code cleanup settings to use.
        /// </param>
        /// <param name="canIncrementalUpdate">
        /// Determines whether we can incrementally update.
        /// </param>
        /// <param name="progressIndicator">
        /// The progress indicator.
        /// </param>
        public void Process(
            IProjectFile projectFile, 
            IPsiRangeMarker range, 
            CodeCleanupProfile profile, 
            out bool canIncrementalUpdate, 
            JB::JetBrains.Application.Progress.IProgressIndicator progressIndicator)
        {
            StyleCopTrace.In(projectFile, range, profile, progressIndicator);
            canIncrementalUpdate = true;

            if (projectFile == null)
            {
                return;
            }

            if (!this.IsAvailable(projectFile))
            {
                return;
            }

            ISolution solution = projectFile.GetSolution();

            PsiManagerImpl psiManager = PsiManagerImpl.GetInstance(solution);

            ICSharpFile file = psiManager.GetPsiFile(projectFile, PsiLanguageType.GetByProjectFile(projectFile)) as ICSharpFile;

            if (file == null)
            {
                return;
            }

            DocumentationOptions documentationOptions = profile.GetSetting(DocumentationDescriptor);
            LayoutOptions layoutOptions = profile.GetSetting(LayoutDescriptor);
            MaintainabilityOptions maintainabilityOptions = profile.GetSetting(MaintainabilityDescriptor);
            OrderingOptions orderingOptions = profile.GetSetting(OrderingDescriptor);
            ReadabilityOptions readabilityOptions = profile.GetSetting(ReadabilityDescriptor);
            SpacingOptions spacingOptions = profile.GetSetting(SpacingDescriptor);

            // Process the file for all the different Code Cleanups we have here
            // we do them in a very specific order. Do not change it.
            new ReadabilityRules().Execute(readabilityOptions, file);
            new MaintainabilityRules().Execute(maintainabilityOptions, file);
            new DocumentationRules().Execute(documentationOptions, file);
            new LayoutRules().Execute(layoutOptions, file);
            new SpacingRules().Execute(spacingOptions, file);
            new OrderingRules().Execute(orderingOptions, file);

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:67,代码来源:StyleCopCodeCleanupModule.cs

示例7: InternalProcess

        /// <summary>
        /// Processes all the cleanup.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to clean.
        /// </param>
        /// <param name="file">
        /// The PSI file to clean.
        /// </param>
        private void InternalProcess(IProjectFile projectFile, ICSharpFile file)
        {
            // Process the file for all the different Code Cleanups we have here
            // we do them in a very specific order. Do not change it.
            Lifetimes.Using(
                lifetime =>
                    {
                        StyleCopApiPool apiPool = projectFile.GetSolution().GetComponent<StyleCopApiPool>();
                        Settings settings = apiPool.GetInstance(lifetime).Settings.GetSettings(projectFile);

                        ReadabilityRules.ExecuteAll(file, settings);
                        MaintainabilityRules.ExecuteAll(file, settings);
                        DocumentationRules.ExecuteAll(file, settings);
                        LayoutRules.ExecuteAll(file, settings);
                        SpacingRules.ExecuteAll(file, settings);
                        OrderingRules.ExecuteAll(file, settings);
                    });
        }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:27,代码来源:StyleCopCodeCleanupModule.cs

示例8: ProcessProjectItem

 public bool ProcessProjectItem(IProjectFile projectItem) {
     IFile psiFile = PsiManager.GetInstance(projectItem.GetSolution()).GetPsiFile(projectItem);
     return ((psiFile != null) && ProcessElement(psiFile));
 }
开发者ID:hazzik,项目名称:ReSharper.NHibernate,代码行数:4,代码来源:MappingFileReferenceSearcher.cs

示例9: GetRelatedFiles

        public IEnumerable<Tuple<IProjectFile, string, IProjectFile>> GetRelatedFiles(IProjectFile projectFile)
        {
            var typeNamesInFile = GetTypeNamesDefinedInFile(projectFile).ToList();

            var candidateTypeNames = GetTypeCandidates(typeNamesInFile);

            // Look for the candidate types in the solution.
            var solution = projectFile.GetSolution();
            var candidateTypes = new List<IClrDeclaredElement>();
            foreach (var candidateTypeName in candidateTypeNames)
            {
                var types = FindType(solution, candidateTypeName);
                candidateTypes.AddRange(types);
            }

            // Get the source files for each of the candidate types.
            var sourceFiles = new List<IPsiSourceFile>();
            foreach (var type in candidateTypes)
            {
                var sourceFilesForCandidateType = type.GetSourceFiles();
                sourceFiles.AddRange(sourceFilesForCandidateType);
            }

            var elementCollector = new RecursiveElementCollector<ITypeDeclaration>();
            foreach (var psiSourceFile in sourceFiles)
                foreach (var file in psiSourceFile.EnumerateDominantPsiFiles())
                    elementCollector.ProcessElement(file);

            var elements = elementCollector.GetResults();
            var projectFiles = elements.Select(declaration => declaration.GetSourceFile().ToProjectFile());

            var thisProjectName = projectFile.GetProject()?.Name;

            var rval = new List<Tuple<IProjectFile, string, IProjectFile>>();
            foreach (var file in projectFiles.OfType<ProjectFileImpl>().Distinct(pf => pf.Location.FullPath))
            {
                // Remove all extensions (e.g.: .xaml.cs).
                var fn = file.Name;
                var dotPos = fn.IndexOf('.');
                if (dotPos != -1)
                {
                    fn = fn.Substring(0, dotPos);
                }

                var display = fn.EndsWith("ViewModel") ? "ViewModel" : "View";

                var projectName = file.GetProject()?.Name;

                if (projectName != null &&
                    !string.Equals(thisProjectName, projectName, StringComparison.OrdinalIgnoreCase))
                {
                    display += $" (in {projectName})";
                }

                var tuple = Tuple.Create((IProjectFile)file, display, projectFile);

                rval.Add(tuple);
            }

            return rval;
        }
开发者ID:hmemcpy,项目名称:ReSharper.Xao,代码行数:61,代码来源:ViewModelRelatedFilesProvider.cs

示例10: VisitProjectFile

        public override void VisitProjectFile(IProjectFile projectFile)
        {
            if (currentIndicator.IsCanceled)
                throw new ProcessCancelledException();

            base.VisitProjectFile(projectFile);
            this.currentIndicator.CurrentItemText = ResourcesMessages.GetScanningFile(projectFile.Name);
            IFile file = PsiManager.GetInstance(projectFile.GetSolution()).GetPsiFile(projectFile);
            if (file != null)
            {
                new AllNonQualifiedReferencesResolver().ProcessFile(file);
                UnusedModulesProcessor processor = new UnusedModulesProcessor(candidates);
                file.ProcessDescendants(processor);
            }

            currentIndicator.Advance(1);
        }
开发者ID:willrawls,项目名称:arp,代码行数:17,代码来源:UnusedModulesProjectVisitor.cs

示例11: GetCSharpFile

        /// <summary>
        /// Gets the ICSharpFile for the given project File.
        /// </summary>
        /// <param name="projectFile">
        /// The projectFile to use.
        /// </param>
        /// <returns>
        /// An ICSharpFile for the projectFile.
        /// </returns>
        public static ICSharpFile GetCSharpFile(IProjectFile projectFile)
        {
            if (projectFile == null)
            {
                return null;
            }

            using (ReadLockCookie.Create())
            {
                PsiManager psiManager = PsiManager.GetInstance(projectFile.GetSolution());

                if (psiManager == null)
                {
                    return null;
                }

                return psiManager.GetPsiFile(projectFile, PsiLanguageType.GetByProjectFile(projectFile)) as ICSharpFile;
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:28,代码来源:Utils.cs

示例12: OpenTextControl

 protected ITextControl OpenTextControl(IProjectFile projectFile, int? caretOffset = null)
 {
     ITextControl openProjectFile = EditorManager.GetInstance(projectFile.GetSolution()).OpenProjectFile(projectFile, true);
     return openProjectFile;
 }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:5,代码来源:CSharpHighlightingWithinSolutionTestBase.cs


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