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


C# Template.ToXml方法代码示例

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


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

示例1: SaveToDisk

 public static void SaveToDisk(Template item)
 {
     if (item != null)
     {
         try
         {
             XmlDocument xmlDoc = helpers.XmlDoc.CreateDoc();
             xmlDoc.AppendChild(item.ToXml(xmlDoc));
             helpers.XmlDoc.SaveXmlDoc(
                 item.GetType().ToString(), GetDocPath(item) , "def", xmlDoc);
         }
         catch (Exception ex)
         {
             helpers.uSyncLog.ErrorLog(ex, "uSync: Error Saving Template {0} - {1}", item.Text, ex.ToString());
         }
     }
 }
开发者ID:howej,项目名称:jumps.umbraco.usync,代码行数:17,代码来源:SyncTemplate.cs

示例2: Publish

        public void Publish() {

            CreatedPackage package = this;
            PackageInstance pack = package.Data;

			try
			{

				PublishEventArgs e = new PublishEventArgs();
				package.FireBeforePublish(e);

				if (!e.Cancel)
				{
					int outInt = 0;

					//Path checking...
					string localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder);

					if (!System.IO.Directory.Exists(localPath))
						System.IO.Directory.CreateDirectory(localPath);

					//Init package file...
					createPackageManifest();
					//Info section..
					appendElement(utill.PackageInfo(pack, _packageManifest));

					//Documents...
					int _contentNodeID = 0;
					if (!String.IsNullOrEmpty(pack.ContentNodeId) && int.TryParse(pack.ContentNodeId, out _contentNodeID))
					{
						XmlNode documents = _packageManifest.CreateElement("Documents");

						XmlNode documentSet = _packageManifest.CreateElement("DocumentSet");
						XmlAttribute importMode = _packageManifest.CreateAttribute("importMode", "");
						importMode.Value = "root";
						documentSet.Attributes.Append(importMode);
						documents.AppendChild(documentSet);

						//load content from umbraco.
						cms.businesslogic.web.Document umbDocument = new Document(_contentNodeID);
						documentSet.AppendChild(umbDocument.ToXml(_packageManifest, pack.ContentLoadChildNodes));

						appendElement(documents);
					}

					//Document types..
					List<DocumentType> dtl = new List<DocumentType>();
					XmlNode docTypes = _packageManifest.CreateElement("DocumentTypes");
					foreach (string dtId in pack.Documenttypes)
					{
						if (int.TryParse(dtId, out outInt))
						{
							DocumentType docT = new DocumentType(outInt);

							AddDocumentType(docT, ref dtl);

						}
					}
					foreach (DocumentType d in dtl)
					{
						docTypes.AppendChild(d.ToXml(_packageManifest));
					}

					appendElement(docTypes);

					//Templates
					XmlNode templates = _packageManifest.CreateElement("Templates");
					foreach (string templateId in pack.Templates)
					{
						if (int.TryParse(templateId, out outInt))
						{
							Template t = new Template(outInt);
							templates.AppendChild(t.ToXml(_packageManifest));
						}
					}
					appendElement(templates);

					//Stylesheets
					XmlNode stylesheets = _packageManifest.CreateElement("Stylesheets");
					foreach (string ssId in pack.Stylesheets)
					{
						if (int.TryParse(ssId, out outInt))
						{
							StyleSheet s = new StyleSheet(outInt);
							stylesheets.AppendChild(s.ToXml(_packageManifest));
						}
					}
					appendElement(stylesheets);

					//Macros
					XmlNode macros = _packageManifest.CreateElement("Macros");
					foreach (string macroId in pack.Macros)
					{
						if (int.TryParse(macroId, out outInt))
						{
							macros.AppendChild(utill.Macro(int.Parse(macroId), true, localPath, _packageManifest));
						}
					}
					appendElement(macros);

//.........这里部分代码省略.........
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:101,代码来源:CreatedPackage.cs


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