shoko/Protocols/AboutProtoHandler.cs

76 lines
2.1 KiB
C#
Raw Normal View History

2023-10-02 18:49:24 +00:00
using System.Reflection;
using System.Text;
using ImGuiNET;
using Raylib_cs;
namespace Shoko;
[Protocol("about")]
[Protocol("shoko")]
class AboutProtoHandler : ProtoHandler
{
public AboutProtoHandler(Uri url)
{
URL = url;
}
public override void Load()
{
var path = new UriBuilder(URL).Path;
Content = new MemoryStream(new byte[]{});
switch(path)
{
case "blank":
case "":
case "about":
case "shoko":
case "version":
case "demo":
break;
default:
throw new NotImplementedException();
}
MediaType = "text/plain";
Status = "OK";
Loaded = true;
}
public override void Render()
{
var path = new UriBuilder(URL).Path;
switch(path)
{
case "":
case "about":
case "shoko":
case "version":
var info = Assembly.GetExecutingAssembly().GetName();
ImGui.Text("硝子 (shōko) v"+info.Version.ToString());
ImGui.Text("an experimental browser");
ImGui.Separator();
ImGui.Text("(c) 2023 a39 studios");
ImGui.Text("licensed under LiLiQ-P");
ImGui.Separator();
ImGui.Text(".NET v" + Environment.Version.ToString());
ImGui.Text("Dear ImGui v" + ImGui.GetVersion());
ImGui.Text("Raylib v" + Raylib.RAYLIB_VERSION);
ImGui.Separator();
Gui.TreeNode("Supported protos", ()=>{
foreach(var proto in SupportedProtos)
ImGui.BulletText(proto);
});
Gui.TreeNode("Supported media", ()=>{
foreach(var media in MediaHandler.SupportedMedia)
ImGui.BulletText(media);
});
break;
case "demo":
ImGui.ShowDemoWindow();
break;
default:
break;
}
}
}