public void LoadData() { if (Loaded) { return; } if (LoadDacom) { Dacom = new DacomIni(); } if (Freelancer.JsonResources != null) { Infocards = new InfocardManager(File.ReadAllText(Freelancer.JsonResources.Item1), File.ReadAllText(Freelancer.JsonResources.Item2)); } else { Infocards = new InfocardManager(Freelancer.Resources); } //Build Universe var tSolar = new Thread(() => { //Equipment Equipment = new EquipmentIni(); foreach (var eq in Freelancer.EquipmentPaths) { Equipment.AddEquipmentIni(eq, this); } Solar = new SolararchIni(Freelancer.SolarPath, this); if (Freelancer.StarsPath != null) { Stars = new StararchIni(Freelancer.StarsPath); } else { Stars = new StararchIni("DATA\\SOLAR\\stararch.ini"); } Asteroids = new AsteroidArchIni(); foreach (var ast in Freelancer.AsteroidPaths) { Asteroids.AddFile(ast); } Loadouts = new LoadoutsIni(); foreach (var lo in Freelancer.LoadoutPaths) { Loadouts.AddLoadoutsIni(lo, this); } }); var tUniverse = new Thread(() => { Universe = new UniverseIni(Freelancer.UniversePath, this); }); //Misc var tMisc = new Thread(() => { //Graphs Graphs = new GraphIni(); foreach (var g in Freelancer.GraphPaths) { Graphs.AddGraphIni(g); } //Shapes EffectShapes = new TexturePanels(Freelancer.EffectShapesPath); //Effects Effects = new EffectsIni(); foreach (var fx in Freelancer.EffectPaths) { Effects.AddIni(fx); } //Mouse Mouse = new MouseIni(Freelancer.DataPath + "//mouse.ini"); //Fonts RichFonts = new RichFontsIni(); foreach (var rf in Freelancer.RichFontPaths) { RichFonts.AddRichFontsIni(rf); } //PetalDb PetalDb = new PetalDbIni(); foreach (var pt in Freelancer.PetalDbPaths) { PetalDb.AddFile(pt); } //Hud Hud = new HudIni(); Hud.AddIni(Freelancer.HudPath); //navbar.ini BaseNavBar = new BaseNavBarIni(); //mbases.ini MBases = new MBasesIni(); //fuses Fuses = new FuseIni(); foreach (var fi in Freelancer.FusePaths) { Fuses.AddFuseIni(fi); } //newchardb NewCharDB = new NewCharDBIni(); foreach (var nc in Freelancer.NewCharDBPaths) { NewCharDB.AddNewCharDBIni(nc); } }); tMisc.Start(); tSolar.Start(); tUniverse.Start(); Bodyparts = new BodypartsIni(Freelancer.BodypartsPath, this); Costumes = new CostumesIni(Freelancer.CostumesPath, this); Audio = new AudioIni(); foreach (var snd in Freelancer.SoundPaths) { Audio.AddIni(snd, Freelancer); } Ships = new ShiparchIni(); foreach (var shp in Freelancer.ShiparchPaths) { Ships.AddShiparchIni(shp, this); } Goods = new GoodsIni(); foreach (var gd in Freelancer.GoodsPaths) { Goods.AddGoodsIni(gd); } Markets = new MarketsIni(); foreach (var mkt in Freelancer.MarketsPaths) { Markets.AddMarketsIni(mkt); } foreach (var msn in missionFiles) { if (VFS.FileExists(Freelancer.DataPath + msn)) { Missions.Add(new Data.Missions.MissionIni(Freelancer.DataPath + msn)); } } ContentDll = new ContentDll(); if (VFS.FileExists("DLLS\\BIN\\content.dll")) { ContentDll.Load(VFS.GetPath("DLLS\\BIN\\content.dll")); } tSolar.Join(); tMisc.Join(); tUniverse.Join(); if (!string.IsNullOrEmpty(Freelancer.DataVersion)) { DataVersion = Freelancer.DataVersion; } else { DataVersion = "FL-1"; } Loaded = true; }
public void LoadData() { if (Loaded) { return; } if (LoadDacom) { if (!string.IsNullOrEmpty(Freelancer.DacomPath)) { Dacom = new DacomIni(Freelancer.DacomPath, VFS); } else { new MaterialMap(); //no dacom, make default global thing //todo: fix this } } if (Freelancer.JsonResources != null) { Infocards = new InfocardManager(Freelancer.JsonResources, VFS); } else { Infocards = new InfocardManager(Freelancer.Resources); } List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(() => { Equipment = new EquipmentIni(); foreach (var eq in Freelancer.EquipmentPaths) { Equipment.AddEquipmentIni(eq, this); } })); tasks.Add(Task.Run(() => { Solar = new SolararchIni(Freelancer.SolarPath, this); if (Freelancer.StarsPath != null) { Stars = new StararchIni(Freelancer.StarsPath, VFS); } else { Stars = new StararchIni(Freelancer.DataPath + "SOLAR\\stararch.ini", VFS); } })); tasks.Add(Task.Run(() => { Asteroids = new AsteroidArchIni(); foreach (var ast in Freelancer.AsteroidPaths) { Asteroids.AddFile(ast, VFS); } })); tasks.Add(Task.Run(() => { SpecificNPCs = new SpecificNPCIni(); if (VFS.FileExists(Freelancer.DataPath + "MISSIONS\\specific_npc.ini")) { SpecificNPCs.AddFile(Freelancer.DataPath + "MISSIONS\\specific_npc.ini", VFS); } })); tasks.Add(Task.Run(() => { Loadouts = new LoadoutsIni(); foreach (var lo in Freelancer.LoadoutPaths) { Loadouts.AddLoadoutsIni(lo, this); } })); tasks.Add(Task.Run(() => { Universe = new UniverseIni(Freelancer.UniversePath, this); })); //Pilots tasks.Add(Task.Run(() => { Pilots = new PilotsIni(); if (VFS.FileExists(Freelancer.DataPath + "MISSIONS\\pilots_population.ini")) { Pilots.AddFile(Freelancer.DataPath + "MISSIONS\\pilots_population.ini", VFS); } if (VFS.FileExists(Freelancer.DataPath + "MISSIONS\\pilots_story.ini")) { Pilots.AddFile(Freelancer.DataPath + "MISSIONS\\pilots_story.ini", VFS); } })); //Graphs tasks.Add(Task.Run(() => { Graphs = new GraphIni(); foreach (var g in Freelancer.GraphPaths) { Graphs.AddGraphIni(g, VFS); } })); //Shapes tasks.Add(Task.Run(() => { if (string.IsNullOrEmpty(Freelancer.EffectShapesPath)) { throw new Exception("Need one effect_shapes entry"); } EffectShapes = new TexturePanels(Freelancer.EffectShapesPath, VFS); })); //Effects tasks.Add(Task.Run(() => { Effects = new EffectsIni(); foreach (var fx in Freelancer.EffectPaths) { Effects.AddIni(fx, VFS); } })); tasks.Add(Task.Run(() => { //Mouse Mouse = new MouseIni(Freelancer.MousePath, VFS); //Fonts RichFonts = new RichFontsIni(); foreach (var rf in Freelancer.RichFontPaths) { RichFonts.AddRichFontsIni(rf, VFS); } Fonts = new FontsIni(); foreach (var f in Freelancer.FontPaths) { Fonts.AddFontsIni(f, VFS); } })); tasks.Add(Task.Run(() => { //PetalDb PetalDb = new PetalDbIni(); foreach (var pt in Freelancer.PetalDbPaths) { PetalDb.AddFile(pt, VFS); } })); tasks.Add(Task.Run(() => { //Hud Hud = new HudIni(); if (string.IsNullOrEmpty(Freelancer.HudPath)) { throw new Exception("Need one hud path"); } Hud.AddIni(Freelancer.HudPath, VFS); //navbar.ini BaseNavBar = new BaseNavBarIni(Freelancer.DataPath, VFS); if (!string.IsNullOrEmpty(Freelancer.NavmapPath)) { Navmap = new NavmapIni(Freelancer.NavmapPath, VFS); } })); tasks.Add(Task.Run(() => { InfocardMap = new InfocardMapIni(); InfocardMap.AddMap(Freelancer.DataPath + "/INTERFACE/infocardmap.ini", VFS); })); tasks.Add(Task.Run(() => { //mbases.ini MBases = new MBasesIni(); if (Freelancer.MBasesPaths != null) { foreach (var f in Freelancer.MBasesPaths) { MBases.AddFile(f, VFS); } } else { MBases.AddFile(Freelancer.DataPath + "MISSIONS\\mbases.ini", VFS); } })); tasks.Add(Task.Run(() => { News = new NewsIni(); if (VFS.FileExists(Freelancer.DataPath + "MISSIONS\\news.ini")) { News.AddNewsIni(Freelancer.DataPath + "MISSIONS\\news.ini", VFS); } })); tasks.Add(Task.Run(() => { Fuses = new FuseIni(); foreach (var fi in Freelancer.FusePaths) { Fuses.AddFuseIni(fi, VFS); } })); //newchardb tasks.Add(Task.Run(() => { NewCharDB = new NewCharDBIni(); foreach (var nc in Freelancer.NewCharDBPaths) { NewCharDB.AddNewCharDBIni(nc, VFS); } })); tasks.Add(Task.Run(() => { Bodyparts = new BodypartsIni(Freelancer.BodypartsPath, this); Costumes = new CostumesIni(Freelancer.CostumesPath, this); })); tasks.Add(Task.Run(() => { Audio = new AudioIni(); foreach (var snd in Freelancer.SoundPaths) { Audio.AddIni(snd, VFS); } })); tasks.Add(Task.Run(() => { Ships = new ShiparchIni(); foreach (var shp in Freelancer.ShiparchPaths) { Ships.AddShiparchIni(shp, this); } })); tasks.Add(Task.Run(() => { Goods = new GoodsIni(); foreach (var gd in Freelancer.GoodsPaths) { Goods.AddGoodsIni(gd, VFS); } })); tasks.Add(Task.Run(() => { Markets = new MarketsIni(); foreach (var mkt in Freelancer.MarketsPaths) { Markets.AddMarketsIni(mkt, VFS); } })); tasks.Add(Task.Run(() => { foreach (var msn in missionFiles) { if (VFS.FileExists(Freelancer.DataPath + msn)) { var m = new MissionIni(Freelancer.DataPath + msn, VFS); if (m.Info?.NpcShipFile != null) { m.ShipIni = new NPCShipIni(Freelancer.DataPath + m.Info.NpcShipFile, VFS); } Missions.Add(m); } } if (VFS.FileExists(Freelancer.DataPath + "missions\\npcships.ini")) { NPCShips = new NPCShipIni(Freelancer.DataPath + "missions\\npcships.ini", VFS); } })); tasks.Add(Task.Run(() => { Cameras = new CameraIni(); Cameras.ParseAndFill(Freelancer.CamerasPath, VFS); })); tasks.Add(Task.Run(() => { HpTypes = new HpTypesIni(); HpTypes.LoadDefault(); })); ContentDll = new ContentDll(); if (VFS.FileExists("DLLS\\BIN\\content.dll")) { ContentDll.Load(VFS.Resolve("DLLS\\BIN\\content.dll")); } if (!string.IsNullOrEmpty(Freelancer.DataVersion)) { DataVersion = Freelancer.DataVersion; } else { DataVersion = "FL-1"; } Task.WaitAll(tasks.ToArray()); Loaded = true; }
public void LoadData() { if (Loaded) { return; } if (LoadDacom) { Dacom = new DacomIni(VFS); } if (Freelancer.JsonResources != null) { Infocards = new InfocardManager(File.ReadAllText(Freelancer.JsonResources.Item1), File.ReadAllText(Freelancer.JsonResources.Item2)); } else { Infocards = new InfocardManager(Freelancer.Resources); } var t1 = Task.Run(() => { Equipment = new EquipmentIni(); foreach (var eq in Freelancer.EquipmentPaths) { Equipment.AddEquipmentIni(eq, this); } }); var t2 = Task.Run(() => { Solar = new SolararchIni(Freelancer.SolarPath, this); if (Freelancer.StarsPath != null) { Stars = new StararchIni(Freelancer.StarsPath, VFS); } else { Stars = new StararchIni("DATA\\SOLAR\\stararch.ini", VFS); } }); var t3 = Task.Run(() => { Asteroids = new AsteroidArchIni(); foreach (var ast in Freelancer.AsteroidPaths) { Asteroids.AddFile(ast, VFS); } }); var t4 = Task.Run(() => { Loadouts = new LoadoutsIni(); foreach (var lo in Freelancer.LoadoutPaths) { Loadouts.AddLoadoutsIni(lo, this); } }); var t5 = Task.Run(() => { Universe = new UniverseIni(Freelancer.UniversePath, this); }); //Graphs var t6 = Task.Run(() => { Graphs = new GraphIni(); foreach (var g in Freelancer.GraphPaths) { Graphs.AddGraphIni(g, VFS); } }); //Shapes var t7 = Task.Run(() => { EffectShapes = new TexturePanels(Freelancer.EffectShapesPath, VFS); }); //Effects var t8 = Task.Run(() => { Effects = new EffectsIni(); foreach (var fx in Freelancer.EffectPaths) { Effects.AddIni(fx, VFS); } }); var t9 = Task.Run(() => { //Mouse Mouse = new MouseIni(Freelancer.DataPath + "/mouse.ini", VFS); //Fonts RichFonts = new RichFontsIni(); foreach (var rf in Freelancer.RichFontPaths) { RichFonts.AddRichFontsIni(rf, VFS); } Fonts = new FontsIni(); foreach (var f in Freelancer.FontPaths) { Fonts.AddFontsIni(f, VFS); } }); var t10 = Task.Run(() => { //PetalDb PetalDb = new PetalDbIni(); foreach (var pt in Freelancer.PetalDbPaths) { PetalDb.AddFile(pt, VFS); } }); var t11 = Task.Run(() => { //Hud Hud = new HudIni(); Hud.AddIni(Freelancer.HudPath, VFS); //navbar.ini BaseNavBar = new BaseNavBarIni(VFS); }); var t12 = Task.Run(() => { //mbases.ini MBases = new MBasesIni(VFS); }); var t14 = Task.Run(() => { Fuses = new FuseIni(); foreach (var fi in Freelancer.FusePaths) { Fuses.AddFuseIni(fi, VFS); } }); //newchardb var t15 = Task.Run(() => { NewCharDB = new NewCharDBIni(); foreach (var nc in Freelancer.NewCharDBPaths) { NewCharDB.AddNewCharDBIni(nc, VFS); } }); var t16 = Task.Run(() => { Bodyparts = new BodypartsIni(Freelancer.BodypartsPath, this); Costumes = new CostumesIni(Freelancer.CostumesPath, this); }); var t18 = Task.Run(() => { Audio = new AudioIni(); foreach (var snd in Freelancer.SoundPaths) { Audio.AddIni(snd, VFS); } }); var t19 = Task.Run(() => { Ships = new ShiparchIni(); foreach (var shp in Freelancer.ShiparchPaths) { Ships.AddShiparchIni(shp, this); } }); var t20 = Task.Run(() => { Goods = new GoodsIni(); foreach (var gd in Freelancer.GoodsPaths) { Goods.AddGoodsIni(gd, VFS); } }); var t21 = Task.Run(() => { Markets = new MarketsIni(); foreach (var mkt in Freelancer.MarketsPaths) { Markets.AddMarketsIni(mkt, VFS); } }); var t22 = Task.Run(() => { foreach (var msn in missionFiles) { if (VFS.FileExists(Freelancer.DataPath + msn)) { Missions.Add(new Data.Missions.MissionIni(Freelancer.DataPath + msn, VFS)); } } }); ContentDll = new ContentDll(); if (VFS.FileExists("DLLS\\BIN\\content.dll")) { ContentDll.Load(VFS.Resolve("DLLS\\BIN\\content.dll")); } if (!string.IsNullOrEmpty(Freelancer.DataVersion)) { DataVersion = Freelancer.DataVersion; } else { DataVersion = "FL-1"; } //Yes I screwed up the numbering Task.WaitAll(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t14, t15, t16, t18, t19, t20, t21, t22); Loaded = true; }
public void LoadData() { if (Loaded) { return; } if (LoadDacom) { Dacom = new DacomIni(); } if (Freelancer.JsonResources != null) { var strs = JsonConvert.DeserializeObject <Dictionary <int, string> >(File.ReadAllText(VFS.GetPath("EXE\\" + Freelancer.JsonResources.Item1))); var ifcs = JsonConvert.DeserializeObject <Dictionary <int, string> >(File.ReadAllText(VFS.GetPath("EXE\\" + Freelancer.JsonResources.Item2))); Infocards = new InfocardManager(strs, ifcs); } else { Infocards = new InfocardManager(Freelancer.Resources); } //Dfm Bodyparts = new BodypartsIni(Freelancer.BodypartsPath, this); Costumes = new CostumesIni(Freelancer.CostumesPath, this); //Equipment Equipment = new EquipmentIni(); foreach (var eq in Freelancer.EquipmentPaths) { Equipment.AddEquipmentIni(eq, this); } //Solars Solar = new SolararchIni(Freelancer.SolarPath, this); if (Freelancer.StarsPath != null) { Stars = new StararchIni(Freelancer.StarsPath); } else { Stars = new StararchIni("DATA\\SOLAR\\stararch.ini"); } Asteroids = new AsteroidArchIni(); foreach (var ast in Freelancer.AsteroidPaths) { Asteroids.AddFile(ast); } //Loadouts Loadouts = new LoadoutsIni(); foreach (var lo in Freelancer.LoadoutPaths) { Loadouts.AddLoadoutsIni(lo, this); } //Universe Universe = new UniverseIni(Freelancer.UniversePath, this); //Ships Ships = new ShiparchIni(); foreach (var shp in Freelancer.ShiparchPaths) { Ships.AddShiparchIni(shp, this); } //Audio Audio = new AudioIni(); foreach (var snd in Freelancer.SoundPaths) { Audio.AddIni(snd, Freelancer); } Loaded = true; //Graphs Graphs = new GraphIni(); foreach (var g in Freelancer.GraphPaths) { Graphs.AddGraphIni(g); } //Shapes EffectShapes = new TexturePanels(Freelancer.EffectShapesPath); //Effects Effects = new EffectsIni(); foreach (var fx in Freelancer.EffectPaths) { Effects.AddIni(fx); } //Mouse Mouse = new MouseIni(Freelancer.DataPath + "//mouse.ini"); //Fonts RichFonts = new RichFontsIni(); foreach (var rf in Freelancer.RichFontPaths) { RichFonts.AddRichFontsIni(rf); } //PetalDb PetalDb = new PetalDbIni(); foreach (var pt in Freelancer.PetalDbPaths) { PetalDb.AddFile(pt); } //Hud Hud = new HudIni(); Hud.AddIni(Freelancer.HudPath); //navbar.ini BaseNavBar = new BaseNavBarIni(); //mbases.ini MBases = new MBasesIni(); }