本文整理汇总了C#中IProjectFile.GetProject方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectFile.GetProject方法的具体用法?C# IProjectFile.GetProject怎么用?C# IProjectFile.GetProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjectFile
的用法示例。
在下文中一共展示了IProjectFile.GetProject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NBehaveUnitTestElementBase
protected NBehaveUnitTestElementBase(IProjectFile featureFile, IUnitTestProvider testProvider, string id, ProjectModelElementEnvoy pointer, NBehaveUnitTestElementBase parent)
{
FeatureFile = featureFile;
//FeatureFile = featureFile.Location.FullPath;
_project = featureFile.GetProject();
//ProjectFile = _project.Name;
_testProvider = testProvider;
_id = id;
_projectModel = pointer;
Parent = parent;
}
示例2: XunitFileExplorer
public XunitFileExplorer([NotNull] XunitElementFactory factory, [NotNull] ITreeNode file, [NotNull] SearchDomainFactory searchDomainFactory, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
{
if (factory == null)
throw new ArgumentNullException("factory");
if (searchDomainFactory == null)
throw new ArgumentNullException("searchDomainFactory");
if (file == null)
throw new ArgumentNullException("file");
this.factory = factory;
this.searchDomainFactory = searchDomainFactory;
this.consumer = consumer;
this.interrupted = interrupted;
projectFile = file.GetSourceFile().ToProjectFile();
if (projectFile != null) project = projectFile.GetProject();
envoy = ProjectModelElementEnvoy.Create(project);
}
示例3: GetNitraFile
public XXLanguageXXFile GetNitraFile(IProjectFile projectFile)
{
var project = projectFile.GetProject();
if (project == null)
return null;
XXLanguageXXProject nitraLangProject;
if (!_projectsMap.TryGetValue(project, out nitraLangProject))
return null;
return nitraLangProject.TryGetFile(projectFile);
}
示例4: OnFileChanged
private bool OnFileChanged(IProjectFile projectFile, DocumentChange documentChange)
{
var project = projectFile.GetProject();
if (project != null)
{
XXLanguageXXProject nitraProject;
if (_projectsMap.TryGetValue(project, out nitraProject))
{
var nitraFile = nitraProject.TryGetFile(projectFile);
if (nitraFile != null)
{
nitraFile.OnFileChanged(documentChange);
return true;
}
}
}
return false;
}
示例5: 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;
}