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


C# Project.TryGetEvaluatedItemByNameBatched方法代码示例

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


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

示例1: ConvertToITaskItemArray

		public ITaskItem [] ConvertToITaskItemArray (Project project, ExpressionOptions options)
		{
			BuildItemGroup group;
			if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
				return group.ConvertToITaskItemArray (transform, separator, options);
			else
				return null;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:ItemReference.cs

示例2: ConvertToString

		// when evaluating property, allowItems=false, so,
		// ItemRef will _not_ get created, so this wont get hit
		// when evaluating items, expand: true
		// other cases, expand: true
		public string ConvertToString (Project project, ExpressionOptions options)
		{
			BuildItemGroup group;
			if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
				return group.ConvertToString (transform, separator, options);
			else
				return String.Empty;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:12,代码来源:ItemReference.cs

示例3: ConvertToITaskItemArray

		public ITaskItem [] ConvertToITaskItemArray (Project project, ExpressionOptions options)
		{
			List<ITaskItem> items = new List<ITaskItem> ();
			if (IsQualified) {
				// Bucket would have item lists with same metadata values,
				// so just get the value from the first item
				BuildItemGroup group;
				if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
					BuildItemGroupToITaskItems (group, items, true);
			} else {
				// Get unique metadata values from _all_ item lists
				foreach (BuildItemGroup group in project.GetAllItemGroups ())
					BuildItemGroupToITaskItems (group, items, false);
			}

			return items.Count == 0 ? null : items.ToArray ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:17,代码来源:MetadataReference.cs

示例4: ContainsItem

		bool ContainsItem (Project project, ITaskItem taskItem)
		{
			BuildItemGroup group;
			if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
				return false;

			var item = group.FindItem (taskItem);
			if (item == null)
				return false;

			foreach (string metadataName in evaluatedMetadata.Keys) {
				string metadataValue = (string)evaluatedMetadata [metadataName];
				if (!metadataValue.Equals (item.evaluatedMetadata [metadataName]))
					return false;
			}
			
			foreach (string metadataName in item.evaluatedMetadata.Keys) {
				string metadataValue = (string)item.evaluatedMetadata [metadataName];
				if (!metadataValue.Equals (evaluatedMetadata [metadataName]))
					return false;
			}

			return true;
		}
开发者ID:GirlD,项目名称:mono,代码行数:24,代码来源:BuildItem.cs

示例5: RemoveItems

		void RemoveItems (Project project)
		{
			BuildItemGroup group;
			if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
				return;

			var removeExpr = new Expression ();
			removeExpr.Parse (Remove, ParseOptions.AllowItemsNoMetadataAndSplit);

			var removes = (ITaskItem[]) removeExpr.ConvertTo (
				project, typeof (ITaskItem[]), ExpressionOptions.ExpandItemRefs);

			var directoryScanner = new DirectoryScanner ();
			
			directoryScanner.Includes = removes;

			if (project.FullFileName != String.Empty)
				directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (project.FullFileName));
			else
				directoryScanner.BaseDirectory = new DirectoryInfo (Directory.GetCurrentDirectory ());
			
			directoryScanner.Scan ();

			foreach (ITaskItem matchedItem in directoryScanner.MatchedItems) {
				group.RemoveItem (matchedItem);
			}
		}
开发者ID:GirlD,项目名称:mono,代码行数:27,代码来源:BuildItem.cs

示例6: UpdateMetadata

		void UpdateMetadata (Project project)
		{
			BuildItemGroup group;
			if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
				return;

			foreach (BuildItem item in group) {
				if (!item.CheckCondition (project))
					continue;
				
				foreach (string name in evaluatedMetadata.Keys) {
					item.SetMetadata (name, (string)evaluatedMetadata [name]);
				}

				AddAndRemoveMetadata (project, item);
			}
		}
开发者ID:GirlD,项目名称:mono,代码行数:17,代码来源:BuildItem.cs


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