本文整理汇总了C#中IRenderer.GetSaveToClassName方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.GetSaveToClassName方法的具体用法?C# IRenderer.GetSaveToClassName怎么用?C# IRenderer.GetSaveToClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.GetSaveToClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: Write
/// <summary> </summary>
private void Write(ClassMapping classMapping, IDictionary class2classmap, IRenderer renderer)
{
string saveToPackage = renderer.GetSaveToPackage(classMapping);
string saveToClassName = renderer.GetSaveToClassName(classMapping);
FileInfo dir = this.GetDir(saveToPackage);
FileInfo file = new FileInfo(Path.Combine(dir.FullName, this.GetFileName(saveToClassName)));
log.Debug("Writing " + file);
StreamWriter writer = new StreamWriter(new FileStream(file.FullName, FileMode.Create));
renderer.Render(GetPackageName(saveToPackage), GetName(saveToClassName), classMapping, class2classmap, writer);
writer.Close();
}