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


C# BuildContext.IsOutOfDate方法代码示例

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


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

示例1: Build


//.........这里部分代码省略.........
				Assembly.LoadFrom( a );
			}

			Log.Message("{0} assets found", assetsDesc.Count );


			//
			//	Gather asset types :
			//
			var types = Asset.GatherAssetTypes();
			Log.Message("{0} assets types found", types.Length );


			//
			//	Build content :
			//
			assets = assetsDesc
					.Select( a => a.CreateAsset( types ) )
					.ToList();

			//	reflect assets back to description :
			assetsDesc = assets
					.Select( a => new AssetDesc(a) )
					.ToList();


			HashSet<string> selectedNames = null;
			if ( selection!=null ) {
				selectedNames = new HashSet<string>( selection.Select( n => ContentUtils.GetHashedFileName( n, "") ) );
			}


			var buildContext	=	new BuildContext( sourceDirectory, tempDirectory, targetDirectory, this );

			//	check collisions :
			var collisions = GetHashCollisions(assets);

			if (collisions.Any()) {
				foreach (var coll in collisions) {
					Log.Error("  {0}", coll);
				}
				throw new ContentException("Hash collisions have been detected!");
			}


			//	build :
			foreach ( var asset in assets ) {

				if (selectedNames!=null) {
					if ( !selectedNames.Contains( asset.Hash ) ) {
						continue;
					}
				}

				try {
					
					if ( buildContext.IsOutOfDate( asset, forced ) ) {
						Log.Message("...building: {0}", asset.AssetPath );
						asset.Build( buildContext );
					}

					succeeded ++;

				} catch ( AggregateException ae ) {

					foreach ( var e in ae.InnerExceptions ) {

						Log.Error("{0}: {1}", asset.AssetPath, e.Message );

						/*errors.AppendFormat("{0}: {1}", asset.AssetPath, e.Message );
						errors.AppendFormat( "\r\n" );*/
					}

					failed++;

				} catch ( Exception e )	{

					Log.Error("{0}: {1}", asset.AssetPath, e.Message );

					/*errors.AppendFormat("{0}: {1}", asset.AssetPath, e.Message );
					errors.AppendFormat( "\r\n" );*/

					failed++;
				}
			}


			Log.Message("---------- Build: {0} succeeded, {1} failed ----------", succeeded, failed);

			//	get assembly dlls
			//	load assemblies	- warning on missing dlls
			//	assign asset list - warning/error on missing asset types
			//	gather asset types :
			//	build

			//var a = Assembly.LoadFrom( "q.dll" );
			//AppDomain.CurrentDomain.Add
			//AppDomain.CurrentDomain.Load( 
			return false;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:101,代码来源:ContentProject.cs


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