本文整理汇总了C#中Content.ExportFieldData方法的典型用法代码示例。如果您正苦于以下问题:C# Content.ExportFieldData方法的具体用法?C# Content.ExportFieldData怎么用?C# Content.ExportFieldData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content.ExportFieldData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportContent
private static void ExportContent(Content content, ExportContext context, string fsPath, string indent)
{
if (content.ContentHandler is ContentType)
{
LogWriteLine(indent, content.Name);
ExportContentType(content, context, indent);
return;
}
context.CurrentDirectory = fsPath;
LogWriteLine(indent, content.Name);
string metaFilePath = Path.Combine(fsPath, content.Name + ".Content");
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;
settings.Indent = true;
settings.IndentChars = " ";
XmlWriter writer = null;
try
{
writer = XmlWriter.Create(metaFilePath, settings);
//<?xml version="1.0" encoding="utf-8"?>
//<ContentMetaData>
// <ContentType>Site</ContentType>
// <Fields>
// ...
writer.WriteStartDocument();
writer.WriteStartElement("ContentMetaData");
writer.WriteElementString("ContentType", content.ContentType.Name);
writer.WriteElementString("ContentName", content.Name);
writer.WriteStartElement("Fields");
try
{
content.ExportFieldData(writer, context);
}
catch (Exception e)
{
PrintException(e, fsPath);
writer.WriteComment(String.Concat("EXPORT ERROR", CR, e.Message, CR, e.StackTrace));
}
writer.WriteEndElement();
writer.WriteStartElement("Permissions");
writer.WriteElementString("Clear", null);
content.ContentHandler.Security.ExportPermissions(writer);
writer.WriteEndElement();
writer.WriteEndElement();
}
finally
{
if (writer != null)
{
writer.Flush();
writer.Close();
}
}
}