34 lines
744 B
C#
34 lines
744 B
C#
using ImGuiNET;
|
|
|
|
namespace Shoko;
|
|
|
|
[MediaType("text/plain")]
|
|
[MediaType("text/*")]
|
|
class PlainMediaHandler : MediaHandler
|
|
{
|
|
List<string> lines;
|
|
public PlainMediaHandler(ProtoHandler content)
|
|
{
|
|
Content = content;
|
|
lines = new List<string>();
|
|
}
|
|
|
|
public override void Load()
|
|
{
|
|
Title = new UriBuilder(Content.URL).Path;
|
|
var reader = new StreamReader(Content.Content);
|
|
string line;
|
|
while((line = reader.ReadLine()) is not null)
|
|
{
|
|
lines.Add(line);
|
|
}
|
|
}
|
|
|
|
public override void Render()
|
|
{
|
|
ImGui.PushFont(MainUI.MonospaceFont);
|
|
foreach(var line in lines)
|
|
ImGui.TextUnformatted(line);
|
|
ImGui.PopFont();
|
|
}
|
|
} |