public static void OnSaved(XmlDocFileEventArgs e) { if (Saved != null) { Saved(e); } SyncFileWatcher.Start(); }
public static void OnDeleted(XmlDocFileEventArgs e) { if (Deleted != null) { Deleted(e); } SyncFileWatcher.Start(); }
public static void OnPreDelete(XmlDocFileEventArgs e) { SyncFileWatcher.Pause(); if (preDelete != null) { preDelete(e); } if (Deleting != null) { Deleting(e); } }
public static void OnPreSave(XmlDocFileEventArgs e) { SyncFileWatcher.Pause(); /* going to phase this out - naming is saving/saved) */ if (preSave != null) { preSave(e); } if (Saving != null) { Saving(e); } }
private void OnDocumentTypeSaved(XmlDocFileEventArgs e) { if (!e.Path.Contains("DocumentType") && !e.Path.Contains("MediaType")) return; var typeConfig = e.Path.Contains("DocumentType") ? configuration.DocumentTypes : configuration.MediaTypes; if (!typeConfig.GenerateClasses) return; ContentType contentType; using (var reader = File.OpenText(e.Path)) contentType = serializer.Deserialize(reader); var modelPath = paths[typeConfig.ContentTypeName]; if (!Directory.Exists(modelPath)) Directory.CreateDirectory(modelPath); var path = Path.Combine(modelPath, contentType.Info.Alias.PascalCase() + ".cs"); if (configuration.OverwriteReadOnly && File.Exists(path)) File.SetAttributes(path, File.GetAttributes(path) & ~FileAttributes.ReadOnly); var classGenerator = new CodeGenerator(typeConfig, dataTypesProvider, new DefaultCodeGeneratorFactory()); using (var stream = File.CreateText(path)) classGenerator.Generate(contentType, stream); }
public static void OnDeleted(XmlDocFileEventArgs e) { if (Deleted != null) { Deleted(e); } }
public static void OnPreDelete(XmlDocFileEventArgs e) { if (preDelete != null) { preDelete(e); } if (Deleting != null) { Deleting(e); } }
public static void OnSaved(XmlDocFileEventArgs e) { if (Saved != null) { Saved(e); } }
public static void OnPreSave(XmlDocFileEventArgs e) { /* going to phase this out - naming is saving/saved) */ if (preSave != null) { preSave(e); } if (Saving != null) { Saving(e); } }
private void OnDocumentTypeSaved(XmlDocFileEventArgs e) { if (!e.Path.Contains("DocumentType") && !e.Path.Contains("MediaType")) return; var typeConfig = e.Path.Contains("DocumentType") ? configuration.DocumentTypes : configuration.MediaTypes; if (!typeConfig.GenerateClasses) return; var codeDomProvider = new CSharpCodeProvider(); var doc = XDocument.Load(e.Path); var classGenerator = new ContentTypeCodeGenerator(typeConfig, doc, codeDomProvider); var modelPath = paths[typeConfig.ContentTypeName]; if (!Directory.Exists(modelPath)) Directory.CreateDirectory(modelPath); var path = Path.Combine(modelPath, doc.XPathSelectElement("//Info/Alias").Value.PascalCase() + ".cs"); if (configuration.OverwriteReadOnly && File.Exists(path)) File.SetAttributes(path, File.GetAttributes(path) & ~FileAttributes.ReadOnly); using (var stream = File.CreateText(path)) { classGenerator.BuildCode(stream); } }