private int GetOutputSize(bool primary) { using (var stream = new NullStream()) { using (var writer = new GenWriter(stream)) { if (primary) { GenFragmentGenerator.Generate(GenDataDef, writer, GenObject, Fragment); } else { GenFragmentGenerator.GenerateSecondary(GenDataDef, writer, GenObject, Fragment); } writer.Flush(); return((int)writer.Stream.Length); } } }
private string Expand() { var outputSize = GetOutputSize(true); if (outputSize == 0) { return(""); } using (var stream = new MemoryStream(outputSize)) { using (var writer = new GenWriter(stream)) { GenFragmentGenerator.Generate(GenDataDef, writer, GenObject, Fragment); writer.Flush(); stream.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(stream)) return(reader.ReadToEnd()); } } }
public void Generate(GenDataBase genDataBase, GenWriter genWriter) { GenFragmentGenerator.Generate(genDataBase.GenDataDef, genWriter, genDataBase.Root, Profile); }