private void OnGenerationStatus(GenerationStatusEventArgs e) { if (GenerationStatus != null) { GenerationStatus(this, e); } }
/// <summary>Generates all outputs.</summary> public async Task GenerateAsync() { Task <string> projectXml = null; IDictionary <Template, Task <XslCompiledTransform> > templateTransformTaskMap = null; OnGenerationStatus(GenerationStatusEventArgs.CreateGenerating()); projectXml = SerializeProjectAsync(); templateTransformTaskMap = GetTemplateCompilationTaskMap(); await GenerateOutputsAsync(await projectXml, templateTransformTaskMap); OnGenerationStatus(GenerationStatusEventArgs.CreateComplete()); }
/// <summary>Serializes the project to XML.</summary> private string SerializeProject() { try { XmlSerializer serializer = new XmlSerializer(typeof(Project)); StringBuilder fileContent = new StringBuilder(); using (StringWriter writer = new StringWriter(fileContent)) serializer.Serialize(writer, this.Project); return(fileContent.ToString()); } catch (Exception ex) { OnGenerationStatus(GenerationStatusEventArgs.CreateError(new ApplicationException("Unable to serialize the project file.", ex))); return(null); } }