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


C# BuildContext类代码示例

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


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

示例1: PostBelongsToBlog

		public void PostBelongsToBlog()
		{
			InitKernel();
			IRelationshipInferenceService relService = ObtainService();

			TableDefinition blogTable;
			TableDefinition postTable;

			BuildBlogPostsStructure(out blogTable, out postTable);

			BuildContext context = new BuildContext();

			ActiveRecordDescriptor arDesc = new ActiveRecordDescriptor();

			ActiveRecordPropertyDescriptor[] descs = relService.InferRelations( arDesc, postTable, context );

			Assert.IsNotNull(descs);
			Assert.AreEqual( 1, descs.Length );

			ActiveRecordBelongsToDescriptor desc1 = descs[0] as ActiveRecordBelongsToDescriptor;
			Assert.IsNotNull(desc1);
			Assert.IsNotNull(desc1.TargetType);
			Assert.IsNull(desc1.PropertyType);

			Assert.AreEqual( "Blog", desc1.PropertyName );
			Assert.AreEqual( "blog_id", desc1.ColumnName );

			ActiveRecordDescriptor targetARDescriptor = context.GetNextPendent();
			Assert.AreSame( blogTable, targetARDescriptor.Table );
		}
开发者ID:ralescano,项目名称:castle,代码行数:30,代码来源:RelationshipInferenceServiceTestCase.cs

示例2: IsApplied

		public override bool IsApplied(BuildContext context, AbstractTypeBuilderList builders)
		{
			if (_interceptorType == null && _interceptType == 0)
				return false;

			foreach (var builder in builders)
			{
				var interceptor = builder as InterceptorAspectBuilder;

				if (interceptor != null)
				{
					if (interceptor._interceptorType == null && interceptor._interceptType == 0)
						return false;

					if (builder == this)
						break;
				}
			}

			if (context.IsMethodOrProperty) switch (context.Step)
			{
				case BuildStep.Begin:   return true;
				case BuildStep.Before:  return (_interceptType & InterceptType.BeforeCall) != 0;
				case BuildStep.After:   return (_interceptType & InterceptType.AfterCall)  != 0;
				case BuildStep.Catch:   return (_interceptType & InterceptType.OnCatch)    != 0;
				case BuildStep.Finally: return (_interceptType & InterceptType.OnFinally)  != 0;
				case BuildStep.End:     return true;
			}

			return false;
		}
开发者ID:jmptrader,项目名称:bltoolkit,代码行数:31,代码来源:InterceptorAspectBuilder.cs

示例3: BuildStarting

        /// <summary>
        /// Called before the project's help build starts.
        /// </summary>
        /// <param name="context">Provides information about the build process.</param>
        public override void BuildStarting(BuildContext context)
        {
            // Uncomment the following line to break into the debugger: 
            // System.Diagnostics.Debugger.Break();

            buildStart = DateTime.Now;
        }
开发者ID:bobtjanitor,项目名称:bob-the-janitor-sample-code,代码行数:11,代码来源:BuildProcess.cs

示例4: SetStyle

        public void SetStyle(BuildContext context)
        {
            context.Cell.SetRowHeight(18);

            //context.Cell.SetColumnWidth(15);

            context.Cell.CellStyle = this.CenterStyle;
        }
开发者ID:dut3062796s,项目名称:ExcelHelper,代码行数:8,代码来源:HSSFWorkbookBuilder.cs

示例5: EmbedVirtualFile

 private static void EmbedVirtualFile(BuildContext context, string relativePath)
 {
     var file = new VirtualPackageFile(
         context.SourceFolder,
         context.SourcePath + relativePath,
         context.TargetPath + relativePath);
     context.Builder.Files.Add(file);
 }
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:8,代码来源:PackageBuilder.cs

示例6: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			using ( var sourceStream = assetFile.OpenSourceStream() ) {
				using ( var targetStream = assetFile.OpenTargetStream() ) {
					sourceStream.CopyTo( targetStream );
				}
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:13,代码来源:ScriptProcessor.cs

示例7: BuildClass

        private void BuildClass(
            DocumentMapping documentMapping, bool isRoot,
            string path, BuildContext context
            )
        {
            IList<System.Type> hierarchy = new List<System.Type>();
            System.Type currClass = documentMapping.MappedClass;

            do {
                hierarchy.Add(currClass);
                currClass = currClass.BaseType;
                // NB Java stops at null we stop at object otherwise we process the class twice
                // We also need a null test for things like ISet which have no base class/interface
            } while (currClass != null && currClass != typeof(object));

            for (int index = hierarchy.Count - 1; index >= 0; index--)
            {
                currClass = hierarchy[index];
                /**
                 * Override the default analyzer for the properties if the class hold one
                 * That's the reason we go down the hierarchy
                 */

                // NB Must cast here as we want to look at the type's metadata
                var localAnalyzer = GetAnalyzer(currClass);
                var analyzer = documentMapping.Analyzer ?? localAnalyzer;

                // Check for any ClassBridges
                var classBridgeAttributes = AttributeUtil.GetAttributes<ClassBridgeAttribute>(currClass);
                AttributeUtil.GetClassBridgeParameters(currClass, classBridgeAttributes);

                // Now we can process the class bridges
                foreach (var classBridgeAttribute in classBridgeAttributes)
                {
                    var bridge = BuildClassBridge(classBridgeAttribute, analyzer);
                    documentMapping.ClassBridges.Add(bridge);
                }

                // NB As we are walking the hierarchy only retrieve items at this level
                var propertyInfos = currClass.GetProperties(
                    BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance
                );
                foreach (var propertyInfo in propertyInfos)
                {
                    BuildProperty(documentMapping, propertyInfo, analyzer, isRoot, path, context);
                }

                var fields = currClass.GetFields(
                    BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance
                );
                foreach (var fieldInfo in fields)
                {
                    BuildProperty(documentMapping, fieldInfo, analyzer, isRoot, path, context);
                }
            }
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:56,代码来源:AttributeSearchMappingBuilder.cs

示例8: 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

示例9: Build

		public override void Build ( BuildContext buildContext )
		{
			var src	=	buildContext.Resolve( SourceFile );
			var dst	=	buildContext.GetTempFileName( Hash, ".dds" );

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

			using ( var target = buildContext.OpenTargetStream( this ) ) {
				buildContext.CopyTo( dst, target );
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:11,代码来源:ImageFileTextureAsset.cs

示例10: Compile

        public override void Compile(ICompileContext context, IProjectItem projectItem)
        {
            var item = projectItem as Item;
            Assert.Cast(item, nameof(item));

            var fileName = item.GetValue<string>(LayoutPage)?.Trim() ?? string.Empty;
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            var property = item.GetProperty<string>(LayoutPage);

            // find page html file
            var rendering = item.Project.Files.FirstOrDefault(i => string.Equals(i.FilePath, fileName, StringComparison.OrdinalIgnoreCase));
            if (rendering == null)
            {
                context.Trace.TraceError(Msg.C1047, Texts.Rendering_reference_not_found, TraceHelper.GetTextNode(property), fileName);
            }

            // find MvcLayout
            var layoutItem = item.Project.ProjectItems.OfType<Item>().FirstOrDefault(i => i.ItemIdOrPath == "/sitecore/layout/Layouts/MvcLayout");
            if (layoutItem == null)
            {
                context.Trace.TraceError(Msg.C1048, Texts.Layout_reference_not_found, TraceHelper.GetTextNode(property), "/sitecore/layout/Layouts/MvcLayout");
            }

            if (rendering == null || layoutItem == null)
            {
                return;
            }

            var sourceFile = rendering.Snapshots.First().SourceFile;

            var writer = new StringWriter();
            var output = new XmlTextWriter(writer);
            output.Formatting = Formatting.Indented;

            var buildContext = new BuildContext(context, sourceFile, output, item, layoutItem);

            var literalRendering = FindRendering(buildContext, "Literal", string.Empty, TextSpan.Empty);
            if (literalRendering == null)
            {
                return;
            }

            buildContext.Placeholder = layoutItem["Place Holders"];
            buildContext.LiteralRendering = literalRendering;

            ParseHtml(buildContext);

            SetRenderingsField(buildContext, buildContext.Item, writer.ToString());
        }
开发者ID:pveller,项目名称:Sitecore.Pathfinder,代码行数:53,代码来源:PageHtmlPropertyCompiler.cs

示例11: 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

示例12: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sourceStream"></param>
		/// <param name="targetStream"></param>
		public override void Process ( AssetSource assetFile, BuildContext context )
		{
			var mtrl	=	BaseIllum.ImportFromXml ( File.ReadAllText(assetFile.FullSourcePath) );

			//	get dependencies :
			var deps	=	mtrl.GetDependencies().ToArray();

			var file	=	BaseIllum.ExportToXml(mtrl);

			using ( var target = assetFile.OpenTargetStream(deps) ) {
				using ( var bw = new BinaryWriter(target) ) {
					bw.Write(file);
				}
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:20,代码来源:MaterialProcessor.cs

示例13: EmbedFiles

 private static void EmbedFiles(BuildContext context)
 {
     var basePath = context.SourcePath;
     foreach (var virtualPath in context.SourceFolder.ListFiles(context.SourcePath, true))
     {
         // skip ignores files
         if (IgnoreFile(virtualPath))
         {
             continue;
         }
         // full virtual path given but we need the relative path so it can be put into
         // the package that way (the package itself is the logical base path).
         // Get it by stripping the basePath off including the slash.
         var relativePath = virtualPath.Replace(basePath, "");
         EmbedVirtualFile(context, relativePath);
     }
 }
开发者ID:toannguyen241994,项目名称:SmartStoreNET,代码行数:17,代码来源:PackageBuilder.cs

示例14: Package

		public override Dictionary<string, FileOutput> Package(
			BuildContext buildContext,
			string projectId,
			Dictionary<string, ParseTree.Executable[]> finalCode,
			List<string> filesToCopyOver,
			ICollection<ParseTree.StructDefinition> structDefinitions,
			string inputFolder,
			SpriteSheetBuilder spriteSheet)
		{
			Dictionary<string, FileOutput> output = new Dictionary<string, FileOutput>();
			List<string> concatenatedCode = new List<string>();
			Dictionary<string, string> replacements = new Dictionary<string, string>()
			{
				{ "PROJECT_ID", projectId },
			};

			concatenatedCode.Add(this.GetPyGameCode("Header.py", replacements));
			concatenatedCode.Add(this.Translator.NL);
			concatenatedCode.Add(this.GetPyGameCode("AsyncHttpFetcher.py", replacements));
			concatenatedCode.Add(this.Translator.NL);
			this.Translator.TranslateGlobals(concatenatedCode, finalCode);
			concatenatedCode.Add(this.Translator.NL);
			this.Translator.TranslateSwitchLookups(concatenatedCode, finalCode);
			concatenatedCode.Add(this.Translator.NL);
			this.Translator.TranslateFunctions(concatenatedCode, finalCode);
			concatenatedCode.Add(this.Translator.NL);
			concatenatedCode.Add(this.GetPyGameCode("Footer.py", replacements));
			concatenatedCode.Add(this.Translator.NL);

			output["game.py"] = new FileOutput()
			{
				Type = FileOutputType.Text,
				TextContent = string.Join("", concatenatedCode)
			};

			foreach (string file in filesToCopyOver)
			{
				output[file] = new FileOutput()
				{
					Type = FileOutputType.Copy,
					RelativeInputPath = file,
				};
			}

			return output;
		}
开发者ID:geofrey,项目名称:crayon,代码行数:46,代码来源:PythonPlatform.cs

示例15: Build

        /// <summary>
        /// Builds asset
        /// </summary>
        /// <param name="buildContext"></param>
        public override void Build( BuildContext buildContext )
        {
            string tempFileName		= buildContext.GetTempFileName( AssetPath, ".fnt", false );
            string tempFileNameR	= buildContext.GetTempFileName( AssetPath, ".fnt", true );
            string resolvedPath		= buildContext.Resolve( SourcePath );

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

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

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

            //	patch font description and add children (e.g. "secondary") content :
            foreach (var p in font.Pages) {

                var newAssetPath	=	Path.Combine( AssetPath, "Page#" + p.ID.ToString() );
                var newSrcPath		=	Path.Combine( Path.GetDirectoryName(tempFileName), p.File );

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

                    var asset			=	buildContext.AddAsset<RawFileAsset>( newAssetPath );
                    asset.SourceFile	=	newSrcPath;
                    asset.BuildOrder	=	BuildOrder + 1;

                } else {

                    var asset			=	buildContext.AddAsset<ImageFileTextureAsset>( newAssetPath );
                    asset.SourceFile	=	newSrcPath;
                    asset.BuildOrder	=	BuildOrder + 1;
                }

                p.File	=	newAssetPath;
            }

            using ( var stream = buildContext.TargetStream( this ) ) {
                SpriteFont.FontLoader.Save( stream, font );
            }
        }
开发者ID:temik911,项目名称:audio,代码行数:50,代码来源:BMFontSpriteFontAsset.cs


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