本文整理汇总了C#中IProjectContent.ThreadSafeGetReferencedContents方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectContent.ThreadSafeGetReferencedContents方法的具体用法?C# IProjectContent.ThreadSafeGetReferencedContents怎么用?C# IProjectContent.ThreadSafeGetReferencedContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjectContent
的用法示例。
在下文中一共展示了IProjectContent.ThreadSafeGetReferencedContents方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAssemblyInProjectReferences
Assembly FindAssemblyInProjectReferences(IProjectContent pc, string name)
{
foreach (IProjectContent referencedProjectContent in pc.ThreadSafeGetReferencedContents()) {
if (name == referencedProjectContent.AssemblyName) {
return this.typeResolutionService.LoadAssembly(referencedProjectContent);
}
}
return null;
}
示例2: FindType
public static IReturnType FindType(IProjectContent pc, string xmlNamespace, string className)
{
if (pc == null)
throw new ArgumentNullException("pc");
if (xmlNamespace == null || className == null)
return null;
if (xmlNamespace.StartsWith("clr-namespace:", StringComparison.OrdinalIgnoreCase)) {
return CreateClrNamespaceType(pc, xmlNamespace, className);
}
else {
IReturnType type = FindTypeInAssembly(pc, xmlNamespace, className);
if (type != null)
return type;
foreach (IProjectContent p in pc.ThreadSafeGetReferencedContents()) {
type = FindTypeInAssembly(p, xmlNamespace, className);
if (type != null)
return type;
}
return null;
}
}
示例3: GetNamespaceMembers
public static IEnumerable<IClass> GetNamespaceMembers(IProjectContent pc, string xmlNamespace)
{
if (pc == null)
throw new ArgumentNullException("pc");
if (!string.IsNullOrEmpty(xmlNamespace)) {
if (xmlNamespace.StartsWith("clr-namespace:", StringComparison.OrdinalIgnoreCase))
return pc.GetNamespaceContents(GetNamespaceNameFromClrNamespace(xmlNamespace)).OfType<IClass>();
else {
var list = new List<ICompletionEntry>();
AddNamespaceMembersInAssembly(pc, xmlNamespace, list);
foreach (IProjectContent p in pc.ThreadSafeGetReferencedContents()) {
AddNamespaceMembersInAssembly(p, xmlNamespace, list);
}
return list.OfType<IClass>();
}
}
return Enumerable.Empty<IClass>();
}
示例4: LoadAssembly
/// <summary>
/// Loads the assembly represented by the project content. Returns null on failure.
/// </summary>
public Assembly LoadAssembly(IProjectContent pc)
{
WorkbenchSingleton.AssertMainThread();
// prevent StackOverflow when project contents have cyclic dependencies
// Very popular example of cyclic dependency: System <-> System.Xml
if (!projectContentsCurrentlyLoadingAssembly.Add(pc))
return null;
Assembly sdAssembly;
if (IsSharpDevelopAssembly(pc, out sdAssembly))
return sdAssembly;
try {
// load dependencies of current assembly
foreach (IProjectContent rpc in pc.ThreadSafeGetReferencedContents()) {
if (rpc is ParseProjectContent) {
LoadAssembly(rpc);
} else if (rpc is ReflectionProjectContent) {
ReflectionProjectContent rrpc = (ReflectionProjectContent)rpc;
if (!rrpc.IsGacAssembly) {
LoadAssembly(rpc);
}
}
}
} finally {
projectContentsCurrentlyLoadingAssembly.Remove(pc);
}
if (pc.Project != null) {
return LoadAssembly(((IProject)pc.Project).OutputAssemblyFullPath);
} else if (pc is ReflectionProjectContent) {
ReflectionProjectContent rpc = (ReflectionProjectContent)pc;
if (rpc.IsGacAssembly)
return LoadAssembly(new AssemblyName(rpc.AssemblyFullName), false);
else
return LoadAssembly(rpc.AssemblyLocation);
} else {
return null;
}
}
示例5: CreateListForXmlnsCompletion
public static IEnumerable<ICompletionItem> CreateListForXmlnsCompletion(IProjectContent projectContent)
{
List<XmlnsCompletionItem> list = new List<XmlnsCompletionItem>();
foreach (IProjectContent content in projectContent.ThreadSafeGetReferencedContents()) {
foreach (IAttribute att in content.GetAssemblyAttributes()) {
if (att.PositionalArguments.Count == 2
&& att.AttributeType.FullyQualifiedName == "System.Windows.Markup.XmlnsDefinitionAttribute") {
list.Add(new XmlnsCompletionItem(att.PositionalArguments[0] as string, true));
}
}
foreach (string @namespace in content.NamespaceNames) {
if (!string.IsNullOrEmpty(@namespace))
list.Add(new XmlnsCompletionItem(@namespace, content.AssemblyName));
}
}
foreach (string @namespace in projectContent.NamespaceNames) {
if (!string.IsNullOrEmpty(@namespace))
list.Add(new XmlnsCompletionItem(@namespace, false));
}
list.Add(new XmlnsCompletionItem(MarkupCompatibilityNamespace, true));
return list
.Distinct(new XmlnsEqualityComparer())
.OrderBy(item => item, new XmlnsComparer());
}
示例6: Search
public string Search(UnknownIdentifierResolveResult rr, IProjectContent pc, List<IClass> results)
{
SearchAttributesWithName(results, pc, rr.Identifier);
foreach (IProjectContent content in pc.ThreadSafeGetReferencedContents())
SearchAttributesWithName(results, content, rr.Identifier);
return rr.Identifier;
}