void NewGui(string folder) { Context = new UiContext(); Context.FlDirectory = folder; Context.ResourceManager = new GameResourceManager(this); Context.Renderer2D = this.Renderer2D; Context.FileSystem = FileSystem.FromFolder(folder); Context.RenderState = RenderState; Context.Fonts = Fonts; Context.GameApi = api; var flIni = new FreelancerIni(Context.FileSystem); if (flIni.XInterfacePath != null) { XmlFolder = Context.FileSystem.Resolve(flIni.XInterfacePath); if (!Context.FileSystem.FileExists(Path.Combine(flIni.XInterfacePath, "resources.xml"))) { WriteBlankFiles(); } } else { var dataPath = Context.FileSystem.Resolve(flIni.DataPath); XmlFolder = Path.Combine(dataPath, "XmlUi"); Directory.CreateDirectory(XmlFolder); WriteBlankFiles(); var flIniPath = Context.FileSystem.Resolve("EXE\\freelancer.ini"); var flIniText = File.ReadAllText(flIniPath); File.WriteAllText(flIniPath, $"{flIniText}\n\n[Extended]\nxinterface = XmlUi"); } Context.OpenFolder(flIni.XInterfacePath); try { var navbarIni = new LibreLancer.Data.BaseNavBarIni(Context.FileSystem); Context.NavbarIcons = navbarIni.Navbar; } catch (Exception) { Context.NavbarIcons = null; } try { var hud = new HudIni(); hud.AddIni(flIni.HudPath, Context.FileSystem); var maneuvers = new List <Maneuver>(); var p = flIni.DataPath.Replace('\\', Path.DirectorySeparatorChar); foreach (var m in hud.Maneuvers) { maneuvers.Add(new Maneuver() { Action = m.Action, ActiveModel = Path.Combine(p, m.ActiveModel), InactiveModel = Path.Combine(p, m.InactiveModel) }); } api.ManeuverData = maneuvers.ToArray(); } catch (Exception) { api.ManeuverData = null; } if (flIni.JsonResources != null) { Context.Infocards = new InfocardManager(flIni.JsonResources.Item1, flIni.JsonResources.Item2); } else if (flIni.Resources != null) { Context.Infocards = new InfocardManager(flIni.Resources); } Fonts.LoadFontsFromIni(flIni, Context.FileSystem); Context.DataPath = flIni.DataPath; resourceEditor = new ResourceWindow(this, Context); resourceEditor.IsOpen = true; projectWindow = new ProjectWindow(XmlFolder, this); projectWindow.IsOpen = true; tabs.Add(new StylesheetEditor(XmlFolder, Context)); }