2025-08-12 19:30:40 +02:00

76 lines
2.0 KiB
C#

using ImGuiNET;
using Microsoft.Xna.Framework;
using skyscraper8.UI.MonoGame.Bridge;
using System;
using System.Reflection;
namespace skyscraper8.UI.MonoGame.Forms
{
internal class AboutWindow : ImGuiRenderable
{
public AboutWindow()
{
open = true;
if (version == null)
{
Type gameType = typeof(Game);
Assembly assembly = gameType.Assembly;
object[] attributes = assembly.GetCustomAttributes(false);
foreach (object attribute in attributes)
{
if (attribute.GetType() == typeof(AssemblyFileVersionAttribute))
{
AssemblyFileVersionAttribute ava = (AssemblyFileVersionAttribute)attribute;
version = Version.Parse((ReadOnlySpan<char>)ava.Version);
}
}
}
typeof(AboutWindow).Module.GetPEKind(out peKind, out machine);
}
private PortableExecutableKinds peKind;
private ImageFileMachine machine;
private bool open;
private static Version version;
public void Dispose()
{
}
public void Update()
{
}
public void Render()
{
ImGui.Begin("About skyscraper8", ref open, ImGuiWindowFlags.AlwaysVerticalScrollbar);
ImGui.Text("skyscraper8, written by Feyris-Tan");
ImGui.Spacing();
ImGui.Text(String.Format("Using MonoGame {0}", version.ToString()));
ImGui.Text(String.Format("Using Dear ImGUI {0}", ImGui.GetVersion()));
ImGui.Text(String.Format("Using StreamReader.dll by crazycat69"));
ImGui.Spacing();
ImGui.Text(String.Format("The currently executing image file is for {0} processors.", machine.ToString()));
ImGui.Text(String.Format("You are running an {0}-bit operating system.", Environment.Is64BitOperatingSystem ? 64 : 32));
ImGui.Text(String.Format("This is a {0}-bit process.", Environment.Is64BitProcess ? 64 : 32));
if (Environment.Is64BitProcess)
{
ImGui.Text(String.Format("Please remember that StreamReader.dll requires a 32-bit context."));
ImGui.Text("Consider using Remote Stream Reader");
}
if (ImGui.Button("OK"))
open = false;
ImGui.End();
}
public bool WasClosed()
{
return !open;
}
}
}