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


C# BuildContext.CopyFileTo方法代码示例

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


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

示例1: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			string tempFileName		= context.GetTempFileName( assetFile.KeyPath, ".fnt" );
			string resolvedPath		= assetFile.FullSourcePath;	

			//	Launch 'bmfont.com' with temporary output file :
			context.RunTool( @"bmfont.com",  string.Format("-c \"{0}\" -o \"{1}\"", resolvedPath, tempFileName ) );


			//	load temporary output :
			SpriteFont.FontFile font;
			using ( var stream = File.OpenRead( tempFileName ) ) {
				font = SpriteFont.FontLoader.Load( stream );
			}


			//	perform some checks :
			if (font.Common.Pages!=1) {
				throw new BuildException("Only one page of font image is supported");
			}


			//	patch font description and add children (e.g. "secondary") content :
			using ( var stream = assetFile.OpenTargetStream() ) {

				using ( var sw = new BinaryWriter( stream ) ) {

					var xml = SpriteFont.FontLoader.SaveToString( font );

					sw.Write( xml );

					//	write pages :
					foreach (var p in font.Pages) {

						var pageFile	=	Path.Combine( Path.GetDirectoryName( tempFileName ), p.File );

						if ( Path.GetExtension( pageFile ).ToLower() == ".dds" ) {

							context.CopyFileTo( pageFile, sw );

						} else {

							TextureProcessor.RunNVCompress( context, pageFile, pageFile + ".dds", true, false, false, true, true, false, TextureProcessor.TextureCompression.RGB );

							context.CopyFileTo( pageFile + ".dds", sw );

						}
					}
				}
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:56,代码来源:FontProcessor.cs

示例2: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			var src	=	assetFile.FullSourcePath;
			var dst	=	context.GetTempFileName( assetFile.KeyPath, ".dds" );

			RunNVCompress( context, src, dst, NoMips, Fast, ToNormal, Color, Alpha, Normal, Compression );

			using ( var target = assetFile.OpenTargetStream() ) {
				context.CopyFileTo( dst, target );
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:16,代码来源:TextureProcessor.cs

示例3: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			var resolvedPath	=	assetFile.FullSourcePath;
			var destPath		=	context.GetTempFileName( assetFile.KeyPath, ".scene" );

			var cmdLine			=	string.Format("\"{0}\" /out:\"{1}\" /base:\"{2}\" /merge:{3} {4} {5} {6} {7}", 
				resolvedPath, 
				destPath, 
				assetFile.BaseDirectory,
				MergeTolerance, 
				ImportAnimation ? "/anim":"", 
				ImportGeometry ? "/geom":"", 
				OutputReport ? "/report":"" ,
				GenerateMissingMaterials ? "/genmtrl":""
			);

			context.RunTool( "FScene.exe", cmdLine );

			using ( var target = assetFile.OpenTargetStream() ) {
				context.CopyFileTo( destPath, target );
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:27,代码来源:SceneProcessor.cs


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