public void Invoke(CompositionContainer container) { var traceListener = new ConsolidatedConsoleTraceListener(new Dictionary <string, string> { { "LostDoc.Core.DocGenerator", "Build" }, }); TraceSources.GeneratorSource.Listeners.Add(traceListener); try { SetTraceLevel(); if (!File.Exists(this.Path)) { Console.WriteLine("File not found: '{0}'", this.Path); return; } this.Output = BuildOutputFilePath(); DocGenerator gen = new DocGenerator(container); gen.AssetFilters.AddRange( BuildAssetFilters()); gen.Enrichers.AddRange( BuildEnrichers()); gen.AddAssembly(this.Path); XDocument rawDoc = gen.Generate(); //StringWriter output = new StringWriter(); //try //{ // using ( // XmlWriter writer = XmlWriter.Create(output, // new XmlWriterSettings // { // CheckCharacters = true, // Encoding = Encoding.ASCII // })) // rawDoc.Save(writer); //} //catch //{ //} rawDoc.Save(this.Output); } finally { TraceSources.GeneratorSource.Listeners.Remove(traceListener); } }
public void Invoke(CompositionContainer container) { var traceListener = new ConsolidatedConsoleTraceListener(new Dictionary<string, string> { {"LostDoc.Core.DocGenerator", "Build"}, }); TraceSources.GeneratorSource.Listeners.Add(traceListener); try { SetTraceLevel(); if (!File.Exists(this.Path)) { Console.WriteLine("File not found: '{0}'", this.Path); return; } this.Output = BuildOutputFilePath(); DocGenerator gen = new DocGenerator(container); gen.AssetFilters.AddRange( BuildAssetFilters()); gen.Enrichers.AddRange( BuildEnrichers()); gen.AddAssembly(this.Path); XDocument rawDoc = gen.Generate(); //StringWriter output = new StringWriter(); //try //{ // using ( // XmlWriter writer = XmlWriter.Create(output, // new XmlWriterSettings // { // CheckCharacters = true, // Encoding = Encoding.ASCII // })) // rawDoc.Save(writer); //} //catch //{ //} rawDoc.Save(this.Output); } finally { TraceSources.GeneratorSource.Listeners.Remove(traceListener); } }