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


C# IFile.GetSourceFile方法代码示例

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


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

示例1: ExploreFile

 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     if ((psiFile.Language.Is<JavaScriptLanguage>() && !psiFile.Language.Is<JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null))
     {
         psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile())));
     }
 }
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:7,代码来源:JasmineTestFileExplorer.cs

示例2: AcceptElement

    public IEnumerable<UnitTestElementDisposition> AcceptElement(IElement element, IFile file)
#endif
    {
      IDeclaration declaration = (IDeclaration)element;
      var behaviorElement = _behaviorFactory.CreateBehavior(declaration.DeclaredElement);
      
      if (behaviorElement == null)
      {
        yield break;
      }

      yield return new UnitTestElementDisposition(behaviorElement,
#if RESHARPER_6
                                                  file.GetSourceFile().ToProjectFile(),
#else
                                                  file.ProjectFile,
#endif
                                                  declaration.GetNavigationRange().TextRange,
                                                  declaration.GetDocumentRange().TextRange);

      var behaviorSpecifications =
        _behaviorSpecificationFactory.CreateBehaviorSpecificationsFromBehavior(behaviorElement,
                                                                               declaration.DeclaredElement);

      foreach (var behaviorSpecificationElement in behaviorSpecifications)
      {
        yield return new UnitTestElementDisposition(new UnitTestElementLocation[0],
                                                    behaviorSpecificationElement);
      }
    }
开发者ID:hhariri,项目名称:machine.specifications,代码行数:30,代码来源:BehaviorElementHandler.cs

示例3: ExploreFile

        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC")
                return;

            psiFile.ProcessDescendants(new XunitFileExplorer(provider, psiFile.GetSourceFile().ToProjectFile(), consumer, interrupted));
        }
开发者ID:Eskat0n,项目名称:ReSharper.XUnitTestRunner,代码行数:7,代码来源:XUnitTestFileExplorer.cs

示例4: FileExplorer

    public FileExplorer(MSpecUnitTestProvider provider,
                        ElementFactories factories,
                        IFile file,
                        UnitTestElementLocationConsumer consumer,
                        Func<bool> interrupted)
    {
      if (file == null)
      {
        throw new ArgumentNullException("file");
      }

      if (provider == null)
      {
        throw new ArgumentNullException("provider");
      }

      _consumer = consumer;
      _file = file;
      _interrupted = interrupted;

      var project = file.GetSourceFile().ToProjectFile().GetProject();
        
#if !RESHARPER_8
      _assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;
#else
      _assemblyPath = project.GetOutputFilePath().FullPath;
#endif

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(factories),
                           new ContextSpecificationElementHandler(factories),
                           new BehaviorElementHandler(factories)
                         };
    }
开发者ID:hennys,项目名称:machine.specifications,代码行数:35,代码来源:FileExplorer.cs

示例5: FileExplorer

        public FileExplorer(MSpecUnitTestProvider provider,
                            ElementFactories factories,
                            IFile file,
                            IUnitTestElementsObserver consumer,
                            Func<bool> interrupted)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this._consumer = consumer;
            this._file = file;
            this._interrupted = interrupted;

            var project = file.GetSourceFile().ToProjectFile().GetProject();

            this._assemblyPath = project.GetOutputFilePath().FullPath;

            this._elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(factories),
                           new ContextSpecificationElementHandler(factories),
                           new BehaviorElementHandler(factories)
                         };
        }
开发者ID:JAllman,项目名称:machine.specifications.runner.resharper,代码行数:31,代码来源:FileExplorer.cs

示例6: AcceptElement

		public IEnumerable<UnitTestElementDisposition> AcceptElement(IElement element, IFile file)
#endif
		{
			IDeclaration declaration = (IDeclaration)element;
			var contextSpecificationElement =
			  _contextSpecificationFactory.CreateContextSpecification(declaration.DeclaredElement);

			if (contextSpecificationElement == null)
			{
				yield break;
			}

			yield return new UnitTestElementDisposition(contextSpecificationElement,
#if RESHARPER_6
			resharper::JetBrains.ReSharper.Psi.PsiSourceFileExtensions.ToProjectFile(file.GetSourceFile()),
#else
 file.ProjectFile,
#endif
 declaration.GetNavigationRange().TextRange,
#if RESHARPER_6
		resharper::JetBrains.ReSharper.Psi.Tree.DeclarationExtensions.GetNameDocumentRange(declaration).TextRange);
#else
		ElementExtensions.GetDocumentRange(declaration).TextRange);
#endif
		}
开发者ID:simonlaroche,项目名称:Simple.Testing,代码行数:25,代码来源:ContextSpecificationElementHandler.cs

示例7: ExploreFile

 public void ExploreFile(IFile psiFile, IUnitTestElementsObserver observer, Func<bool> interrupted)
 {
     if (psiFile.GetProject().IsSilverlight())
     {
         if (!string.Equals(psiFile.Language.Name, "CSHARP", StringComparison.Ordinal) && !string.Equals(psiFile.Language.Name, "VBASIC", StringComparison.Ordinal) || psiFile.GetSourceFile().ToProjectFile() == null)
             return;
         this.RunWithElementFactory(elementFactory => psiFile.ProcessDescendants(new MsTestFileExplorer(elementFactory, this.msTestAttributesProvider, observer, psiFile, interrupted)));
     }
 }
开发者ID:icnocop,项目名称:AgUnit,代码行数:9,代码来源:SilverlightElementsSource.cs

示例8: FileExplorer

    public FileExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
                        IUnitTestElementManager manager,
                        PsiModuleManager psiModuleManager,
                        CacheManager cacheManager,
#endif
                        UnitTestElementLocationConsumer consumer,
                        IFile file,
                        CheckForInterrupt interrupted)
    {
      if (file == null)
      {
        throw new ArgumentNullException("file");
      }

      if (provider == null)
      {
        throw new ArgumentNullException("provider");
      }

      _consumer = consumer;
      _file = file;
      _interrupted = interrupted;

#if RESHARPER_6
      IProject project = file.GetSourceFile().ToProjectFile().GetProject();
#else
      IProject project = file.ProjectFile.GetProject();
#endif
      var projectEnvoy = new ProjectModelElementEnvoy(project);
      string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;

      var cache = new ContextCache();


#if RESHARPER_61
      var contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, assemblyPath, cache);
      var contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
      var behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
      var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
      var contextFactory = new ContextFactory(provider, project, projectEnvoy, assemblyPath, cache);
      var contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
      var behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache);
      var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(contextFactory),
                           new ContextSpecificationElementHandler(contextSpecificationFactory),
                           new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory)
                         };
    }
开发者ID:jhollingworth,项目名称:machine.specifications,代码行数:54,代码来源:FileExplorer.cs

示例9: AcceptElement

        public IEnumerable<UnitTestElementDisposition> AcceptElement(string assemblyPath, IFile file, ITreeNode element)
        {
            var declaration = (IDeclaration)element;
            var context = this._factory.CreateContext(assemblyPath, declaration);

            if (context == null)
            {
                yield break;
            }

            yield return new UnitTestElementDisposition(context,
                                                        file.GetSourceFile().ToProjectFile(),
                                                        declaration.GetNavigationRange().TextRange,
                                                        declaration.GetDocumentRange().TextRange);
        }
开发者ID:JAllman,项目名称:machine.specifications.runner.resharper,代码行数:15,代码来源:ContextElementHandler.cs

示例10: AcceptElement

    public IEnumerable<UnitTestElementDisposition> AcceptElement(ITreeNode element, IFile file)
    {
      IDeclaration declaration = (IDeclaration)element;
      var contextElement = _contextFactory.CreateContext((ITypeElement)declaration.DeclaredElement);

      if (contextElement == null)
      {
        yield break;
      }

      yield return new UnitTestElementDisposition(contextElement,
                                                  file.GetSourceFile().ToProjectFile(),
                                                  declaration.GetNavigationRange().TextRange,
                                                  declaration.GetDocumentRange().TextRange);
    }
开发者ID:jleo3,项目名称:machine.specifications,代码行数:15,代码来源:ContextElementHandler.cs

示例11: ProcessFile

        private void ProcessFile(IFile psiFile, DefaultHighlightingConsumer consumer)
        {
            foreach (var declaration in psiFile.ThisAndDescendants<ITypeDeclaration>())
            {
                if (declaration.DeclaredElement == null) // type is not (yet) declared
                {
                    return;
                }

                RegistrationInfo registrationInfo = patternManager.GetRegistrationsForFile(psiFile.GetSourceFile()).
                                                                   FirstOrDefault(c => c.Registration.IsSatisfiedBy(declaration.DeclaredElement));
                if (registrationInfo != null)
                {
                    consumer.AddHighlighting(new RegisteredByContainerHighlighting(registrationInfo), declaration.GetNameDocumentRange(), psiFile);
                }
            }
        }
开发者ID:hmemcpy,项目名称:AgentMulder,代码行数:17,代码来源:ContainerRegistrationAnalysisStageProcess.cs

示例12: AcceptElement

    public IEnumerable<UnitTestElementDisposition> AcceptElement(string assemblyPath, IFile file, ITreeNode element)
    {
      var declaration = (IDeclaration) element;
      var behavior = _factory.CreateBehavior(declaration.DeclaredElement);

      if (behavior == null)
      {
        yield break;
      }

      yield return new UnitTestElementDisposition(behavior,
                                                  file.GetSourceFile().ToProjectFile(),
                                                  declaration.GetNavigationRange().TextRange,
                                                  declaration.GetDocumentRange().TextRange);

      var behaviorContainer = declaration.DeclaredElement.GetFirstGenericArgument();
      if (!behaviorContainer.IsBehaviorContainer())
      {
        yield break;
      }

      foreach (var field in behaviorContainer.Fields)
      {
        if (!field.IsSpecification())
        {
          continue;
        }

        var behaviorSpecification = _behaviorSpecifications.CreateBehaviorSpecification(behavior, field);

        var projectFile = GetProjectFile(field);
        if (projectFile != null)
        {
          yield return new UnitTestElementDisposition(behaviorSpecification,
                                                      projectFile,
                                                      new TextRange(),
                                                      GetTextRange(field));
        }
        else
        {
          yield return new UnitTestElementDisposition(new UnitTestElementLocation[] {}, behaviorSpecification);
        }
      }
    }
开发者ID:hennys,项目名称:machine.specifications,代码行数:44,代码来源:BehaviorElementHandler.cs

示例13: JasmineFileExplorer

        public JasmineFileExplorer(JasmineElementFactory factory, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted, IEnumerable<IPsiSourceFile> referencedFiles)
        {
            _factory = factory;
            _consumer = consumer;
            _file = file;
            _interrupted = interrupted;

            _referencedFiles = (referencedFiles != null) ? (from f in referencedFiles
                where f.PrimaryPsiLanguage.IsExactly<JavaScriptLanguage>()
                select f.GetLocation().FullPath).ToArray<string>() : EmptyArray<string>.Instance;

            var element = file.GetSourceFile().ToProjectFile();
            if (element != null)
            {
                _filename = element.Location.FullPath;
            }

            _project = _file.GetProject();
            _projectFileEnvoy = ProjectModelElementEnvoy.Create(element);
        }
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:20,代码来源:JasmineFileExplorer.cs

示例14: AcceptElement

    public IEnumerable<UnitTestElementDisposition> AcceptElement(IElement element, IFile file)
#endif 
    {
      IDeclaration declaration = (IDeclaration)element;
      var contextSpecificationElement =
        _contextSpecificationFactory.CreateContextSpecification(declaration.DeclaredElement);

      if (contextSpecificationElement == null)
      {
        yield break;
      }

      yield return new UnitTestElementDisposition(contextSpecificationElement,
#if RESHARPER_6
                                                  file.GetSourceFile().ToProjectFile(),
#else
                                                  file.ProjectFile,
#endif
                                                  declaration.GetNavigationRange().TextRange,
                                                  declaration.GetDocumentRange().TextRange);
    }
开发者ID:jhollingworth,项目名称:machine.specifications,代码行数:21,代码来源:ContextSpecificationElementHandler.cs

示例15: AcceptElement

    public IEnumerable<UnitTestElementDisposition> AcceptElement(ITreeNode element, IFile file)
    {
      var declaration = (IDeclaration) element;
      var behavior = _factory.CreateBehavior(declaration.DeclaredElement);

      if (behavior == null)
      {
        yield break;
      }

      yield return new UnitTestElementDisposition(behavior,
                                                  file.GetSourceFile().ToProjectFile(),
                                                  declaration.GetNavigationRange().TextRange,
                                                  declaration.GetDocumentRange().TextRange);

      var behaviorContainer = declaration.DeclaredElement.GetFirstGenericArgument();
      if (!behaviorContainer.IsBehaviorContainer())
      {
        yield break;
      }

      foreach (var field in behaviorContainer.Fields)
      {
        if (!field.IsSpecification())
        {
          continue;
        }

        var behaviorSpecification = _behaviorSpecifications.CreateBehaviorSpecification(behavior, field);

        yield return new UnitTestElementDisposition(behaviorSpecification,
                                                    field.GetSourceFiles()[0].ToProjectFile(),
                                                    new TextRange(),
                                                    field.GetDeclarations()[0].GetDocumentRange().TextRange);
      }
    }
开发者ID:ptomasroos,项目名称:machine.specifications,代码行数:36,代码来源:BehaviorElementHandler.cs


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