internal ProjectileViewer(MainWindow mw, string folder) { this.mw = mw; Title = "Projectiles"; vfs = FileSystem.FromFolder(folder); var flini = new FreelancerIni(vfs); var data = new FreelancerData(flini, vfs); effects = new EffectsIni(); equipment = new EquipmentIni(); data.Equipment = equipment; foreach (var path in flini.EffectPaths) { effects.AddIni(path, vfs); } foreach (var path in flini.EquipmentPaths) { equipment.AddEquipmentIni(path, data); } projectileList = equipment.Munitions.Where(x => !string.IsNullOrWhiteSpace(x.ConstEffect)).OrderBy(x => x.Nickname).ToArray(); var fxShapes = new TexturePanels(flini.EffectShapesPath, vfs); foreach (var f in fxShapes.Files) { var path = vfs.Resolve(flini.DataPath + f); mw.Resources.LoadResourceFile(path); } viewport = new Viewport3D(mw); viewport.Background = Color4.Black; viewport.DefaultOffset = viewport.CameraOffset = new Vector3(0, 0, 20); viewport.ModelScale = 10f; viewport.ResetControls(); fxPool = new ParticleEffectPool(mw.Commands); beams = new BeamsBuffer(); }
public InfocardBrowserTab(string flini, MainWindow win) { this.win = win; var ini = new FreelancerIni(flini, null); fonts = new FontManager(); var rootFolder = Path.Combine(Path.GetDirectoryName(flini), "../"); var vfs = FileSystem.FromFolder(rootFolder, true); fonts.LoadFontsFromIni(ini, vfs); if (ini.JsonResources != null) { manager = new InfocardManager(File.ReadAllText(ini.JsonResources.Item1), File.ReadAllText(ini.JsonResources.Item2)); } else { manager = new InfocardManager(ini.Resources); } stringsIds = manager.StringIds.ToArray(); infocardsIds = manager.InfocardIds.ToArray(); txt = new TextBuffer(8192); stringClipper = new ListClipper(stringsIds.Length); infocardClipper = new ListClipper(infocardsIds.Length); Title = "Infocard Browser"; }
public void AddIni(string path, FreelancerIni ini) { foreach (Section s in ParseFile(path)) { var au = new AudioEntry(); if (s.Name.ToLowerInvariant() != "sound") { throw new Exception("Invalid section " + s.Name + " in " + path); } foreach (Entry e in s) { switch (e.Name.ToLowerInvariant()) { case "nickname": if (au.Nickname != null) { FLLog.Warning("Audio", "Invalid nickname entry in " + path + " (prev " + au.Nickname + ")"); } else { au.Nickname = e[0].ToString(); } break; case "file": if (au.File != null) { FLLog.Warning("Audio", "Invalid file entry in " + path + " (nick: " + (au.Nickname ?? "null") + ")"); } else { au.File = e[0].ToString(); } break; case "crv_pitch": au.CrvPitch = e[0].ToInt32(); break; case "attenuation": au.Attenuation = e[0].ToInt32(); break; case "is_2d": au.Is2d = e[0].ToBoolean(); break; } } Entries.Add(au); } }
public void Setup() { FLLog.UIThread = new NoSyncThread(); FLLog.AppendLine = LogLine; Environment.SetEnvironmentVariable("FOLDER", Directory.GetCurrentDirectory()); string path = Environment.GetEnvironmentVariable("FOLDER"); this.VFS = FileSystem.FromFolder(path); FreelancerIni flIni = new FreelancerIni(this.VFS); this.Data = new FreelancerData(flIni, this.VFS); this.Data.LoadData(); }
public void LoadFontsFromIni(FreelancerIni fl, FileSystem fs) { var rf = new RichFontsIni(); foreach (var file in fl.RichFontPaths) { rf.AddRichFontsIni(file, fs); } var fn = new FontsIni(); foreach (var file in fl.FontPaths) { fn.AddFontsIni(file, fs); } LoadFonts(fn, rf, fs, fl.DataPath); }
public IDTable(string fldir) { UtfNicknameTable = new Dictionary <uint, string>(); var fs = FileSystem.FromFolder(fldir, true); var flini = new FreelancerIni(fs); var voices = new VoicesIni(); foreach (var path in flini.VoicePaths) { voices.AddVoicesIni(path, fs); } foreach (var voice in voices.Voices.Values) { foreach (var msg in voice.Messages) { UtfNicknameTable[FLHash.CreateID(msg.Message)] = msg.Message; } } }
public InfocardBrowserTab(string flini, MainWindow win) { this.win = win; var ini = new FreelancerIni(flini); if (ini.JsonResources != null) { manager = new InfocardManager(File.ReadAllText(ini.JsonResources.Item1), File.ReadAllText(ini.JsonResources.Item2)); } else { manager = new InfocardManager(ini.Resources); } stringsIds = manager.StringIds.ToArray(); infocardsIds = manager.InfocardIds.ToArray(); txt = new TextBuffer(8192); stringClipper = new ListClipper(stringsIds.Length); infocardClipper = new ListClipper(infocardsIds.Length); Title = "Infocard Browser##" + Unique; }
void NewGui(string folder) { UiData = new UiData(); UiData.FlDirectory = folder; UiData.ResourceManager = new GameResourceManager(this); UiData.FileSystem = FileSystem.FromFolder(folder); UiData.Fonts = Fonts; var flIni = new FreelancerIni(UiData.FileSystem); if (flIni.XInterfacePath != null) { XmlFolder = UiData.FileSystem.Resolve(flIni.XInterfacePath); if (!UiData.FileSystem.FileExists(Path.Combine(flIni.XInterfacePath, "resources.xml"))) { WriteBlankFiles(); } } else { var dataPath = UiData.FileSystem.Resolve(flIni.DataPath); XmlFolder = Path.Combine(dataPath, "XmlUi"); Directory.CreateDirectory(XmlFolder); WriteBlankFiles(); var flIniPath = UiData.FileSystem.Resolve("EXE\\freelancer.ini"); var flIniText = File.ReadAllText(flIniPath); File.WriteAllText(flIniPath, $"{flIniText}\n\n[Extended]\nxinterface = XmlUi"); } UiData.OpenFolder(flIni.XInterfacePath); try { var navbarIni = new LibreLancer.Data.BaseNavBarIni(UiData.FileSystem); UiData.NavbarIcons = navbarIni.Navbar; } catch (Exception) { UiData.NavbarIcons = null; } try { var hud = new HudIni(); hud.AddIni(flIni.HudPath, UiData.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) }); } TestApi.ManeuverData = maneuvers.ToArray(); } catch (Exception) { TestApi.ManeuverData = null; } if (flIni.JsonResources != null) { UiData.Infocards = new InfocardManager(flIni.JsonResources.Item1, flIni.JsonResources.Item2); } else if (flIni.Resources != null) { UiData.Infocards = new InfocardManager(flIni.Resources); } Fonts.LoadFontsFromIni(flIni, UiData.FileSystem); UiData.DataPath = flIni.DataPath; resourceEditor = new ResourceWindow(this, UiData); resourceEditor.IsOpen = true; projectWindow = new ProjectWindow(XmlFolder, this); projectWindow.IsOpen = true; tabs.Add(new StylesheetEditor(XmlFolder, UiData)); }
void Load() { UiData.FlDirectory = FlFolder; UiData.ResourceManager = new GameResourceManager(window); UiData.FileSystem = FileSystem.FromFolder(FlFolder); UiData.Fonts = window.Fonts; var flIni = new FreelancerIni(UiData.FileSystem); var dataPath = UiData.FileSystem.Resolve(flIni.DataPath) + "/"; ResolvedDataDir = dataPath; UiData.DataPath = flIni.DataPath; //TODO: Fix to work with custom game UiData.NavmapIcons = new NavmapIcons(); UiData.OpenFolder(XmlFolder); try { var navbarIni = new LibreLancer.Data.BaseNavBarIni(dataPath, UiData.FileSystem); UiData.NavbarIcons = navbarIni.Navbar; } catch (Exception) { UiData.NavbarIcons = null; } try { var hud = new HudIni(); hud.AddIni(flIni.HudPath, UiData.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) }); } window.TestApi.ManeuverData = maneuvers.ToArray(); } catch (Exception) { window.TestApi.ManeuverData = null; } if (flIni.JsonResources != null) { UiData.Infocards = new InfocardManager(flIni.JsonResources, UiData.FileSystem); } else if (flIni.Resources != null) { UiData.Infocards = new InfocardManager(flIni.Resources); } XmlLoader = new UiXmlLoader(UiData.Resources); try { UiData.Stylesheet = (Stylesheet)XmlLoader.FromString(UiData.ReadAllText("stylesheet.xml"), null); } catch (Exception) { } window.Fonts.LoadFontsFromIni(flIni, UiData.FileSystem); //unioners infocard var im = new InfocardManager(flIni.Resources); TestingInfocard = RDLParse.Parse(im.GetXmlResource(65546), window.Fonts); }
public void AddIni(string path, FreelancerIni ini) { ParseAndFill(path); }