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


C# IRenderer.GetType方法代码示例

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


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

示例1: RenderizableItemCoroutine

		public RenderizableItemCoroutine(IRenderer renderer, string relativePath, IPathProvider pathProvider, 
			IHttpContext context, Func<Exception, IHttpContext, bool> specialHandler, object model, 
			ModelStateDictionary modelStateDictionary, object viewBag)
		{
			InstanceName = "RenderItem(" + renderer.GetType().Namespace + "." + renderer.GetType().Name + "," + relativePath + ")";
			_renderer = renderer;
			_relativePath = relativePath;
			_pathProvider = pathProvider;
			_context = context;
			_specialHandler = specialHandler;
			_model = model;
			_modelStateDictionary = modelStateDictionary;
			_viewBag = viewBag;
		}
开发者ID:kendarorg,项目名称:Node.Cs.Old,代码行数:14,代码来源:RenderizableItemCoroutine.cs

示例2: Write

        /// <summary> </summary>
        private void Write(ClassMapping classMapping, IDictionary class2classmap, IRenderer renderer,bool checkIfNewer)
        {
            string saveToPackage = renderer.GetSaveToPackage(classMapping);
            string saveToClassName = renderer.GetSaveToClassName(classMapping);
            FileInfo dir = this.GetDir(saveToPackage);
            StreamWriter writer = null;
            // a render implementing this interface can
            // decide a stream for output, so a directive in the
            // generation code can drive the output naming...
            ICanProvideStream streamProvider = renderer as ICanProvideStream;
            string fileName=null;
            bool performGeneration = true;
            try
            {
                if (null == streamProvider)
                {
                    fileName = Path.Combine(dir.FullName, this.GetFileName(saveToClassName));
                    FileInfo file = new FileInfo(fileName);
                    if (checkIfNewer)
                    {
                        FileInfo sourceFileinfo = SourceFileInfoMap.Instance.LookupByMapping(classMapping);
                        performGeneration = sourceFileinfo.LastWriteTimeUtc >= file.LastWriteTimeUtc;
                        if (false == performGeneration)
                            LogFileSkipped(sourceFileinfo, file);
                    }
                    if (performGeneration)
                    {
                        log.Debug("Writing " + file);
                        writer = new StreamWriter(new FileStream(file.FullName, FileMode.Create));
                    }
                }
                else
                {
                    if (performGeneration)
                    {
                        if (checkIfNewer)
                        {
                            FileInfo sourceFileinfo = SourceFileInfoMap.Instance.LookupByMapping(classMapping);
                            FileInfo target;
                            performGeneration = streamProvider.CheckIfSourceIsNewer(sourceFileinfo.LastWriteTimeUtc, dir.FullName, classMapping, out target);
                            if (false == performGeneration)
                                LogFileSkipped(sourceFileinfo, target);

                        }
                        if (performGeneration)
                            writer = new StreamWriter(streamProvider.GetStream(classMapping, dir.FullName, out fileName));
                        log.Debug("Renderer:" + renderer.GetType().Name + " provided a stream for output.");
                    }
                }

                if (performGeneration)
                {
                    renderer.Render(GetPackageName(saveToPackage), GetName(saveToClassName), classMapping, class2classmap, writer);
                    writer.Close();
                    if (null != fileObserver)
                    {
                        fileObserver.FileCreated(fileName);
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("Error writing file:", e);
            }
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:66,代码来源:Generator.cs


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