public void Rewrite(string line) { //clear the line builder and write a new line Clear(); LineBuilder.Append(line); Console.SetCursorPosition(0, CursorTop); Console.WriteLine(LineBuilder); }
public void Clear() { //clear the line LineBuilder.Append('\b', LineBuilder.Length); LineBuilder.Append(' ', LineBuilder.Length); Console.SetCursorPosition(0, CursorTop); Console.WriteLine(LineBuilder); LineBuilder.Clear(); }
public void Export(ScriptBook book, string filePath) { using (var writer = new HtmlTextWriter(new StreamWriter(File.Create(filePath)))) { writer.RenderBeginTag(HtmlTextWriterTag.Style); var cssLines = File.ReadAllLines( Path.Combine( Path.GetDirectoryName( System.Reflection.Assembly.GetEntryAssembly().Location ), "style.css" ) ); writer.WriteLine(); foreach (var cssLine in cssLines) { writer.WriteLine(cssLine); } writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.H1); writer.Write(book.Title); writer.RenderEndTag(); writer.WriteLine(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "story-area"); writer.RenderBeginTag(HtmlTextWriterTag.Div); foreach (var chapter in book) { writer.RenderBeginTag(HtmlTextWriterTag.H3); writer.Write(chapter.Key.MainTitle); writer.RenderEndTag(); writer.WriteLine(); writer.RenderBeginTag(HtmlTextWriterTag.H2); writer.Write(chapter.Key.SubTitle); writer.RenderEndTag(); writer.WriteLine(); foreach (var section in chapter.Value) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "story-section"); writer.RenderBeginTag(HtmlTextWriterTag.Div); foreach (var paragraph in section) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "story-paragraph"); writer.RenderBeginTag(HtmlTextWriterTag.Div); var lineBuilder = new LineBuilder(); foreach (var line in paragraph) { lineBuilder.Append(line); //lineBuilder = concat(lineBuilder, line); } writer.Write(lineBuilder.ToString()); writer.RenderEndTag(); writer.WriteLine(); } writer.RenderEndTag(); writer.WriteLine(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "story-separator"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("☆☆☆☆☆"); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "story-pagebreak"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); } } } }