Digital Twin - GUI
MoselTextWriter.cs
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Linq;
5 using System.Text;
6 using System.Threading.Tasks;
7 
8 namespace GUI.IO_Modules
9 {
13  public class MoselTextWriter : TextWriter
14  {
18  public StringBuilder sb = new StringBuilder();
19 
24  public override void Write(char b)
25  {
26  if (b == '\n')
27  {
28  sb.Append("\n");
29  }
30  else
31  {
32  if (b == '\r')
33  {
34  // ignore
35  }
36  else
37  {
38  sb.Append(b);
39  }
40  }
41  }
42 
46  public override Encoding Encoding
47  {
48  get
49  {
50  return Encoding.UTF8;
51  }
52  }
53  }
54 }
A class that lets us catch the output Stream of Mosel.
override void Write(char b)
Write is called everytime a new character is output by Mosel.