public LegacyGameData(string path, ResourceManager resman) { resource = resman; Compatibility.VFS.Init(path); var flini = new Legacy.FreelancerIni(); fldata = new Legacy.FreelancerData(flini); }
public static Archetype FromSection(Section section, FreelancerData data) { if (section == null) { throw new ArgumentNullException("section"); } Entry type = section ["type"]; if (type == null) //Find case-insensitive { foreach (var entry in section) { if (entry.Name.ToLowerInvariant() == "type") { type = entry; break; } } } if (type == null) { throw new Exception("Missing type Entry in " + section.Name); } if (type.Count != 1) { throw new Exception("Invalid number of values in " + section.Name + " Entry type: " + type.Count); } switch (type[0].ToString().ToLowerInvariant()) { case "sun": return(new Sun(section, data)); case "planet": return(new Planet(section, data)); case "docking_ring": return(new DockingRing(section, data)); case "station": return(new Station(section, data)); case "jump_gate": return(new JumpGate(section, data)); case "satellite": return(new Satellite(section, data)); case "jump_hole": return(new JumpHole(section, data)); case "mission_satellite": return(new MissionSatellite(section, data)); case "non_targetable": return(new NonTargetable(section, data)); case "weapons_platform": return(new WeaponsPlatform(section, data)); case "tradelane_ring": return(new TradelaneRing(section, data)); case "waypoint": return(new Waypoint(section, data)); case "airlock_gate": return(new AirlockGate(section, data)); case "destroyable_depot": return(new DestroyableDepot(section, data)); default: throw new Exception("Invalid value in " + section.Name + " Entry type: " + section["type"][0]); } }