示例#1
0
 public IniNavmapIcons(NavmapIni ini)
 {
     this.ini = ini;
     if (ini.Icons == null)
     {
         throw new Exception("Navmap Ini must have [Icons] section with nav_depot entry");
     }
     if (!ini.Icons.Map.TryGetValue("nav_depot", out var _))
     {
         throw new Exception("Navmap Ini must have nav_depot in [Icons]");
     }
 }
示例#2
0
        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;
        }