本文整理汇总了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())));
}
}
示例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);
}
}
示例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));
}
示例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)
};
}
示例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)
};
}
示例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
}
示例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)));
}
}
示例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)
};
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}