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