本文整理汇总了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 );
}
}
}
}
}
示例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 );
}
}
示例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 );
}
}