Packed MainWindow.xml into assembly to prevent runtime modification
This commit is contained in:
@@ -6,7 +6,13 @@ public class MainWindow
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
var builder = Gtk.Builder.NewFromFile("UI/MainWindow.xml");
|
||||
var assembly = typeof(MainWindow).Assembly;
|
||||
using var stream = assembly.GetManifestResourceStream("App.UI.MainWindow.xml");
|
||||
if (stream == null)
|
||||
throw new Exception("Failed to load embedded resource MainWindow.xml");
|
||||
using var reader = new System.IO.StreamReader(stream);
|
||||
var xml = reader.ReadToEnd();
|
||||
var builder = Gtk.Builder.NewFromString(xml, -1);
|
||||
var window = builder.GetObject("main_window") as Adw.Window;
|
||||
if (window == null)
|
||||
throw new Exception("Failed to load main_window from MainWindow.ui");
|
||||
|
||||
Reference in New Issue
Block a user