Ejemplo n.º 1
0
 private void OnGenerationStatus(GenerationStatusEventArgs e)
 {
     if (GenerationStatus != null)
     {
         GenerationStatus(this, e);
     }
 }
Ejemplo n.º 2
0
        /// <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());
        }
Ejemplo n.º 3
0
        /// <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);
            }
        }