/// <summary> /// save a document type to the disk, the document type will be /// saved as an xml file, in a folder structure that mimics /// that of the document type structure in umbraco. /// /// this makes it easier to read them back in /// </summary> /// <param name="item">DocumentType to save</param> public static void SaveToDisk(DocumentType 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 e) { Log.Add(LogTypes.Error, 0, String.Format("uSync: Error Saving DocumentType {0} - {1}", item.Alias, e.ToString())); } } }
/// <summary> /// called when a document type is about to be deleted. /// /// we archive the file (rename it from .xml to .archive) /// this makes it not be read in on next application start. /// </summary> static void DocumentType_BeforeDelete(DocumentType sender, DeleteEventArgs e) { helpers.XmlDoc.ArchiveFile(sender.GetType().ToString(), GetDocPath(sender), "def"); e.Cancel = false; }