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


C# IProjectContent.ThreadSafeGetReferencedContents方法代码示例

本文整理汇总了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;
		}
开发者ID:netide,项目名称:SharpDevelop,代码行数:9,代码来源:MyTypeFinder.cs

示例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;
			}
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:21,代码来源:XamlCompilationUnit.cs

示例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>();
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:20,代码来源:XamlCompilationUnit.cs

示例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;
			}
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:43,代码来源:TypeResolutionService.cs

示例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());
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:29,代码来源:CompletionDataHelper.cs

示例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;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:7,代码来源:AddUsing.cs


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